summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>2025-04-18 03:57:14 +0300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2025-04-23 09:47:42 +0100
commit88ebbd6b993577d1d0b203663bdcbd9c4f4987d9 (patch)
treeede2eb8982a8d1bdb5ae220ede02122629f119fa
parentb269fbd5b936d018e8e35c3b1d8ec40ff041caa5 (diff)
downloadpoky-88ebbd6b993577d1d0b203663bdcbd9c4f4987d9.tar.gz
mesa: bundle Clang OpenCL headers into meta-clc
Add a patch bundling OpenCL headers into meta-clc. This removes extra runtime dependencies when runnign meta-clc compiler. (From OE-Core rev: 8a627d93a6a37382c75ca45f5afb9fec069877f8) Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/recipes-graphics/mesa/files/0001-mesa-clc-add-an-option-to-force-inclusion-of-OpenCL-.patch57
-rw-r--r--meta/recipes-graphics/mesa/mesa.inc3
2 files changed, 59 insertions, 1 deletions
diff --git a/meta/recipes-graphics/mesa/files/0001-mesa-clc-add-an-option-to-force-inclusion-of-OpenCL-.patch b/meta/recipes-graphics/mesa/files/0001-mesa-clc-add-an-option-to-force-inclusion-of-OpenCL-.patch
new file mode 100644
index 0000000000..d65ba574d2
--- /dev/null
+++ b/meta/recipes-graphics/mesa/files/0001-mesa-clc-add-an-option-to-force-inclusion-of-OpenCL-.patch
@@ -0,0 +1,57 @@
1From f9b6175e7c446a82c568ff1a214885d707c95f49 Mon Sep 17 00:00:00 2001
2From: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
3Date: Wed, 16 Apr 2025 14:35:37 +0300
4Subject: [PATCH] mesa-clc: add an option to force inclusion of OpenCL headers
5
6Currently mesa-clc bundles OpenCL headers from Clang only if the static
7LLVM is used (which means Clang / LLVM are not present on the target
8system). In some cases (e.g. when building in OpenEmbedded environemnt)
9it is desirable to have shared LLVM library, but skip installing the
10whole Clang runtime just to compile shaders. Add an option that forces
11OpenCL headers to be bundled with the mesa-clc binary.
12
13Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
14Upstream-Status: Submitted [https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34551]
15---
16 meson_options.txt | 10 ++++++++++
17 src/compiler/clc/meson.build | 3 ++-
18 2 files changed, 12 insertions(+), 1 deletion(-)
19
20diff --git a/meson_options.txt b/meson_options.txt
21index 18da31eff507..addd274ecef7 100644
22--- a/meson_options.txt
23+++ b/meson_options.txt
24@@ -797,6 +797,16 @@ option(
25 description : 'Install the mesa-clc compiler (if needed for cross builds).'
26 )
27
28+option(
29+ 'mesa-clc-bundle-headers',
30+ type : 'combo',
31+ value : 'auto',
32+ choices : [
33+ 'enabled', 'auto'
34+ ],
35+ description : 'Bundle the OpenCL headers into the mesa-clc binary (default to bundle if static LLVM is used). Note, it might require rebuilding mesa-clc if opencl-c.h or opencl-c-base.h are changed (e.g. on Clang upgrades).'
36+)
37+
38 option(
39 'precomp-compiler',
40 type : 'combo',
41diff --git a/src/compiler/clc/meson.build b/src/compiler/clc/meson.build
42index 263eba527191..9ff61440f0da 100644
43--- a/src/compiler/clc/meson.build
44+++ b/src/compiler/clc/meson.build
45@@ -11,7 +11,8 @@ _libmesaclc_c_args = []
46 _libmesaclc_cpp_args = ['-DLLVM_LIB_DIR="@0@"'.format(llvm_libdir)]
47 _libmesaclc_sources = []
48
49-if not _shared_llvm
50+if not _shared_llvm or \
51+ get_option('mesa-clc-bundle-headers') == 'enabled'
52 # LLVM 16 moved clang header path from using full version to only major version
53 if dep_llvm.version().version_compare('< 16')
54 # Prior to LLVM 16, this path used a full version
55--
562.47.2
57
diff --git a/meta/recipes-graphics/mesa/mesa.inc b/meta/recipes-graphics/mesa/mesa.inc
index 2feaa70093..cd0f02c6d7 100644
--- a/meta/recipes-graphics/mesa/mesa.inc
+++ b/meta/recipes-graphics/mesa/mesa.inc
@@ -18,6 +18,7 @@ SRC_URI = "https://archive.mesa3d.org/mesa-${PV}.tar.xz \
18 file://0001-meson-misdetects-64bit-atomics-on-mips-clang.patch \ 18 file://0001-meson-misdetects-64bit-atomics-on-mips-clang.patch \
19 file://0001-meson-disable-SIMD-blake-optimisations-on-x32-host.patch \ 19 file://0001-meson-disable-SIMD-blake-optimisations-on-x32-host.patch \
20 file://0001-freedreno-don-t-encode-build-path-into-binaries.patch\ 20 file://0001-freedreno-don-t-encode-build-path-into-binaries.patch\
21 file://0001-mesa-clc-add-an-option-to-force-inclusion-of-OpenCL-.patch \
21" 22"
22 23
23SRC_URI[sha256sum] = "adf904d083b308df95898600ffed435f4b5c600d95fb6ec6d4c45638627fdc97" 24SRC_URI[sha256sum] = "adf904d083b308df95898600ffed435f4b5c600d95fb6ec6d4c45638627fdc97"
@@ -194,7 +195,7 @@ MESA_NATIVE:class-native = ""
194 195
195PACKAGECONFIG[gallium] = "-Dgallium-drivers=${@strip_comma('${GALLIUMDRIVERS}')}, -Dgallium-drivers='', libdrm" 196PACKAGECONFIG[gallium] = "-Dgallium-drivers=${@strip_comma('${GALLIUMDRIVERS}')}, -Dgallium-drivers='', libdrm"
196PACKAGECONFIG[gallium-llvm] = "-Dllvm=enabled -Dshared-llvm=enabled, -Dllvm=disabled, llvm llvm-native elfutils" 197PACKAGECONFIG[gallium-llvm] = "-Dllvm=enabled -Dshared-llvm=enabled, -Dllvm=disabled, llvm llvm-native elfutils"
197PACKAGECONFIG[libclc] = "-Dmesa-clc=${MESA_CLC} -Dinstall-mesa-clc=${INSTALL_MESA_CLC},,libclc spirv-tools spirv-llvm-translator ${MESA_NATIVE}" 198PACKAGECONFIG[libclc] = "-Dmesa-clc=${MESA_CLC} -Dinstall-mesa-clc=${INSTALL_MESA_CLC} -Dmesa-clc-bundle-headers=enabled,,libclc spirv-tools spirv-llvm-translator ${MESA_NATIVE}"
198PACKAGECONFIG[xa] = "-Dgallium-xa=enabled, -Dgallium-xa=disabled" 199PACKAGECONFIG[xa] = "-Dgallium-xa=enabled, -Dgallium-xa=disabled"
199PACKAGECONFIG[va] = "-Dgallium-va=enabled,-Dgallium-va=disabled,libva-initial" 200PACKAGECONFIG[va] = "-Dgallium-va=enabled,-Dgallium-va=disabled,libva-initial"
200PACKAGECONFIG[vdpau] = "-Dgallium-vdpau=enabled,-Dgallium-vdpau=disabled,libvdpau" 201PACKAGECONFIG[vdpau] = "-Dgallium-vdpau=enabled,-Dgallium-vdpau=disabled,libvdpau"