Date: Wednesday, September 10, 2014 @ 23:09:47 Author: foutrelis Revision: 221414
upgpkg: mesa 10.2.7-3 Possible fix for FS#41918. Added: mesa/trunk/0001-gallivm-Disable-workaround-for-PR12833-on-LLVM-3.2.patch mesa/trunk/0002-gallivm-set-mcpu-when-initializing-llvm-execution-en.patch Modified: mesa/trunk/PKGBUILD -----------------------------------------------------------------+ 0001-gallivm-Disable-workaround-for-PR12833-on-LLVM-3.2.patch | 33 ++++ 0002-gallivm-set-mcpu-when-initializing-llvm-execution-en.patch | 77 ++++++++++ PKGBUILD | 11 + 3 files changed, 120 insertions(+), 1 deletion(-) Added: 0001-gallivm-Disable-workaround-for-PR12833-on-LLVM-3.2.patch =================================================================== --- 0001-gallivm-Disable-workaround-for-PR12833-on-LLVM-3.2.patch (rev 0) +++ 0001-gallivm-Disable-workaround-for-PR12833-on-LLVM-3.2.patch 2014-09-10 21:09:47 UTC (rev 221414) @@ -0,0 +1,33 @@ +From 22c970946535956abac321585598425ad5cc82c5 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Jos=C3=A9=20Fonseca?= <jfons...@vmware.com> +Date: Wed, 14 May 2014 12:55:50 +0100 +Subject: [PATCH 1/2] gallivm: Disable workaround for PR12833 on LLVM 3.2+. + +Fixed upstream. + +(cherry picked from commit 172ef0c5a5a97c211702eb4033eeaac20993350e) +--- + src/gallium/auxiliary/gallivm/lp_bld_misc.cpp | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp +index d85adfb..45c985d 100644 +--- a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp ++++ b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp +@@ -321,11 +321,11 @@ lp_build_create_jit_compiler_for_module(LLVMExecutionEngineRef *OutJIT, + builder.setJITMemoryManager(JITMemoryManager::CreateDefaultMemManager()); + + ExecutionEngine *JIT; +-#if 0 ++#if HAVE_LLVM >= 0x0302 + JIT = builder.create(); + #else + /* +- * Workaround http://llvm.org/bugs/show_bug.cgi?id=12833 ++ * Workaround http://llvm.org/PR12833 + */ + StringRef MArch = ""; + StringRef MCPU = ""; +-- +2.1.0 + Added: 0002-gallivm-set-mcpu-when-initializing-llvm-execution-en.patch =================================================================== --- 0002-gallivm-set-mcpu-when-initializing-llvm-execution-en.patch (rev 0) +++ 0002-gallivm-set-mcpu-when-initializing-llvm-execution-en.patch 2014-09-10 21:09:47 UTC (rev 221414) @@ -0,0 +1,77 @@ +From ebe30fd4d4a90219431b6947f233473b2cf518a5 Mon Sep 17 00:00:00 2001 +From: Roland Scheidegger <srol...@vmware.com> +Date: Thu, 19 Jun 2014 03:27:26 +0200 +Subject: [PATCH 2/2] gallivm: set mcpu when initializing llvm execution engine + +Previously llvm detected cpu features automatically when the execution engine +was created (based on host cpu). This is no longer the case, which meant llvm +was then not able to emit some of the intrinsics we used as we didn't specify +any sse attributes (only on avx supporting systems this was not a problem since +despite at least some llvm versions enabling it anyway we always set this +manually). So, instead of trying to figure out which MAttrs to set just set +MCPU. + +This fixes https://bugs.freedesktop.org/show_bug.cgi?id=77493. + +Reviewed-by: Jose Fonseca <jfons...@vmware.com> +Tested-by: Vinson Lee <v...@freedesktop.org> +(cherry picked from commit cad60420d5ea36a4b6fa2e6c91317f71423aa63e) +--- + src/gallium/auxiliary/gallivm/lp_bld_misc.cpp | 24 ++++++++++++++++++++++-- + 1 file changed, 22 insertions(+), 2 deletions(-) + +diff --git a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp +index 45c985d..395ac7b 100644 +--- a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp ++++ b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp +@@ -59,6 +59,7 @@ + #include <llvm/ExecutionEngine/JITMemoryManager.h> + #endif + #include <llvm/Support/CommandLine.h> ++#include <llvm/Support/Host.h> + #include <llvm/Support/PrettyStackTrace.h> + + #if HAVE_LLVM >= 0x0300 +@@ -309,8 +310,8 @@ lp_build_create_jit_compiler_for_module(LLVMExecutionEngineRef *OutJIT, + /* + * AVX feature is not automatically detected from CPUID by the X86 target + * yet, because the old (yet default) JIT engine is not capable of +- * emitting the opcodes. But as we're using MCJIT here, it is safe to +- * add set this attribute. ++ * emitting the opcodes. On newer llvm versions it is and at least some ++ * versions (tested with 3.3) will emit avx opcodes without this anyway. + */ + MAttrs.push_back("+avx"); + if (util_cpu_caps.has_f16c) { +@@ -318,9 +319,28 @@ lp_build_create_jit_compiler_for_module(LLVMExecutionEngineRef *OutJIT, + } + builder.setMAttrs(MAttrs); + } ++ ++#if HAVE_LLVM >= 0x0305 ++ StringRef MCPU = llvm::sys::getHostCPUName(); ++ /* ++ * The cpu bits are no longer set automatically, so need to set mcpu manually. ++ * Note that the MAttrs set above will be sort of ignored (since we should ++ * not set any which would not be set by specifying the cpu anyway). ++ * It ought to be safe though since getHostCPUName() should include bits ++ * not only from the cpu but environment as well (for instance if it's safe ++ * to use avx instructions which need OS support). According to ++ * http://llvm.org/bugs/show_bug.cgi?id=19429 however if I understand this ++ * right it may be necessary to specify older cpu (or disable mattrs) though ++ * 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. ++ */ ++ builder.setMCPU(MCPU); ++#endif ++ + builder.setJITMemoryManager(JITMemoryManager::CreateDefaultMemManager()); + + ExecutionEngine *JIT; ++ + #if HAVE_LLVM >= 0x0302 + JIT = builder.create(); + #else +-- +2.1.0 + Modified: PKGBUILD =================================================================== --- PKGBUILD 2014-09-10 19:12:51 UTC (rev 221413) +++ PKGBUILD 2014-09-10 21:09:47 UTC (rev 221414) @@ -5,7 +5,7 @@ pkgbase=mesa pkgname=('opencl-mesa' 'ati-dri' 'intel-dri' 'nouveau-dri' 'svga-dri' 'mesa' 'mesa-libgl') pkgver=10.2.7 -pkgrel=2 +pkgrel=3 arch=('i686' 'x86_64') makedepends=('python2' 'libxml2' 'libx11' 'glproto' 'libdrm' 'dri2proto' 'dri3proto' 'presentproto' 'libxshmfence' 'libxxf86vm' 'libxdamage' 'libvdpau' 'wayland' 'elfutils' 'llvm' 'systemd' @@ -14,10 +14,14 @@ license=('custom') source=(ftp://ftp.freedesktop.org/pub/mesa/${pkgver}/MesaLib-${pkgver}.tar.bz2{,.sig} llvm35.patch + 0001-gallivm-Disable-workaround-for-PR12833-on-LLVM-3.2.patch + 0002-gallivm-set-mcpu-when-initializing-llvm-execution-en.patch LICENSE) sha256sums=('27b958063a4c002071f14ed45c7d2a1ee52cd85e4ac8876e8a1c273495a7d43f' 'SKIP' 'd3d433564cd21da8aa56a9ceccee6122d5991cae2bd1924173359f13bd38bd6f' + '5d66636b06736027708ffa60afb92fc81f085df35b9d91ab7ac4107c8b52d500' + '8dc0935e66669bc111e69a80057831aa1f675179ca689c1c044ab588587da010' '7fdc119cf53c8ca65396ea73f6d10af641ba41ea1dd2bd44a824726e01c8b3f2') prepare() { @@ -24,6 +28,11 @@ cd ${srcdir}/?esa-* patch -Np1 -i ../llvm35.patch + + # https://bugs.freedesktop.org/show_bug.cgi?id=77493 + # https://bugs.freedesktop.org/show_bug.cgi?id=83735 + patch -Np1 -i ../0001-gallivm-Disable-workaround-for-PR12833-on-LLVM-3.2.patch + patch -Np1 -i ../0002-gallivm-set-mcpu-when-initializing-llvm-execution-en.patch } build() {