diff options
author | Khem Raj <raj.khem@gmail.com> | 2017-07-29 00:42:49 -0700 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-07-31 15:13:32 +0100 |
commit | 6f12ac612ca29adc2f2a40526a757adfee92fb12 (patch) | |
tree | 3bb923d150fbb74cfbad6690d708ff18c2c43e4b | |
parent | 5c77067ee9c18e056515a5e83e7282b0035dfb49 (diff) | |
download | poky-6f12ac612ca29adc2f2a40526a757adfee92fb12.tar.gz |
mesa: Fix build when building with llvmpipe
Add following in mesa.inc to enable llvmpipe
PACKAGECONFIG_append_x86 = " gallium-llvm gallium r600"
PACKAGECONFIG_append_x86-64 = " gallium-llvm gallium r600"
This would enable llvmpipe for swrast, to check run this
root@qemux86:~# glxinfo | grep llvm
Device: llvmpipe (LLVM 5.0, 128 bits) (0xffffffff)
OpenGL renderer string: Gallium 0.4 on llvmpipe (LLVM 5.0, 128 bits)
Backport patches to support llvm 5.0.0+
Add a patch to understand llvm version when llvm is build from git/svn
(From OE-Core rev: da29bc17e4dd748f50b054c5e3afaf8d41bf4077)
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
5 files changed, 129 insertions, 2 deletions
diff --git a/meta/recipes-graphics/mesa/files/0001-ac-fix-build-after-LLVM-5.0-SVN-r300718.patch b/meta/recipes-graphics/mesa/files/0001-ac-fix-build-after-LLVM-5.0-SVN-r300718.patch new file mode 100644 index 0000000000..b27a3bc8e4 --- /dev/null +++ b/meta/recipes-graphics/mesa/files/0001-ac-fix-build-after-LLVM-5.0-SVN-r300718.patch | |||
@@ -0,0 +1,40 @@ | |||
1 | From 9861437e58fdd0de01193a102608d34e5952953f Mon Sep 17 00:00:00 2001 | ||
2 | From: Christoph Haag <haagch+mesadev@frickel.club> | ||
3 | Date: Thu, 20 Apr 2017 10:34:18 +0200 | ||
4 | Subject: [PATCH 1/2] ac: fix build after LLVM 5.0 SVN r300718 | ||
5 | MIME-Version: 1.0 | ||
6 | Content-Type: text/plain; charset=UTF-8 | ||
7 | Content-Transfer-Encoding: 8bit | ||
8 | |||
9 | v2: previously getWithDereferenceableBytes() exists, but addAttr() doesn't take that type | ||
10 | |||
11 | Signed-off-by: Christoph Haag <haagch+mesadev@frickel.club> | ||
12 | Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com> | ||
13 | Tested-and-reviewed-by: Mike Lothian <mike@fireburn.co.uk> | ||
14 | --- | ||
15 | Upstream-Status: Backport | ||
16 | |||
17 | src/amd/common/ac_llvm_helper.cpp | 4 ++++ | ||
18 | 1 file changed, 4 insertions(+) | ||
19 | |||
20 | diff --git a/src/amd/common/ac_llvm_helper.cpp b/src/amd/common/ac_llvm_helper.cpp | ||
21 | index d9ea4b1..11fa809 100644 | ||
22 | --- a/src/amd/common/ac_llvm_helper.cpp | ||
23 | +++ b/src/amd/common/ac_llvm_helper.cpp | ||
24 | @@ -44,9 +44,13 @@ typedef AttributeSet AttributeList; | ||
25 | void ac_add_attr_dereferenceable(LLVMValueRef val, uint64_t bytes) | ||
26 | { | ||
27 | llvm::Argument *A = llvm::unwrap<llvm::Argument>(val); | ||
28 | +#if HAVE_LLVM < 0x0500 | ||
29 | llvm::AttrBuilder B; | ||
30 | B.addDereferenceableAttr(bytes); | ||
31 | A->addAttr(llvm::AttributeList::get(A->getContext(), A->getArgNo() + 1, B)); | ||
32 | +#else | ||
33 | + A->addAttr(llvm::Attribute::getWithDereferenceableBytes(A->getContext(), bytes)); | ||
34 | +#endif | ||
35 | } | ||
36 | |||
37 | bool ac_is_sgpr_param(LLVMValueRef arg) | ||
38 | -- | ||
39 | 2.13.3 | ||
40 | |||
diff --git a/meta/recipes-graphics/mesa/files/0002-gallivm-Fix-build-against-LLVM-SVN-r302589.patch b/meta/recipes-graphics/mesa/files/0002-gallivm-Fix-build-against-LLVM-SVN-r302589.patch new file mode 100644 index 0000000000..ac8caec74d --- /dev/null +++ b/meta/recipes-graphics/mesa/files/0002-gallivm-Fix-build-against-LLVM-SVN-r302589.patch | |||
@@ -0,0 +1,49 @@ | |||
1 | From a02a0dfda2712d30ad62b8f0421ec7b8244ba2cb Mon Sep 17 00:00:00 2001 | ||
2 | From: =?UTF-8?q?Michel=20D=C3=A4nzer?= <michel.daenzer@amd.com> | ||
3 | Date: Wed, 10 May 2017 17:26:07 +0900 | ||
4 | Subject: [PATCH 2/2] gallivm: Fix build against LLVM SVN >= r302589 | ||
5 | MIME-Version: 1.0 | ||
6 | Content-Type: text/plain; charset=UTF-8 | ||
7 | Content-Transfer-Encoding: 8bit | ||
8 | |||
9 | deregisterEHFrames doesn't take any parameters anymore. | ||
10 | |||
11 | Reviewed-by: Vedran Miletić <vedran@miletic.net> | ||
12 | Reviewed-by: Marek Olšák <marek.olsak@amd.com> | ||
13 | --- | ||
14 | Upstream-Status: Backport | ||
15 | |||
16 | src/gallium/auxiliary/gallivm/lp_bld_misc.cpp | 12 +++++++++--- | ||
17 | 1 file changed, 9 insertions(+), 3 deletions(-) | ||
18 | |||
19 | diff --git a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp | ||
20 | index 2a388cb..0e4a531 100644 | ||
21 | --- a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp | ||
22 | +++ b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp | ||
23 | @@ -342,14 +342,20 @@ class DelegatingJITMemoryManager : public BaseMemoryManager { | ||
24 | virtual void registerEHFrames(uint8_t *Addr, uint64_t LoadAddr, size_t Size) { | ||
25 | mgr()->registerEHFrames(Addr, LoadAddr, Size); | ||
26 | } | ||
27 | - virtual void deregisterEHFrames(uint8_t *Addr, uint64_t LoadAddr, size_t Size) { | ||
28 | - mgr()->deregisterEHFrames(Addr, LoadAddr, Size); | ||
29 | - } | ||
30 | #else | ||
31 | virtual void registerEHFrames(llvm::StringRef SectionData) { | ||
32 | mgr()->registerEHFrames(SectionData); | ||
33 | } | ||
34 | #endif | ||
35 | +#if HAVE_LLVM >= 0x0500 | ||
36 | + virtual void deregisterEHFrames() { | ||
37 | + mgr()->deregisterEHFrames(); | ||
38 | + } | ||
39 | +#elif HAVE_LLVM >= 0x0304 | ||
40 | + virtual void deregisterEHFrames(uint8_t *Addr, uint64_t LoadAddr, size_t Size) { | ||
41 | + mgr()->deregisterEHFrames(Addr, LoadAddr, Size); | ||
42 | + } | ||
43 | +#endif | ||
44 | virtual void *getPointerToNamedFunction(const std::string &Name, | ||
45 | bool AbortOnFailure=true) { | ||
46 | return mgr()->getPointerToNamedFunction(Name, AbortOnFailure); | ||
47 | -- | ||
48 | 2.13.3 | ||
49 | |||
diff --git a/meta/recipes-graphics/mesa/files/llvm-config-version.patch b/meta/recipes-graphics/mesa/files/llvm-config-version.patch new file mode 100644 index 0000000000..aa33a1e915 --- /dev/null +++ b/meta/recipes-graphics/mesa/files/llvm-config-version.patch | |||
@@ -0,0 +1,32 @@ | |||
1 | When building llvm from git or svn it embeds the svn/git revision into internal version string | ||
2 | |||
3 | $ /mnt/a/oe/build/tmp/work/corei7-64-bec-linux/mesa/2_17.1.5-r0/recipe-sysroot/usr/lib/llvm5.0/llvm-config-host --version | ||
4 | 5.0.0git-9a5c333388c | ||
5 | |||
6 | We need to ignore everything after 5.0.0 which is what the cut cmd is doing | ||
7 | |||
8 | Upstream-Status: Pending | ||
9 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
10 | |||
11 | Index: mesa-17.1.5/configure.ac | ||
12 | =================================================================== | ||
13 | --- mesa-17.1.5.orig/configure.ac | ||
14 | +++ mesa-17.1.5/configure.ac | ||
15 | @@ -967,7 +967,7 @@ strip_unwanted_llvm_flags() { | ||
16 | |||
17 | llvm_set_environment_variables() { | ||
18 | if test "x$LLVM_CONFIG" != xno; then | ||
19 | - LLVM_VERSION=`$LLVM_CONFIG --version | egrep -o '^[[0-9.]]+'` | ||
20 | + LLVM_VERSION=`$LLVM_CONFIG --version | cut -c1-5` | ||
21 | LLVM_CPPFLAGS=`strip_unwanted_llvm_flags "$LLVM_CONFIG --cppflags"` | ||
22 | LLVM_INCLUDEDIR=`$LLVM_CONFIG --includedir` | ||
23 | LLVM_LIBDIR=`$LLVM_CONFIG --libdir` | ||
24 | @@ -2560,7 +2560,7 @@ if test "x$enable_llvm" = xyes; then | ||
25 | dnl (See https://llvm.org/bugs/show_bug.cgi?id=6823) | ||
26 | if test "x$enable_llvm_shared_libs" = xyes; then | ||
27 | dnl We can't use $LLVM_VERSION because it has 'svn' stripped out, | ||
28 | - LLVM_SO_NAME=LLVM-`$LLVM_CONFIG --version` | ||
29 | + LLVM_SO_NAME=LLVM-`$LLVM_CONFIG --version|cut -c1-5` | ||
30 | AS_IF([test -f "$LLVM_LIBDIR/lib$LLVM_SO_NAME.$IMP_LIB_EXT"], [llvm_have_one_so=yes]) | ||
31 | |||
32 | if test "x$llvm_have_one_so" = xyes; then | ||
diff --git a/meta/recipes-graphics/mesa/mesa.inc b/meta/recipes-graphics/mesa/mesa.inc index 1b712a24ea..3b42fa9fe8 100644 --- a/meta/recipes-graphics/mesa/mesa.inc +++ b/meta/recipes-graphics/mesa/mesa.inc | |||
@@ -25,8 +25,11 @@ REQUIRED_DISTRO_FEATURES = "opengl" | |||
25 | PLATFORMS ??= "${@bb.utils.filter('PACKAGECONFIG', 'x11 wayland', d)} \ | 25 | PLATFORMS ??= "${@bb.utils.filter('PACKAGECONFIG', 'x11 wayland', d)} \ |
26 | ${@bb.utils.contains('PACKAGECONFIG', 'gbm', 'drm', '', d)}" | 26 | ${@bb.utils.contains('PACKAGECONFIG', 'gbm', 'drm', '', d)}" |
27 | 27 | ||
28 | export LLVM_CONFIG = "${STAGING_LIBDIR}/llvm${MESA_LLVM_RELEASE}/llvm-config-host" | ||
29 | |||
28 | EXTRA_OECONF = "--enable-shared-glapi \ | 30 | EXTRA_OECONF = "--enable-shared-glapi \ |
29 | --with-llvm-prefix=${STAGING_BINDIR_NATIVE} \ | 31 | --disable-opencl \ |
32 | --with-llvm-prefix=${STAGING_LIBDIR}/llvm${MESA_LLVM_RELEASE} \ | ||
30 | --with-platforms='${PLATFORMS}'" | 33 | --with-platforms='${PLATFORMS}'" |
31 | 34 | ||
32 | PACKAGECONFIG ??= "gbm egl gles dri \ | 35 | PACKAGECONFIG ??= "gbm egl gles dri \ |
@@ -68,7 +71,7 @@ GALLIUMDRIVERS_append_x86 = "${@bb.utils.contains('PACKAGECONFIG', 'gallium-llvm | |||
68 | GALLIUMDRIVERS_append_x86-64 = "${@bb.utils.contains('PACKAGECONFIG', 'gallium-llvm', ',${GALLIUMDRIVERS_LLVM}', '', d)}" | 71 | GALLIUMDRIVERS_append_x86-64 = "${@bb.utils.contains('PACKAGECONFIG', 'gallium-llvm', ',${GALLIUMDRIVERS_LLVM}', '', d)}" |
69 | # keep --with-gallium-drivers separate, because when only one of gallium versions is enabled, other 2 were adding --without-gallium-drivers | 72 | # keep --with-gallium-drivers separate, because when only one of gallium versions is enabled, other 2 were adding --without-gallium-drivers |
70 | PACKAGECONFIG[gallium] = "--enable-texture-float --with-gallium-drivers=${GALLIUMDRIVERS}, --without-gallium-drivers" | 73 | PACKAGECONFIG[gallium] = "--enable-texture-float --with-gallium-drivers=${GALLIUMDRIVERS}, --without-gallium-drivers" |
71 | MESA_LLVM_RELEASE ?= "3.3" | 74 | MESA_LLVM_RELEASE ?= "5.0" |
72 | PACKAGECONFIG[gallium-llvm] = "--enable-llvm --enable-llvm-shared-libs, --disable-llvm, llvm${MESA_LLVM_RELEASE} \ | 75 | PACKAGECONFIG[gallium-llvm] = "--enable-llvm --enable-llvm-shared-libs, --disable-llvm, llvm${MESA_LLVM_RELEASE} \ |
73 | ${@'elfutils' if ${GALLIUMDRIVERS_LLVM33_ENABLED} else ''}" | 76 | ${@'elfutils' if ${GALLIUMDRIVERS_LLVM33_ENABLED} else ''}" |
74 | export WANT_LLVM_RELEASE = "${MESA_LLVM_RELEASE}" | 77 | export WANT_LLVM_RELEASE = "${MESA_LLVM_RELEASE}" |
diff --git a/meta/recipes-graphics/mesa/mesa_17.1.5.bb b/meta/recipes-graphics/mesa/mesa_17.1.5.bb index ddfcb371ec..36b0377453 100644 --- a/meta/recipes-graphics/mesa/mesa_17.1.5.bb +++ b/meta/recipes-graphics/mesa/mesa_17.1.5.bb | |||
@@ -7,6 +7,9 @@ SRC_URI = "https://mesa.freedesktop.org/archive/mesa-${PV}.tar.xz \ | |||
7 | file://0002-hardware-gloat.patch \ | 7 | file://0002-hardware-gloat.patch \ |
8 | file://0001-mapi-Only-install-khrplatform.h-with-EGL-or-GLES.patch \ | 8 | file://0001-mapi-Only-install-khrplatform.h-with-EGL-or-GLES.patch \ |
9 | file://vulkan-mkdir.patch \ | 9 | file://vulkan-mkdir.patch \ |
10 | file://llvm-config-version.patch \ | ||
11 | file://0001-ac-fix-build-after-LLVM-5.0-SVN-r300718.patch \ | ||
12 | file://0002-gallivm-Fix-build-against-LLVM-SVN-r302589.patch \ | ||
10 | " | 13 | " |
11 | SRC_URI[md5sum] = "6cf936fbcaadd98924298a7009e8265d" | 14 | SRC_URI[md5sum] = "6cf936fbcaadd98924298a7009e8265d" |
12 | SRC_URI[sha256sum] = "378516b171712687aace4c7ea8b37c85895231d7a6d61e1e27362cf6034fded9" | 15 | SRC_URI[sha256sum] = "378516b171712687aace4c7ea8b37c85895231d7a6d61e1e27362cf6034fded9" |