From 6aae606725bd6f7ba75c15011f0a0850a6d2acd8 Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Sun, 19 Jan 2014 00:06:01 +0400 Subject: [PATCH] enable OpenCL, r600-llvm Enable OpenCL (RHBZ #887628) Enable r600 llvm compiler (RHBZ #1055098) Signed-off-by: Igor Gnatenko --- .gitignore | 1 + ...opencl-use-versioned-.so-in-mesa.icd.patch | 71 +++++++++++++++++++ mesa.spec | 62 ++++++++++++++-- sources | 2 +- 4 files changed, 130 insertions(+), 6 deletions(-) create mode 100644 0001-opencl-use-versioned-.so-in-mesa.icd.patch diff --git a/.gitignore b/.gitignore index e6775da..a5b5289 100644 --- a/.gitignore +++ b/.gitignore @@ -62,3 +62,4 @@ mesa-20100720.tar.bz2 /mesa-20131206.tar.xz /mesa-20131220.tar.xz /mesa-20140110.tar.xz +/mesa-20140118.tar.xz diff --git a/0001-opencl-use-versioned-.so-in-mesa.icd.patch b/0001-opencl-use-versioned-.so-in-mesa.icd.patch new file mode 100644 index 0000000..2875e57 --- /dev/null +++ b/0001-opencl-use-versioned-.so-in-mesa.icd.patch @@ -0,0 +1,71 @@ +From 348caa4b9ab2b00871c8ea73aaf59311f9a853e8 Mon Sep 17 00:00:00 2001 +From: Igor Gnatenko +Date: Sun, 12 Jan 2014 02:09:16 +0400 +Subject: [PATCH] opencl: use versioned .so in mesa.icd + +We must have versioned library in mesa.icd, because ICD loader would +fail if the mesa-devel package wasn't installed. + +Reported-by: Fabian Deutsch +Reference: https://bugs.freedesktop.org/show_bug.cgi?id=73512 +Signed-off-by: Igor Gnatenko +--- + configure.ac | 3 +++ + src/gallium/targets/opencl/Makefile.am | 2 +- + src/gallium/targets/opencl/mesa.icd | 1 - + src/gallium/targets/opencl/mesa.icd.in | 1 + + 4 files changed, 5 insertions(+), 2 deletions(-) + delete mode 100644 src/gallium/targets/opencl/mesa.icd + create mode 100644 src/gallium/targets/opencl/mesa.icd.in + +diff --git a/configure.ac b/configure.ac +index 4da6c51..c195b1b 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -25,6 +25,8 @@ m4_ifdef([AM_PROG_AR], [AM_PROG_AR]) + dnl Set internal versions + OSMESA_VERSION=8 + AC_SUBST([OSMESA_VERSION]) ++OPENCL_VERSION=1 ++AC_SUBST([OPENCL_VERSION]) + + dnl Versions for external dependencies + LIBDRM_REQUIRED=2.4.24 +@@ -2023,6 +2025,7 @@ AC_CONFIG_FILES([Makefile + src/gallium/targets/egl-static/Makefile + src/gallium/targets/gbm/Makefile + src/gallium/targets/opencl/Makefile ++ src/gallium/targets/opencl/mesa.icd + src/gallium/targets/osmesa/Makefile + src/gallium/targets/osmesa/osmesa.pc + src/gallium/targets/pipe-loader/Makefile +diff --git a/src/gallium/targets/opencl/Makefile.am b/src/gallium/targets/opencl/Makefile.am +index 653302c..3b257ca 100644 +--- a/src/gallium/targets/opencl/Makefile.am ++++ b/src/gallium/targets/opencl/Makefile.am +@@ -4,7 +4,7 @@ lib_LTLIBRARIES = lib@OPENCL_LIBNAME@.la + + lib@OPENCL_LIBNAME@_la_LDFLAGS = \ + $(LLVM_LDFLAGS) \ +- -version-number 1:0 ++ -version-number @OPENCL_VERSION@:0 + + lib@OPENCL_LIBNAME@_la_LIBADD = \ + $(top_builddir)/src/gallium/auxiliary/pipe-loader/libpipe_loader.la \ +diff --git a/src/gallium/targets/opencl/mesa.icd b/src/gallium/targets/opencl/mesa.icd +deleted file mode 100644 +index 6a6a870..0000000 +--- a/src/gallium/targets/opencl/mesa.icd ++++ /dev/null +@@ -1 +0,0 @@ +-libMesaOpenCL.so +diff --git a/src/gallium/targets/opencl/mesa.icd.in b/src/gallium/targets/opencl/mesa.icd.in +new file mode 100644 +index 0000000..1b77b4e +--- /dev/null ++++ b/src/gallium/targets/opencl/mesa.icd.in +@@ -0,0 +1 @@ ++lib@OPENCL_LIBNAME@.so.@OPENCL_VERSION@ +-- +1.8.4.2 + diff --git a/mesa.spec b/mesa.spec index 8917fc0..98f1033 100644 --- a/mesa.spec +++ b/mesa.spec @@ -39,6 +39,7 @@ %ifarch %{ix86} x86_64 %define platform_drivers ,i915,i965 %define with_vmware 1 +%define with_opencl 1 %endif %ifarch ppc %define platform_drivers ,swrast @@ -49,13 +50,13 @@ %define _default_patch_fuzz 2 -%define gitdate 20140110 +%define gitdate 20140118 #% define snapshot Summary: Mesa graphics libraries Name: mesa Version: 10.0.2 -Release: 2.%{gitdate}%{?dist} +Release: 3.%{gitdate}%{?dist} License: MIT Group: System Environment/Libraries URL: http://www.mesa3d.org @@ -80,6 +81,9 @@ Patch20: mesa-9.2-evergreen-big-endian.patch # backport from upstream to allow cogl use copy_sub_buffer Patch30: 0001-swrast-gallium-classic-add-MESA_copy_sub_buffer-supp.patch +# https://bugs.freedesktop.org/show_bug.cgi?id=73512 +Patch99: 0001-opencl-use-versioned-.so-in-mesa.icd.patch + BuildRequires: pkgconfig autoconf automake libtool %if %{with_hardware} BuildRequires: kernel-headers @@ -104,6 +108,9 @@ BuildRequires: gettext BuildRequires: mesa-private-llvm-devel %else BuildRequires: llvm-devel >= 3.0 +%if 0%{?with_opencl} +BuildRequires: clang-devel >= 3.0 +%endif %endif %endif BuildRequires: elfutils-libelf-devel @@ -119,6 +126,9 @@ BuildRequires: mesa-libGL-devel BuildRequires: libvdpau-devel %endif BuildRequires: zlib-devel +%if 0%{?with_opencl} +BuildRequires: libclc-devel llvm-static opencl-filesystem +%endif %description Mesa @@ -284,6 +294,25 @@ Group: System Environment/Libraries %description libglapi Mesa shared glapi + +%if 0%{?with_opencl} +%package libOpenCL +Summary: Mesa OpenCL runtime library +Requires: ocl-icd +Requires: libclc +Requires: mesa-libgbm = %{version}-%{release} + +%description libOpenCL +Mesa OpenCL runtime library. + +%package libOpenCL-devel +Summary: Mesa OpenCL development package +Requires: mesa-libOpenCL%{?_isa} = %{version}-%{release} + +%description libOpenCL-devel +Mesa OpenCL development package. +%endif + %prep #setup -q -n Mesa-%{version}%{?snapshot} %setup -q -n mesa-%{gitdate} @@ -306,6 +335,10 @@ grep -q ^/ src/gallium/auxiliary/vl/vl_decoder.c && exit 1 %patch30 -p1 -b .copy_sub_buffer +%if 0%{with_opencl} +%patch99 -p1 -b .icd +%endif + %if 0%{with_private_llvm} sed -i 's/llvm-config/mesa-private-llvm-config-%{__isa_bits}/g' configure.ac sed -i 's/`$LLVM_CONFIG --version`/&-mesa/' configure.ac @@ -322,7 +355,7 @@ cp %{SOURCE4} docs/ %build -autoreconf --install +autoreconf --install export CFLAGS="$RPM_OPT_FLAGS" # C++ note: we never say "catch" in the source. we do say "typeid" once, @@ -330,7 +363,7 @@ export CFLAGS="$RPM_OPT_FLAGS" # # We do say 'catch' in the clover and d3d1x state trackers, but we're not # building those yet. -export CXXFLAGS="$RPM_OPT_FLAGS -fno-rtti -fno-exceptions" +export CXXFLAGS="$RPM_OPT_FLAGS %{?with_opencl:-frtti -fexceptions} %{!?with_opencl:-fno-rtti -fno-exceptions}" %ifarch %{ix86} # i do not have words for how much the assembly dispatch code infuriates me %define asm_flags --disable-asm @@ -350,7 +383,7 @@ export CXXFLAGS="$RPM_OPT_FLAGS -fno-rtti -fno-exceptions" --with-egl-platforms=x11,drm%{?with_wayland:,wayland} \ --enable-shared-glapi \ --enable-gbm \ - --disable-opencl \ + %{?with_opencl:--enable-opencl --enable-opencl-icd --with-clang-libdir=%{_prefix}/lib} %{!?with_opencl:--disable-opencl} \ --enable-glx-tls \ --enable-texture-float=yes \ %{?with_llvm:--enable-gallium-llvm} \ @@ -359,6 +392,7 @@ export CXXFLAGS="$RPM_OPT_FLAGS -fno-rtti -fno-exceptions" %if %{with_hardware} %{?with_vmware:--enable-xa} \ --with-gallium-drivers=%{?with_vmware:svga,}%{?with_radeonsi:radeonsi,}%{?with_llvm:swrast,r600,}%{?with_freedreno:freedreno,}r300,nouveau \ + %{?with_llvm:--enable-r600-llvm-compiler} \ %else --with-gallium-drivers=%{?with_llvm:swrast} \ %endif @@ -424,6 +458,10 @@ rm -rf $RPM_BUILD_ROOT %post libxatracker -p /sbin/ldconfig %postun libxatracker -p /sbin/ldconfig %endif +%if 0%{?with_opencl} +%post libOpenCL -p /sbin/ldconfig +%postun libOpenCL -p /sbin/ldconfig +%endif %files libGL %defattr(-,root,root,-) @@ -596,7 +634,21 @@ rm -rf $RPM_BUILD_ROOT %endif %endif +%if 0%{?with_opencl} +%files libOpenCL +%{_libdir}/libMesaOpenCL.so.* +%{_libdir}/gallium-pipe/ +%{_sysconfdir}/OpenCL/vendors/mesa.icd + +%files libOpenCL-devel +%{_libdir}/libMesaOpenCL.so +%endif + %changelog +* Sun Jan 19 2014 Igor Gnatenko - 10.0.2-3.20140118 +- Enable OpenCL (RHBZ #887628) +- Enable r600 llvm compiler (RHBZ #1055098) + * Tue Jan 14 2014 Dave Airlie 10.0.2-2.20140110 - rebuild for llvm 3.4 diff --git a/sources b/sources index dcf0558..e461712 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -c0aa800b1ea525f2aa41bdfd0dfc5a79 mesa-20140110.tar.xz +aad7f1f42dbfe973ae36a777e51df031 mesa-20140118.tar.xz