diff --git a/SOURCES/0001-llvmpipe-use-ppc64le-ppc64-Large-code-model-for-JIT-.patch b/SOURCES/0001-llvmpipe-use-ppc64le-ppc64-Large-code-model-for-JIT-.patch new file mode 100644 index 0000000..fed6d53 --- /dev/null +++ b/SOURCES/0001-llvmpipe-use-ppc64le-ppc64-Large-code-model-for-JIT-.patch @@ -0,0 +1,71 @@ +From d0ff02e567541468309923fed2320da6cbd81779 Mon Sep 17 00:00:00 2001 +From: Ben Crocker +Date: Thu, 21 Nov 2019 17:33:31 -0500 +Subject: [PATCH] llvmpipe: use ppc64le/ppc64 Large code model for JIT-compiled + shaders + +Large programs, e.g. gnome-shell and firefox, may tax the +addressability of the Medium code model once a (potentially unbounded) +number of dynamically generated JIT-compiled shader programs are +linked in and relocated. Yet the default code model as of LLVM 8 is +Medium or even Small. + +The cost of changing from Medium to Large is negligible: +- an additional 8-byte pointer stored immediately before the shader entrypoint; +- change an add-immediate (addis) instruction to a load (ld). + +Testing with WebGL Conformance +(https://www.khronos.org/registry/webgl/sdk/tests/webgl-conformance-tests.html) +yields clean runs with this change (and crashes without it). + +Testing with glxgears shows no detectable performance difference. + +Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1753327, 1543572, 1747110, and 1582226 + +Closes: https://gitlab.freedesktop.org/mesa/mesa/issues/223 + +Co-authored by: Nemanja Ivanovic , Tom Stellard + +CC: mesa-stable@lists.freedesktop.org + +Signed-off-by: Ben Crocker +Reviewed-by: Adam Jackson +--- + src/gallium/auxiliary/gallivm/lp_bld_misc.cpp | 15 ++++++++++++++- + 1 file changed, 14 insertions(+), 1 deletion(-) + +diff --git a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp +--- a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp ++++ b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp +@@ -686,7 +686,19 @@ lp_build_create_jit_compiler_for_module(LLVMExecutionEngineRef *OutJIT, + * when not using MCJIT so no instructions are generated which the old JIT + * can't handle. Not entirely sure if we really need to do anything yet. + */ +-#if defined(PIPE_ARCH_LITTLE_ENDIAN) && defined(PIPE_ARCH_PPC_64) ++#ifdef PIPE_ARCH_PPC_64 ++ /* ++ * Large programs, e.g. gnome-shell and firefox, may tax the addressability ++ * of the Medium code model once dynamically generated JIT-compiled shader ++ * programs are linked in and relocated. Yet the default code model as of ++ * LLVM 8 is Medium or even Small. ++ * The cost of changing from Medium to Large is negligible: ++ * - an additional 8-byte pointer stored immediately before the shader entrypoint; ++ * - change an add-immediate (addis) instruction to a load (ld). ++ */ ++ builder.setCodeModel(CodeModel::Large); ++ ++#ifdef PIPE_ARCH_LITTLE_ENDIAN + /* + * Versions of LLVM prior to 4.0 lacked a table entry for "POWER8NVL", + * resulting in (big-endian) "generic" being returned on +@@ -698,6 +710,7 @@ lp_build_create_jit_compiler_for_module(LLVMExecutionEngineRef *OutJIT, + */ + if (MCPU == "generic") + MCPU = "pwr8"; ++#endif + #endif + builder.setMCPU(MCPU); + if (gallivm_debug & (GALLIVM_DEBUG_IR | GALLIVM_DEBUG_ASM | GALLIVM_DEBUG_DUMP_BC)) { +-- +2.21.0 + diff --git a/SPECS/mesa.spec b/SPECS/mesa.spec index 104b3a5..74df8bc 100644 --- a/SPECS/mesa.spec +++ b/SPECS/mesa.spec @@ -61,7 +61,7 @@ Summary: Mesa graphics libraries Name: mesa Version: 18.3.4 -Release: 5%{?dist} +Release: 6%{?dist} License: MIT Group: System Environment/Libraries URL: http://www.mesa3d.org @@ -92,6 +92,9 @@ Patch15: mesa-9.2-hardware-float.patch Patch20: mesa-10.2-evergreen-big-endian.patch Patch21: 0001-pkgconfig-Fix-gl.pc-when-glvnd-is-enabled.patch +Patch31: 0001-llvmpipe-use-ppc64le-ppc64-Large-code-model-for-JIT-.patch + + BuildRequires: pkgconfig autoconf automake libtool %if %{with_hardware} BuildRequires: kernel-headers @@ -348,6 +351,7 @@ grep -q ^/ src/gallium/auxiliary/vl/vl_decoder.c && exit 1 %patch15 -p1 -b .hwfloat #patch20 -p1 -b .egbe #%patch21 -p1 -b .glpc +%patch31 -p1 -b .codemodel %if 0%{with_private_llvm} sed -i 's/\[llvm-config\]/\[llvm-private-config-%{__isa_bits}\]/g' configure.ac @@ -664,6 +668,9 @@ rm -rf $RPM_BUILD_ROOT %endif %changelog +* Mon Jan 06 2020 Ben Crocker - 18.3.4-6 +- Patch to require Large CodeModel for llvmpipe on ppc64/ppc64le (#1543572) + * Thu Apr 04 2019 Dave Airlie - 18.3.4-5 - fix remote shm patch