From 92e0da74f36e6cc4e9b37c0a5976888afcab8ca1 Mon Sep 17 00:00:00 2001 From: Florian Wühr Date: Tue, 30 Aug 2022 16:10:43 +0200 Subject: Fix mesa build with newer clang (port fixes from mesa) --- .../0001-gallium-add-missing-header-for-powf.patch | 41 ++++++++++++++++++++++ ...move-unused-header-include-for-newer-LLVM.patch | 33 +++++++++++++++++ .../mesa/0001-gallivm-add-InstSimplify-pass.patch | 29 +++++++++++++++ ...to-LLVMAddConstantPropagationPass-removal.patch | 31 ++++++++++++++++ recipes-graphics/mesa/mesa_%.bbappend | 8 +++++ 5 files changed, 142 insertions(+) create mode 100644 recipes-graphics/mesa/mesa/0001-gallium-add-missing-header-for-powf.patch create mode 100644 recipes-graphics/mesa/mesa/0001-gallium-gallivm-remove-unused-header-include-for-newer-LLVM.patch create mode 100644 recipes-graphics/mesa/mesa/0001-gallivm-add-InstSimplify-pass.patch create mode 100644 recipes-graphics/mesa/mesa/0001-gallivm-fix-build-on-llvm-12-due-to-LLVMAddConstantPropagationPass-removal.patch diff --git a/recipes-graphics/mesa/mesa/0001-gallium-add-missing-header-for-powf.patch b/recipes-graphics/mesa/mesa/0001-gallium-add-missing-header-for-powf.patch new file mode 100644 index 0000000..851ec39 --- /dev/null +++ b/recipes-graphics/mesa/mesa/0001-gallium-add-missing-header-for-powf.patch @@ -0,0 +1,41 @@ +From ff8daa013621019f1606dc0c188b16f1ce34fea7 Mon Sep 17 00:00:00 2001 +From: Vinson Lee +Date: Mon, 6 Apr 2020 18:21:54 -0700 +Subject: gallivm: Add missing header for powf. +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Fix build error after llvm-11 commit 3a29393b4709 ("Remove +math.h/cmath include from DataTypes.h"). + +src/gallium/auxiliary/gallivm/lp_bld_format_srgb.c: In function ‘lp_build_linear_to_srgb’: +src/gallium/auxiliary/gallivm/lp_bld_format_srgb.c:194:44: error: implicit declaration of function ‘powf’ [-Werror=implicit-function-declaration] + 194 | exp2f_c * powf(coeff_f, 1.0f / exp_f)); + | ^~~~ +src/gallium/auxiliary/gallivm/lp_bld_format_srgb.c:194:44: warning: incompatible implicit declaration of built-in function ‘powf’ +src/gallium/auxiliary/gallivm/lp_bld_format_srgb.c:78:1: note: include ‘’ or provide a declaration of ‘powf’ + 77 | #include "lp_bld_format.h" + +++ |+#include + 78 | + +Signed-off-by: Vinson Lee +Reviewed-by: Roland Scheidegger +Part-of: +--- + src/gallium/auxiliary/gallivm/lp_bld_format_srgb.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/src/gallium/auxiliary/gallivm/lp_bld_format_srgb.c b/src/gallium/auxiliary/gallivm/lp_bld_format_srgb.c +index d5cf698b060..5cd6ebe7149 100644 +--- a/src/gallium/auxiliary/gallivm/lp_bld_format_srgb.c ++++ b/src/gallium/auxiliary/gallivm/lp_bld_format_srgb.c +@@ -68,6 +68,7 @@ + + + #include "util/u_debug.h" ++#include "util/u_math.h" + + #include "lp_bld_type.h" + #include "lp_bld_const.h" +-- diff --git a/recipes-graphics/mesa/mesa/0001-gallium-gallivm-remove-unused-header-include-for-newer-LLVM.patch b/recipes-graphics/mesa/mesa/0001-gallium-gallivm-remove-unused-header-include-for-newer-LLVM.patch new file mode 100644 index 0000000..2347182 --- /dev/null +++ b/recipes-graphics/mesa/mesa/0001-gallium-gallivm-remove-unused-header-include-for-newer-LLVM.patch @@ -0,0 +1,33 @@ +From 52aa730d07618513d6c055618069b2f4680974cc Mon Sep 17 00:00:00 2001 +From: Jan Zielinski +Date: Mon, 27 Apr 2020 13:34:59 +0200 +Subject: [PATCH] gallium/gallivm: remove unused header include for newer LLVM + +In the top of the trunk LLVM (11) llvm/IR/CallSite.h header +has been removed. The file compiles without this include also +for LLVM 8, but I'm not sure about 9, 10, and older versions +so I disable it only for the latest LLVM + +Reviewed-by: Roland Scheidegger +Part-of: +--- + src/gallium/auxiliary/gallivm/lp_bld_misc.cpp | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp +index 40cc96824f3e..df7196190c5e 100644 +--- a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp ++++ b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp +@@ -65,7 +65,9 @@ + + #include + ++#if LLVM_VERSION_MAJOR < 11 + #include ++#endif + #include + #include + #include +-- +GitLab + diff --git a/recipes-graphics/mesa/mesa/0001-gallivm-add-InstSimplify-pass.patch b/recipes-graphics/mesa/mesa/0001-gallivm-add-InstSimplify-pass.patch new file mode 100644 index 0000000..8846bf3 --- /dev/null +++ b/recipes-graphics/mesa/mesa/0001-gallivm-add-InstSimplify-pass.patch @@ -0,0 +1,29 @@ +From 1d018bc7fde744b5fc71108887a51e5bfaff8776 Mon Sep 17 00:00:00 2001 +From: Roland Scheidegger +Date: Wed, 2 Sep 2020 04:04:50 +0200 +Subject: [PATCH] gallivm: add InstSimplify pass + +This is the recommended replacement for the removed ConstantPropagation +pass, and llvm now added c binding for it. + +Part-of: +--- + src/gallium/auxiliary/gallivm/lp_bld_init.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/src/gallium/auxiliary/gallivm/lp_bld_init.c b/src/gallium/auxiliary/gallivm/lp_bld_init.c +index 1eb4892a4a6c..fe3ef4a48df5 100644 +--- a/src/gallium/auxiliary/gallivm/lp_bld_init.c ++++ b/src/gallium/auxiliary/gallivm/lp_bld_init.c +@@ -171,6 +171,8 @@ create_pass_manager(struct gallivm_state *gallivm) + LLVMAddPromoteMemoryToRegisterPass(gallivm->passmgr); + #if LLVM_VERSION_MAJOR <= 11 + LLVMAddConstantPropagationPass(gallivm->passmgr); ++#else ++ LLVMAddInstructionSimplifyPass(gallivm->passmgr); + #endif + LLVMAddInstructionCombiningPass(gallivm->passmgr); + LLVMAddGVNPass(gallivm->passmgr); +-- +GitLab + diff --git a/recipes-graphics/mesa/mesa/0001-gallivm-fix-build-on-llvm-12-due-to-LLVMAddConstantPropagationPass-removal.patch b/recipes-graphics/mesa/mesa/0001-gallivm-fix-build-on-llvm-12-due-to-LLVMAddConstantPropagationPass-removal.patch new file mode 100644 index 0000000..0c7004c --- /dev/null +++ b/recipes-graphics/mesa/mesa/0001-gallivm-fix-build-on-llvm-12-due-to-LLVMAddConstantPropagationPass-removal.patch @@ -0,0 +1,31 @@ +From 52cac068621a5998f486f8e44f9c2d9d045d1c31 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Marek=20Ol=C5=A1=C3=A1k?= +Date: Mon, 31 Aug 2020 21:59:39 -0400 +Subject: [PATCH] gallivm: fix build on LLVM 12 due to + LLVMAddConstantPropagationPass removal + +Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/3465 +Cc: 20.1 20.2 +Reviewed-by: Dave Airlie +Part-of: +--- + src/gallium/auxiliary/gallivm/lp_bld_init.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/src/gallium/auxiliary/gallivm/lp_bld_init.c b/src/gallium/auxiliary/gallivm/lp_bld_init.c +index 6ebc9ebf25a3..1eb4892a4a6c 100644 +--- a/src/gallium/auxiliary/gallivm/lp_bld_init.c ++++ b/src/gallium/auxiliary/gallivm/lp_bld_init.c +@@ -169,7 +169,9 @@ create_pass_manager(struct gallivm_state *gallivm) + */ + LLVMAddReassociatePass(gallivm->passmgr); + LLVMAddPromoteMemoryToRegisterPass(gallivm->passmgr); ++#if LLVM_VERSION_MAJOR <= 11 + LLVMAddConstantPropagationPass(gallivm->passmgr); ++#endif + LLVMAddInstructionCombiningPass(gallivm->passmgr); + LLVMAddGVNPass(gallivm->passmgr); + } +-- +GitLab + diff --git a/recipes-graphics/mesa/mesa_%.bbappend b/recipes-graphics/mesa/mesa_%.bbappend index ddf5305..8af7a0e 100644 --- a/recipes-graphics/mesa/mesa_%.bbappend +++ b/recipes-graphics/mesa/mesa_%.bbappend @@ -6,4 +6,12 @@ EXTRA_OEMASON_append_toolchain-clang_x86-64 = " -Dasm=false" export YOCTO_ALTERNATE_EXE_PATH = "${STAGING_LIBDIR}/llvm-config" +FILESEXTRAPATHS_prepend := "${THISDIR}/${BPN}:" + +SRC_URI += "file://0001-gallium-add-missing-header-for-powf.patch \ + file://0001-gallivm-fix-build-on-llvm-12-due-to-LLVMAddConstantPropagationPass-removal.patch \ + file://0001-gallivm-add-InstSimplify-pass.patch \ + file://0001-gallium-gallivm-remove-unused-header-include-for-newer-LLVM.patch \ + " + PACKAGECONFIG[gallium-llvm] = "-Dllvm=true -Dshared-llvm=true, -Dllvm=false, clang clang-native elfutils" -- cgit v1.2.3-54-g00ecf