mirror of
https://git.yoctoproject.org/poky
synced 2026-04-30 12:32:12 +02:00
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>
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
From 9861437e58fdd0de01193a102608d34e5952953f Mon Sep 17 00:00:00 2001
|
||||
From: Christoph Haag <haagch+mesadev@frickel.club>
|
||||
Date: Thu, 20 Apr 2017 10:34:18 +0200
|
||||
Subject: [PATCH 1/2] ac: fix build after LLVM 5.0 SVN r300718
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
v2: previously getWithDereferenceableBytes() exists, but addAttr() doesn't take that type
|
||||
|
||||
Signed-off-by: Christoph Haag <haagch+mesadev@frickel.club>
|
||||
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
|
||||
Tested-and-reviewed-by: Mike Lothian <mike@fireburn.co.uk>
|
||||
---
|
||||
Upstream-Status: Backport
|
||||
|
||||
src/amd/common/ac_llvm_helper.cpp | 4 ++++
|
||||
1 file changed, 4 insertions(+)
|
||||
|
||||
diff --git a/src/amd/common/ac_llvm_helper.cpp b/src/amd/common/ac_llvm_helper.cpp
|
||||
index d9ea4b1..11fa809 100644
|
||||
--- a/src/amd/common/ac_llvm_helper.cpp
|
||||
+++ b/src/amd/common/ac_llvm_helper.cpp
|
||||
@@ -44,9 +44,13 @@ typedef AttributeSet AttributeList;
|
||||
void ac_add_attr_dereferenceable(LLVMValueRef val, uint64_t bytes)
|
||||
{
|
||||
llvm::Argument *A = llvm::unwrap<llvm::Argument>(val);
|
||||
+#if HAVE_LLVM < 0x0500
|
||||
llvm::AttrBuilder B;
|
||||
B.addDereferenceableAttr(bytes);
|
||||
A->addAttr(llvm::AttributeList::get(A->getContext(), A->getArgNo() + 1, B));
|
||||
+#else
|
||||
+ A->addAttr(llvm::Attribute::getWithDereferenceableBytes(A->getContext(), bytes));
|
||||
+#endif
|
||||
}
|
||||
|
||||
bool ac_is_sgpr_param(LLVMValueRef arg)
|
||||
--
|
||||
2.13.3
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
From a02a0dfda2712d30ad62b8f0421ec7b8244ba2cb Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Michel=20D=C3=A4nzer?= <michel.daenzer@amd.com>
|
||||
Date: Wed, 10 May 2017 17:26:07 +0900
|
||||
Subject: [PATCH 2/2] gallivm: Fix build against LLVM SVN >= r302589
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
deregisterEHFrames doesn't take any parameters anymore.
|
||||
|
||||
Reviewed-by: Vedran Miletić <vedran@miletic.net>
|
||||
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
|
||||
---
|
||||
Upstream-Status: Backport
|
||||
|
||||
src/gallium/auxiliary/gallivm/lp_bld_misc.cpp | 12 +++++++++---
|
||||
1 file changed, 9 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
|
||||
index 2a388cb..0e4a531 100644
|
||||
--- a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
|
||||
+++ b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
|
||||
@@ -342,14 +342,20 @@ class DelegatingJITMemoryManager : public BaseMemoryManager {
|
||||
virtual void registerEHFrames(uint8_t *Addr, uint64_t LoadAddr, size_t Size) {
|
||||
mgr()->registerEHFrames(Addr, LoadAddr, Size);
|
||||
}
|
||||
- virtual void deregisterEHFrames(uint8_t *Addr, uint64_t LoadAddr, size_t Size) {
|
||||
- mgr()->deregisterEHFrames(Addr, LoadAddr, Size);
|
||||
- }
|
||||
#else
|
||||
virtual void registerEHFrames(llvm::StringRef SectionData) {
|
||||
mgr()->registerEHFrames(SectionData);
|
||||
}
|
||||
#endif
|
||||
+#if HAVE_LLVM >= 0x0500
|
||||
+ virtual void deregisterEHFrames() {
|
||||
+ mgr()->deregisterEHFrames();
|
||||
+ }
|
||||
+#elif HAVE_LLVM >= 0x0304
|
||||
+ virtual void deregisterEHFrames(uint8_t *Addr, uint64_t LoadAddr, size_t Size) {
|
||||
+ mgr()->deregisterEHFrames(Addr, LoadAddr, Size);
|
||||
+ }
|
||||
+#endif
|
||||
virtual void *getPointerToNamedFunction(const std::string &Name,
|
||||
bool AbortOnFailure=true) {
|
||||
return mgr()->getPointerToNamedFunction(Name, AbortOnFailure);
|
||||
--
|
||||
2.13.3
|
||||
|
||||
32
meta/recipes-graphics/mesa/files/llvm-config-version.patch
Normal file
32
meta/recipes-graphics/mesa/files/llvm-config-version.patch
Normal file
@@ -0,0 +1,32 @@
|
||||
When building llvm from git or svn it embeds the svn/git revision into internal version string
|
||||
|
||||
$ /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
|
||||
5.0.0git-9a5c333388c
|
||||
|
||||
We need to ignore everything after 5.0.0 which is what the cut cmd is doing
|
||||
|
||||
Upstream-Status: Pending
|
||||
Signed-off-by: Khem Raj <raj.khem@gmail.com>
|
||||
|
||||
Index: mesa-17.1.5/configure.ac
|
||||
===================================================================
|
||||
--- mesa-17.1.5.orig/configure.ac
|
||||
+++ mesa-17.1.5/configure.ac
|
||||
@@ -967,7 +967,7 @@ strip_unwanted_llvm_flags() {
|
||||
|
||||
llvm_set_environment_variables() {
|
||||
if test "x$LLVM_CONFIG" != xno; then
|
||||
- LLVM_VERSION=`$LLVM_CONFIG --version | egrep -o '^[[0-9.]]+'`
|
||||
+ LLVM_VERSION=`$LLVM_CONFIG --version | cut -c1-5`
|
||||
LLVM_CPPFLAGS=`strip_unwanted_llvm_flags "$LLVM_CONFIG --cppflags"`
|
||||
LLVM_INCLUDEDIR=`$LLVM_CONFIG --includedir`
|
||||
LLVM_LIBDIR=`$LLVM_CONFIG --libdir`
|
||||
@@ -2560,7 +2560,7 @@ if test "x$enable_llvm" = xyes; then
|
||||
dnl (See https://llvm.org/bugs/show_bug.cgi?id=6823)
|
||||
if test "x$enable_llvm_shared_libs" = xyes; then
|
||||
dnl We can't use $LLVM_VERSION because it has 'svn' stripped out,
|
||||
- LLVM_SO_NAME=LLVM-`$LLVM_CONFIG --version`
|
||||
+ LLVM_SO_NAME=LLVM-`$LLVM_CONFIG --version|cut -c1-5`
|
||||
AS_IF([test -f "$LLVM_LIBDIR/lib$LLVM_SO_NAME.$IMP_LIB_EXT"], [llvm_have_one_so=yes])
|
||||
|
||||
if test "x$llvm_have_one_so" = xyes; then
|
||||
@@ -25,8 +25,11 @@ REQUIRED_DISTRO_FEATURES = "opengl"
|
||||
PLATFORMS ??= "${@bb.utils.filter('PACKAGECONFIG', 'x11 wayland', d)} \
|
||||
${@bb.utils.contains('PACKAGECONFIG', 'gbm', 'drm', '', d)}"
|
||||
|
||||
export LLVM_CONFIG = "${STAGING_LIBDIR}/llvm${MESA_LLVM_RELEASE}/llvm-config-host"
|
||||
|
||||
EXTRA_OECONF = "--enable-shared-glapi \
|
||||
--with-llvm-prefix=${STAGING_BINDIR_NATIVE} \
|
||||
--disable-opencl \
|
||||
--with-llvm-prefix=${STAGING_LIBDIR}/llvm${MESA_LLVM_RELEASE} \
|
||||
--with-platforms='${PLATFORMS}'"
|
||||
|
||||
PACKAGECONFIG ??= "gbm egl gles dri \
|
||||
@@ -68,7 +71,7 @@ GALLIUMDRIVERS_append_x86 = "${@bb.utils.contains('PACKAGECONFIG', 'gallium-llvm
|
||||
GALLIUMDRIVERS_append_x86-64 = "${@bb.utils.contains('PACKAGECONFIG', 'gallium-llvm', ',${GALLIUMDRIVERS_LLVM}', '', d)}"
|
||||
# keep --with-gallium-drivers separate, because when only one of gallium versions is enabled, other 2 were adding --without-gallium-drivers
|
||||
PACKAGECONFIG[gallium] = "--enable-texture-float --with-gallium-drivers=${GALLIUMDRIVERS}, --without-gallium-drivers"
|
||||
MESA_LLVM_RELEASE ?= "3.3"
|
||||
MESA_LLVM_RELEASE ?= "5.0"
|
||||
PACKAGECONFIG[gallium-llvm] = "--enable-llvm --enable-llvm-shared-libs, --disable-llvm, llvm${MESA_LLVM_RELEASE} \
|
||||
${@'elfutils' if ${GALLIUMDRIVERS_LLVM33_ENABLED} else ''}"
|
||||
export WANT_LLVM_RELEASE = "${MESA_LLVM_RELEASE}"
|
||||
|
||||
@@ -7,6 +7,9 @@ SRC_URI = "https://mesa.freedesktop.org/archive/mesa-${PV}.tar.xz \
|
||||
file://0002-hardware-gloat.patch \
|
||||
file://0001-mapi-Only-install-khrplatform.h-with-EGL-or-GLES.patch \
|
||||
file://vulkan-mkdir.patch \
|
||||
file://llvm-config-version.patch \
|
||||
file://0001-ac-fix-build-after-LLVM-5.0-SVN-r300718.patch \
|
||||
file://0002-gallivm-Fix-build-against-LLVM-SVN-r302589.patch \
|
||||
"
|
||||
SRC_URI[md5sum] = "6cf936fbcaadd98924298a7009e8265d"
|
||||
SRC_URI[sha256sum] = "378516b171712687aace4c7ea8b37c85895231d7a6d61e1e27362cf6034fded9"
|
||||
|
||||
Reference in New Issue
Block a user