From 13df8a7005d2b9749f796f18895ae8fd3847af2a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Exp=C3=B3sito?= Date: Mon, 27 May 2024 11:23:48 +0200 Subject: [PATCH] Update to 24.1.0 Resolves: https://issues.redhat.com/browse/RHEL-27725 Resolves: https://issues.redhat.com/browse/RHEL-28763 --- .gitignore | 2 + mesa.spec | 185 ++++++++++++++++++++++++++++++++++++++++------------- sources | 4 +- 3 files changed, 146 insertions(+), 45 deletions(-) diff --git a/.gitignore b/.gitignore index bfac055..e450376 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,5 @@ x86_64/ results_mesa/ mesa-*/ +/libclc-*.tar.xz +/spirv-llvm-translator-*.tar.gz diff --git a/mesa.spec b/mesa.spec index 3a92cd3..4c54532 100644 --- a/mesa.spec +++ b/mesa.spec @@ -1,9 +1,13 @@ %ifnarch s390x %global with_hardware 1 +%global with_radeonsi 1 +%global with_vmware 1 %global with_vulkan_hw 1 %global with_vdpau 1 %global with_va 1 %if !0%{?rhel} +%global with_r300 1 +%global with_r600 1 %global with_nine 1 %global with_nvk %{with vulkan_hw} %global with_omx 1 @@ -12,41 +16,39 @@ %global base_vulkan ,amd %endif -%ifarch %{ix86} x86_64 -%global with_crocus 1 -%global with_i915 1 +%ifnarch %{ix86} %if !0%{?rhel} -%global with_intel_clc 1 +%global with_teflon 1 %endif +%endif + +%ifarch %{ix86} x86_64 %global with_iris 1 +%global with_crocus 1 +%global with_vmware 1 %global with_xa 1 +%global with_intel_clc 1 %global intel_platform_vulkan ,intel,intel_hasvk %endif +%ifarch x86_64 +%global with_intel_vk_rt 1 +%endif %ifarch aarch64 x86_64 %{ix86} %if !0%{?rhel} -%global with_lima 1 -%global with_vc4 1 -%endif %global with_etnaviv 1 +%global with_lima 1 +%global with_tegra 1 +%global with_vc4 1 +%global with_v3d 1 +%endif %global with_freedreno 1 %global with_kmsro 1 %global with_panfrost 1 -%global with_tegra 1 -%global with_v3d 1 %global with_xa 1 %global extra_platform_vulkan ,broadcom,freedreno,panfrost,imagination-experimental %endif -%ifnarch s390x -%if !0%{?rhel} -%global with_r300 1 -%global with_r600 1 -%endif -%global with_radeonsi 1 -%global with_vmware 1 -%endif - %if !0%{?rhel} %global with_libunwind 1 %global with_lmsensors 1 @@ -58,11 +60,11 @@ %bcond_with valgrind %endif -%global vulkan_drivers swrast%{?base_vulkan}%{?intel_platform_vulkan}%{?extra_platform_vulkan}%{?with_nvk:,nouveau-experimental} +%global vulkan_drivers swrast%{?base_vulkan}%{?intel_platform_vulkan}%{?extra_platform_vulkan}%{?with_nvk:,nouveau} Name: mesa Summary: Mesa graphics libraries -%global ver 24.0.0 +%global ver 24.1.0 Version: %{lua:ver = string.gsub(rpm.expand("%{ver}"), "-", "~"); print(ver)} Release: %autorelease License: MIT AND BSD-3-Clause AND SGI-B-2.0 @@ -74,9 +76,31 @@ Source0: https://archive.mesa3d.org/mesa-%{ver}.tar.xz # Fedora opts to ignore the optional part of clause 2 and treat that code as 2 clause BSD. Source1: Mesa-MLAA-License-Clarification-Email.txt +# libclc is not available in RHEL 9 but it is required for Intel drivers since +# mesa >= 24.1.0 +%global libclc_version 18.1.2 +Source3: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{libclc_version}/libclc-%{libclc_version}.src.tar.xz +BuildRequires: libedit-devel +BuildRequires: clang-devel >= %{libclc_version} +# Build our own version +# BuildRequires: spirv-llvm-translator-tools + +# spirv-llvm-translator is a dependency of libclc +%global spirv_llvm_trans_ver 18.1.0 +%global spirv_llvm_trans_commit 259f72c06ce9dff3867f842aaeb1e414c97066a5 +%global spirv_llvm_trans_shortcommit %(c=%{spirv_llvm_trans_commit}; echo ${c:0:7}) +Source4: https://github.com/KhronosGroup/SPIRV-LLVM-Translator/archive/%{spirv_llvm_trans_commit}/spirv-llvm-translator-%{spirv_llvm_trans_shortcommit}.tar.gz +BuildRequires: cmake +BuildRequires: ninja-build +BuildRequires: llvm-static +BuildRequires: spirv-headers-devel +BuildRequires: spirv-tools-devel +BuildRequires: zlib-devel + Patch10: gnome-shell-glthread-disable.patch -BuildRequires: meson >= 1.3.0 +# Build our own version but keep the dependency for the RPM macros +BuildRequires: meson BuildRequires: gcc BuildRequires: gcc-c++ BuildRequires: gettext @@ -86,7 +110,7 @@ BuildRequires: kernel-headers # We only check for the minimum version of pkgconfig(libdrm) needed so that the # SRPMs for each arch still have the same build dependencies. See: # https://bugzilla.redhat.com/show_bug.cgi?id=1859515 -BuildRequires: pkgconfig(libdrm) >= 2.4.97 +BuildRequires: pkgconfig(libdrm) >= 2.4.119 %if 0%{?with_libunwind} BuildRequires: pkgconfig(libunwind) %endif @@ -95,7 +119,7 @@ BuildRequires: pkgconfig(zlib) >= 1.2.3 BuildRequires: pkgconfig(libzstd) BuildRequires: pkgconfig(libselinux) BuildRequires: pkgconfig(wayland-scanner) -BuildRequires: pkgconfig(wayland-protocols) >= 1.8 +BuildRequires: pkgconfig(wayland-protocols) >= 1.34 BuildRequires: pkgconfig(wayland-client) >= 1.11 BuildRequires: pkgconfig(wayland-server) >= 1.11 BuildRequires: pkgconfig(wayland-egl-backend) >= 3 @@ -133,21 +157,30 @@ BuildRequires: pkgconfig(libomxil-bellagio) %endif BuildRequires: pkgconfig(libelf) BuildRequires: pkgconfig(libglvnd) >= 1.3.2 -BuildRequires: llvm-devel >= 7.0.0 -%if 0%{?with_opencl} || 0%{?with_nvk} +BuildRequires: llvm-devel >= %{libclc_version} +%if 0%{?with_teflon} +BuildRequires: flatbuffers-devel +BuildRequires: flatbuffers-compiler +BuildRequires: xtensor-devel +%endif +%if 0%{?with_opencl} || 0%{?with_nvk} || 0%{?with_intel_clc} BuildRequires: clang-devel +# Build our own version +# BuildRequires: pkgconfig(libclc) +# BuildRequires: pkgconfig(LLVMSPIRVLib) +BuildRequires: pkgconfig(SPIRV-Tools) +%endif +%if 0%{?with_opencl} || 0%{?with_nvk} BuildRequires: bindgen BuildRequires: rust-packaging -BuildRequires: pkgconfig(libclc) -BuildRequires: pkgconfig(SPIRV-Tools) -BuildRequires: pkgconfig(LLVMSPIRVLib) %endif %if 0%{?with_nvk} +BuildRequires: cbindgen +BuildRequires: (crate(paste) >= 1.0.14 with crate(paste) < 2) BuildRequires: (crate(proc-macro2) >= 1.0.56 with crate(proc-macro2) < 2) BuildRequires: (crate(quote) >= 1.0.25 with crate(quote) < 2) BuildRequires: (crate(syn/clone-impls) >= 2.0.15 with crate(syn/clone-impls) < 3) BuildRequires: (crate(unicode-ident) >= 1.0.6 with crate(unicode-ident) < 2) -BuildRequires: systemd-rpm-macros %endif %if %{with valgrind} BuildRequires: pkgconfig(valgrind) @@ -157,6 +190,7 @@ BuildRequires: python3-mako %if 0%{?with_intel_clc} BuildRequires: python3-ply %endif +BuildRequires: python3-pycparser BuildRequires: vulkan-headers BuildRequires: glslang %if 0%{?with_vulkan_hw} @@ -341,6 +375,14 @@ Requires: %{name}-libOpenCL%{?_isa} = %{?epoch:%{epoch}:}%{version}-%{rele %{summary}. %endif +%if 0%{?with_teflon} +%package libTeflon +Summary: Mesa TensorFlow Lite delegate + +%description libTeflon +%{summary}. +%endif + %if 0%{?with_nine} %package libd3d Summary: Mesa Direct3D9 state tracker @@ -368,7 +410,50 @@ The drivers with support for the Vulkan API. %autosetup -n %{name}-%{ver} -p1 cp %{SOURCE1} docs/ +# Extract libclc +tar -xvf %{SOURCE3} + +# Extract spirv-llvm-translator +tar -xvf %{SOURCE4} + %build +# Build spirv-llvm-translator +cd SPIRV-LLVM-Translator-%{spirv_llvm_trans_commit} +%cmake -GNinja \ + -DLLVM_BUILD_TOOLS=ON \ + -DCMAKE_BUILD_TYPE=RelWithDebInfo \ + -DCMAKE_INSTALL_RPATH:BOOL=";" \ + -DLLVM_DIR="/usr/lib64/cmake/llvm/" \ +%if 0%{?__isa_bits} == 64 + -DLLVM_LIBDIR_SUFFIX=64 \ +%else + -DLLVM_LIBDIR_SUFFIX= \ +%endif + -DLLVM_EXTERNAL_PROJECTS="SPIRV-Headers" \ + -DLLVM_EXTERNAL_SPIRV_HEADERS_SOURCE_DIR="/usr/include/spirv/" +%cmake_build +%cmake_install +cd - + +export LIBRARY_PATH=%{buildroot}%{_libdir}:$LIBRARY_PATH +export LD_LIBRARY_PATH=%{buildroot}%{_libdir}:$LD_LIBRARY_PATH +export XDG_DATA_DIRS=%{buildroot}%{_datadir}:$XDG_DATA_DIRS +export CPATH=%{buildroot}%{_includedir}:$CPATH +export PKG_CONFIG_PATH=%{buildroot}%{_libdir}/pkgconfig:%{buildroot}%{_datadir}/pkgconfig:$PKG_CONFIG_PATH +export PATH=%{buildroot}%{_bindir}:$PATH + +# Build libclc +cd libclc-%{libclc_version}.src +export CFLAGS="%{build_cflags} -D__extern_always_inline=inline" +%cmake -GNinja \ + -DCMAKE_INSTALL_DATADIR:PATH=%{_lib} \ + -DLIBCLC_TARGETS_TO_BUILD="spirv-mesa3d-;spirv64-mesa3d-" \ + -DLLVM_SPIRV=%{buildroot}%{_bindir}/llvm-spirv +%cmake_build +%cmake_install +cd - +sed -e "s!libexecdir=!libexecdir=\/%{buildroot}!" -i %{buildroot}%{_libdir}/pkgconfig/libclc.pc + # ensure standard Rust compiler flags are set export RUSTFLAGS="%build_rustflags" @@ -382,6 +467,7 @@ export MESON_PACKAGE_CACHE_DIR="%{cargo_registry}/" %rewrite_wrap_file quote %rewrite_wrap_file syn %rewrite_wrap_file unicode-ident +%rewrite_wrap_file paste %endif # We've gotten a report that enabling LTO for mesa breaks some games. See @@ -394,7 +480,7 @@ export MESON_PACKAGE_CACHE_DIR="%{cargo_registry}/" -Ddri3=enabled \ -Dosmesa=true \ %if 0%{?with_hardware} - -Dgallium-drivers=swrast,virgl,nouveau%{?with_r300:,r300}%{?with_crocus:,crocus}%{?with_i915:,i915}%{?with_iris:,iris}%{?with_vmware:,svga}%{?with_radeonsi:,radeonsi}%{?with_r600:,r600}%{?with_freedreno:,freedreno}%{?with_etnaviv:,etnaviv}%{?with_tegra:,tegra}%{?with_vc4:,vc4}%{?with_v3d:,v3d}%{?with_kmsro:,kmsro}%{?with_lima:,lima}%{?with_panfrost:,panfrost}%{?with_vulkan_hw:,zink} \ + -Dgallium-drivers=swrast,virgl,nouveau%{?with_r300:,r300}%{?with_crocus:,crocus}%{?with_iris:,iris}%{?with_vmware:,svga}%{?with_radeonsi:,radeonsi}%{?with_r600:,r600}%{?with_freedreno:,freedreno}%{?with_etnaviv:,etnaviv}%{?with_tegra:,tegra}%{?with_vc4:,vc4}%{?with_v3d:,v3d}%{?with_kmsro:,kmsro}%{?with_lima:,lima}%{?with_panfrost:,panfrost}%{?with_vulkan_hw:,zink} \ %else -Dgallium-drivers=swrast,virgl \ %endif @@ -403,6 +489,7 @@ export MESON_PACKAGE_CACHE_DIR="%{cargo_registry}/" -Dgallium-va=%{?with_va:enabled}%{!?with_va:disabled} \ -Dgallium-xa=%{?with_xa:enabled}%{!?with_xa:disabled} \ -Dgallium-nine=%{?with_nine:true}%{!?with_nine:false} \ + -Dteflon=%{?with_teflon:true}%{!?with_teflon:false} \ -Dgallium-opencl=%{?with_opencl:icd}%{!?with_opencl:disabled} \ %if 0%{?with_opencl} -Dgallium-rusticl=true \ @@ -416,10 +503,11 @@ export MESON_PACKAGE_CACHE_DIR="%{cargo_registry}/" -Dgbm=enabled \ -Dglx=dri \ -Degl=enabled \ - -Dglvnd=true \ + -Dglvnd=enabled \ %if 0%{?with_intel_clc} -Dintel-clc=enabled \ %endif + -Dintel-rt=%{?with_intel_vk_rt:enabled}%{!?with_intel_vk_rt:disabled} \ -Dmicrosoft-clc=disabled \ -Dllvm=enabled \ -Dshared-llvm=enabled \ @@ -434,7 +522,7 @@ export MESON_PACKAGE_CACHE_DIR="%{cargo_registry}/" %endif -Dandroid-libbacktrace=disabled \ %ifarch %{ix86} - -Dglx-read-only-text=true + -Dglx-read-only-text=true \ %endif %{nil} %meson_build @@ -442,6 +530,17 @@ export MESON_PACKAGE_CACHE_DIR="%{cargo_registry}/" %install %meson_install +# Delete files installed by libclc +rm -fr %{buildroot}%{_libdir}/clc +rm -f %{buildroot}%{_libdir}/pkgconfig/libclc.pc + +# Delete files installed by spirv-llvm-translator +rm -f %{buildroot}%{_bindir}/llvm-spirv +rm -fr %{buildroot}%{_includedir}/LLVMSPIRVLib +rm -f %{buildroot}%{_libdir}/libLLVMSPIRVLib.so +rm -f %{buildroot}%{_libdir}/libLLVMSPIRVLib.so.* +rm -f %{buildroot}%{_libdir}/pkgconfig/LLVMSPIRVLib.pc + # libvdpau opens the versioned name, don't bother including the unversioned rm -vf %{buildroot}%{_libdir}/vdpau/*.so # likewise glvnd @@ -461,16 +560,6 @@ for i in libOSMesa*.so libGL.so ; do done popd -%if 0%{?with_nvk} -# Temporarily produce a modprobe file that enables nouveau+gsp for Turing/Ampere -# until enabled upstream by default -mkdir -p %{buildroot}%{_modprobedir} -cat > %{buildroot}%{_modprobedir}/nouveau-gsp.conf << NOUVEAUEOF -# Enable GSP firmware for Turing and Ampere -options nouveau config=NvGspRm=1 -NOUVEAUEOF -%endif - %files filesystem %doc docs/Mesa-MLAA-License-Clarification-Email.txt %dir %{_libdir}/dri @@ -534,12 +623,18 @@ NOUVEAUEOF %endif %endif +%if 0%{?with_teflon} +%files libTeflon +%{_libdir}/libteflon.so +%endif + %if 0%{?with_opencl} %files libOpenCL %{_libdir}/libMesaOpenCL.so.* %{_libdir}/libRusticlOpenCL.so.* %{_sysconfdir}/OpenCL/vendors/mesa.icd %{_sysconfdir}/OpenCL/vendors/rusticl.icd + %files libOpenCL-devel %{_libdir}/libMesaOpenCL.so %{_libdir}/libRusticlOpenCL.so @@ -575,7 +670,6 @@ NOUVEAUEOF %endif %ifarch %{ix86} x86_64 %{_libdir}/dri/crocus_dri.so -%{_libdir}/dri/i915_dri.so %{_libdir}/dri/iris_dri.so %endif %ifarch aarch64 x86_64 %{ix86} @@ -611,6 +705,7 @@ NOUVEAUEOF %endif %if 0%{?with_panfrost} %{_libdir}/dri/panfrost_dri.so +%{_libdir}/dri/panthor_dri.so %endif %{_libdir}/dri/nouveau_dri.so %if 0%{?with_vmware} @@ -639,11 +734,14 @@ NOUVEAUEOF %{_libdir}/dri/pl111_dri.so %{_libdir}/dri/repaper_dri.so %{_libdir}/dri/rockchip_dri.so +%{_libdir}/dri/rzg2l-du_dri.so +%{_libdir}/dri/ssd130x_dri.so %{_libdir}/dri/st7586_dri.so %{_libdir}/dri/st7735r_dri.so %{_libdir}/dri/sti_dri.so %{_libdir}/dri/sun4i-drm_dri.so %{_libdir}/dri/udl_dri.so +%{_libdir}/dri/zynqmp-dpsub_dri.so %endif %if 0%{?with_vulkan_hw} %{_libdir}/dri/zink_dri.so @@ -688,7 +786,6 @@ NOUVEAUEOF %{_datadir}/drirc.d/00-radv-defaults.conf %{_datadir}/vulkan/icd.d/radeon_icd.*.json %if 0%{?with_nvk} -%{_modprobedir}/nouveau-gsp.conf %{_libdir}/libvulkan_nouveau.so %{_datadir}/vulkan/icd.d/nouveau_icd.*.json %endif diff --git a/sources b/sources index 0380d04..0f6e715 100644 --- a/sources +++ b/sources @@ -1 +1,3 @@ -SHA512 (mesa-24.0.0.tar.xz) = 9dfdea7cebb37b9c020335e24194b39b399f48b5af6eec30c3455108276ac4e29e7b06df942cb2abc7afa667784968c0c43d19b9afe30ef03021b9cb6a789f15 +SHA512 (libclc-18.1.2.src.tar.xz) = 1a6ac7ff487e54183600ee6b0307ad46d3d4d295e21bb5206958bd303be6734249f42303fb5b528885d0e409174fe22c271267c692488b306a46cc617ff73346 +SHA512 (mesa-24.1.0.tar.xz) = 4b7ed1940fc812ef4efb55978d3ffe3d0e2ae53d5b57a3baca10a52db2ba5852c5ee7e75c3739bd8d384c80bf1cba970a384250050f01f03bba98f255e12cec5 +SHA512 (spirv-llvm-translator-259f72c.tar.gz) = b5cb5be767f679c22eaf35c4fcf875855277b684bb3a5edbd687c4df6621386e5f769a599b582a0020cdcfc87d9a3e0122c1c14cd67987f77546b5acd1891d68