summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRyan Eatmon <reatmon@ti.com>2023-09-22 22:49:43 -0500
committerRyan Eatmon <reatmon@ti.com>2023-09-25 09:58:09 -0500
commit209e4e889833ec2299c8141fdbb72577ecde1a9b (patch)
tree0e9103d10937ffef735ec7136931dc31aa8b34a0
parentde4310f4ffa6afee7eb01924ddd6ec375dca0fde (diff)
downloadmeta-ti-209e4e889833ec2299c8141fdbb72577ecde1a9b.tar.gz
mesa-pvr: Patches for LLVM 17 support
There are a number of issues in gallium when moving to LLVM 17. These patches fix those compile issues. Signed-off-by: Ryan Eatmon <reatmon@ti.com>
-rw-r--r--meta-ti-bsp/recipes-graphics/mesa/files/0001-fix-gallivm-limit-usage-of-LLVMContextSetOpaquePoint.patch128
-rw-r--r--meta-ti-bsp/recipes-graphics/mesa/files/0001-gallium-Fix-build-with-llvm-17.patch58
-rw-r--r--meta-ti-bsp/recipes-graphics/mesa/mesa-pvr_22.3.5.bb2
3 files changed, 188 insertions, 0 deletions
diff --git a/meta-ti-bsp/recipes-graphics/mesa/files/0001-fix-gallivm-limit-usage-of-LLVMContextSetOpaquePoint.patch b/meta-ti-bsp/recipes-graphics/mesa/files/0001-fix-gallivm-limit-usage-of-LLVMContextSetOpaquePoint.patch
new file mode 100644
index 00000000..905fad04
--- /dev/null
+++ b/meta-ti-bsp/recipes-graphics/mesa/files/0001-fix-gallivm-limit-usage-of-LLVMContextSetOpaquePoint.patch
@@ -0,0 +1,128 @@
1From 1a894699354f5f984f31e5d3418b651edf486df9 Mon Sep 17 00:00:00 2001
2From: Ryan Eatmon <reatmon@ti.com>
3Date: Fri, 22 Sep 2023 22:32:41 -0500
4Subject: [PATCH] fix: gallivm: limit usage of LLVMContextSetOpaquePointers()
5 to LLVM 15
6
7LLVMContextSetOpaquePointers() was a temporary workaround offered to
8allow transitioning to opaque pointers. Mesa is ready for this now with
9recent versions of LLVM (16+). Therefore we limit the workaround of
10using LLVMContextSetOpaquePointers() to LLVM 15 now, that this C
11interface was removed in LLVM 17.
12
13Reference: https://github.com/llvm/llvm-project/commit/1270879376025457e266572c7cccc51eb5de9276
14
15Upstream-Status: Submitted [https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21124]
16Signed-off-by: Ryan Eatmon <reatmon@ti.com>
17---
18 src/gallium/auxiliary/draw/draw_llvm.c | 2 +-
19 src/gallium/drivers/llvmpipe/lp_context.c | 2 +-
20 src/gallium/drivers/llvmpipe/lp_test_arit.c | 2 +-
21 src/gallium/drivers/llvmpipe/lp_test_blend.c | 2 +-
22 src/gallium/drivers/llvmpipe/lp_test_conv.c | 2 +-
23 src/gallium/drivers/llvmpipe/lp_test_format.c | 4 ++--
24 src/gallium/drivers/llvmpipe/lp_test_printf.c | 2 +-
25 7 files changed, 8 insertions(+), 8 deletions(-)
26
27diff --git a/src/gallium/auxiliary/draw/draw_llvm.c b/src/gallium/auxiliary/draw/draw_llvm.c
28index 50c157bc3cc..8b3a1522725 100644
29--- a/src/gallium/auxiliary/draw/draw_llvm.c
30+++ b/src/gallium/auxiliary/draw/draw_llvm.c
31@@ -784,7 +784,7 @@ draw_llvm_create(struct draw_context *draw, LLVMContextRef context)
32 if (!llvm->context) {
33 llvm->context = LLVMContextCreate();
34
35-#if LLVM_VERSION_MAJOR >= 15
36+#if LLVM_VERSION_MAJOR == 15
37 LLVMContextSetOpaquePointers(llvm->context, false);
38 #endif
39
40diff --git a/src/gallium/drivers/llvmpipe/lp_context.c b/src/gallium/drivers/llvmpipe/lp_context.c
41index 8309335aebc..0ef4317fc76 100644
42--- a/src/gallium/drivers/llvmpipe/lp_context.c
43+++ b/src/gallium/drivers/llvmpipe/lp_context.c
44@@ -263,7 +263,7 @@ llvmpipe_create_context(struct pipe_screen *screen, void *priv,
45 if (!llvmpipe->context)
46 goto fail;
47
48-#if LLVM_VERSION_MAJOR >= 15
49+#if LLVM_VERSION_MAJOR == 15
50 LLVMContextSetOpaquePointers(llvmpipe->context, false);
51 #endif
52
53diff --git a/src/gallium/drivers/llvmpipe/lp_test_arit.c b/src/gallium/drivers/llvmpipe/lp_test_arit.c
54index 4118928d52e..565b1c47753 100644
55--- a/src/gallium/drivers/llvmpipe/lp_test_arit.c
56+++ b/src/gallium/drivers/llvmpipe/lp_test_arit.c
57@@ -434,7 +434,7 @@ test_unary(unsigned verbose, FILE *fp, const struct unary_test_t *test, unsigned
58 }
59
60 context = LLVMContextCreate();
61-#if LLVM_VERSION_MAJOR >= 15
62+#if LLVM_VERSION_MAJOR == 15
63 LLVMContextSetOpaquePointers(context, false);
64 #endif
65 gallivm = gallivm_create("test_module", context, NULL);
66diff --git a/src/gallium/drivers/llvmpipe/lp_test_blend.c b/src/gallium/drivers/llvmpipe/lp_test_blend.c
67index 37c3f731eaf..3d2899a78d4 100644
68--- a/src/gallium/drivers/llvmpipe/lp_test_blend.c
69+++ b/src/gallium/drivers/llvmpipe/lp_test_blend.c
70@@ -452,7 +452,7 @@ test_one(unsigned verbose,
71 dump_blend_type(stdout, blend, type);
72
73 context = LLVMContextCreate();
74-#if LLVM_VERSION_MAJOR >= 15
75+#if LLVM_VERSION_MAJOR == 15
76 LLVMContextSetOpaquePointers(context, false);
77 #endif
78 gallivm = gallivm_create("test_module", context, NULL);
79diff --git a/src/gallium/drivers/llvmpipe/lp_test_conv.c b/src/gallium/drivers/llvmpipe/lp_test_conv.c
80index c7ea9efc12d..83236f0c0ba 100644
81--- a/src/gallium/drivers/llvmpipe/lp_test_conv.c
82+++ b/src/gallium/drivers/llvmpipe/lp_test_conv.c
83@@ -223,7 +223,7 @@ test_one(unsigned verbose,
84 }
85
86 context = LLVMContextCreate();
87-#if LLVM_VERSION_MAJOR >= 15
88+#if LLVM_VERSION_MAJOR == 15
89 LLVMContextSetOpaquePointers(context, false);
90 #endif
91 gallivm = gallivm_create("test_module", context, NULL);
92diff --git a/src/gallium/drivers/llvmpipe/lp_test_format.c b/src/gallium/drivers/llvmpipe/lp_test_format.c
93index 0a2a1e449e8..89f7d5dec1a 100644
94--- a/src/gallium/drivers/llvmpipe/lp_test_format.c
95+++ b/src/gallium/drivers/llvmpipe/lp_test_format.c
96@@ -150,7 +150,7 @@ test_format_float(unsigned verbose, FILE *fp,
97 unsigned i, j, k, l;
98
99 context = LLVMContextCreate();
100-#if LLVM_VERSION_MAJOR >= 15
101+#if LLVM_VERSION_MAJOR == 15
102 LLVMContextSetOpaquePointers(context, false);
103 #endif
104 gallivm = gallivm_create("test_module_float", context, NULL);
105@@ -254,7 +254,7 @@ test_format_unorm8(unsigned verbose, FILE *fp,
106 unsigned i, j, k, l;
107
108 context = LLVMContextCreate();
109-#if LLVM_VERSION_MAJOR >= 15
110+#if LLVM_VERSION_MAJOR == 15
111 LLVMContextSetOpaquePointers(context, false);
112 #endif
113 gallivm = gallivm_create("test_module_unorm8", context, NULL);
114diff --git a/src/gallium/drivers/llvmpipe/lp_test_printf.c b/src/gallium/drivers/llvmpipe/lp_test_printf.c
115index b3de9cb9e8b..850c0abfe22 100644
116--- a/src/gallium/drivers/llvmpipe/lp_test_printf.c
117+++ b/src/gallium/drivers/llvmpipe/lp_test_printf.c
118@@ -96,7 +96,7 @@ test_printf(unsigned verbose, FILE *fp,
119 boolean success = TRUE;
120
121 context = LLVMContextCreate();
122-#if LLVM_VERSION_MAJOR >= 15
123+#if LLVM_VERSION_MAJOR == 15
124 LLVMContextSetOpaquePointers(context, false);
125 #endif
126 gallivm = gallivm_create("test_module", context, NULL);
127--
1282.17.1
diff --git a/meta-ti-bsp/recipes-graphics/mesa/files/0001-gallium-Fix-build-with-llvm-17.patch b/meta-ti-bsp/recipes-graphics/mesa/files/0001-gallium-Fix-build-with-llvm-17.patch
new file mode 100644
index 00000000..bdfe7bb8
--- /dev/null
+++ b/meta-ti-bsp/recipes-graphics/mesa/files/0001-gallium-Fix-build-with-llvm-17.patch
@@ -0,0 +1,58 @@
1From 2dfe0f899aeb415a5491b8c67e208673d2a2914f Mon Sep 17 00:00:00 2001
2From: Ryan Eatmon <reatmon@ti.com>
3Date: Fri, 22 Sep 2023 21:50:08 -0500
4Subject: [PATCH] gallium: Fix build with llvm 17
5
6These headers are not available for C files in llvm 17+
7and they seem to be not needed to compile after all with llvm 17
8so add conditions to exclude them for llvm >= 17
9
10Upstream-Status: Submitted [https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21262]
11Upstream-Status: Submitted [https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22980]
12Signed-off-by: Ryan Eatmon <reatmon@ti.com>
13---
14 src/gallium/auxiliary/gallivm/lp_bld_init.c | 8 ++++----
15 src/gallium/auxiliary/gallivm/lp_bld_misc.cpp | 4 ++++
16 2 files changed, 8 insertions(+), 4 deletions(-)
17
18diff --git a/src/gallium/auxiliary/gallivm/lp_bld_init.c b/src/gallium/auxiliary/gallivm/lp_bld_init.c
19index 584ea738668..fe8bb2b11af 100644
20--- a/src/gallium/auxiliary/gallivm/lp_bld_init.c
21+++ b/src/gallium/auxiliary/gallivm/lp_bld_init.c
22@@ -42,14 +42,14 @@
23
24 #include <llvm/Config/llvm-config.h>
25 #include <llvm-c/Analysis.h>
26-#include <llvm-c/Transforms/Scalar.h>
27-#if LLVM_VERSION_MAJOR >= 7
28-#include <llvm-c/Transforms/Utils.h>
29-#endif
30 #include <llvm-c/BitWriter.h>
31 #if GALLIVM_USE_NEW_PASS == 1
32 #include <llvm-c/Transforms/PassBuilder.h>
33 #elif GALLIVM_HAVE_CORO == 1
34+#include <llvm-c/Transforms/Scalar.h>
35+#if LLVM_VERSION_MAJOR >= 7
36+#include <llvm-c/Transforms/Utils.h>
37+#endif
38 #if LLVM_VERSION_MAJOR <= 8 && (defined(PIPE_ARCH_AARCH64) || defined (PIPE_ARCH_ARM) || defined(PIPE_ARCH_S390) || defined(PIPE_ARCH_MIPS64))
39 #include <llvm-c/Transforms/IPO.h>
40 #endif
41diff --git a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
42index 2279e5acb28..0caeaf94263 100644
43--- a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
44+++ b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
45@@ -56,7 +56,11 @@
46 #include <llvm-c/ExecutionEngine.h>
47 #include <llvm/Target/TargetOptions.h>
48 #include <llvm/ExecutionEngine/ExecutionEngine.h>
49+#if LLVM_VERSION_MAJOR >= 17
50+#include <llvm/TargetParser/Triple.h>
51+#else
52 #include <llvm/ADT/Triple.h>
53+#endif
54 #include <llvm/Analysis/TargetLibraryInfo.h>
55 #include <llvm/ExecutionEngine/SectionMemoryManager.h>
56 #include <llvm/Support/CommandLine.h>
57--
582.17.1
diff --git a/meta-ti-bsp/recipes-graphics/mesa/mesa-pvr_22.3.5.bb b/meta-ti-bsp/recipes-graphics/mesa/mesa-pvr_22.3.5.bb
index 0de3cb94..281d6a21 100644
--- a/meta-ti-bsp/recipes-graphics/mesa/mesa-pvr_22.3.5.bb
+++ b/meta-ti-bsp/recipes-graphics/mesa/mesa-pvr_22.3.5.bb
@@ -17,6 +17,8 @@ SRC_URI = " \
17 file://0001-util-format-Check-for-NEON-before-using-it.patch \ 17 file://0001-util-format-Check-for-NEON-before-using-it.patch \
18 file://0001-gbm-backend-fix-gbm-compile-without-dri.patch \ 18 file://0001-gbm-backend-fix-gbm-compile-without-dri.patch \
19 file://0001-freedreno-pm4-Use-unsigned-instead-of-uint-to-fix-mu.patch \ 19 file://0001-freedreno-pm4-Use-unsigned-instead-of-uint-to-fix-mu.patch \
20 file://0001-gallium-Fix-build-with-llvm-17.patch \
21 file://0001-fix-gallivm-limit-usage-of-LLVMContextSetOpaquePoint.patch \
20" 22"
21 23
22S = "${WORKDIR}/git" 24S = "${WORKDIR}/git"