summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZoltán Böszörményi <zboszor@gmail.com>2025-04-10 05:54:51 +0300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2025-04-11 11:44:22 +0100
commitd4ca7bede803d0feaad486e47c04495d2d3b45df (patch)
tree94ca05c76bdb10c179d888e89879b31cbfcc8bbd
parent3db74e28184a975a5d76efe1ee618e3b674e4cd3 (diff)
downloadpoky-d4ca7bede803d0feaad486e47c04495d2d3b45df.tar.gz
mesa: add support for RustiCL under PACKAGECONFIG "opencl"
Mesa now has two OpenCL implementations: Clover (older one) and RustiCL (newer one). Extend the "opencl" package config to include both implementations into the libopencl-mesa (-dev) packages. As the Clover implementation is in maintenance mode and is expected to be removed at Mesa 25.2, it doesn't make sense to split the packages or to provide two config options. (From OE-Core rev: d76672d674b1e354ad774b8cef2d8b6cd4c9f400) Signed-off-by: Zoltán Böszörményi <zboszor@gmail.com> [DB: merged "rusticl" and "clover" back to "opencl", reworked rust inheritance] 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-rusticl-provide-cross-compilation-arguments-to-LLVM-.patch67
-rw-r--r--meta/recipes-graphics/mesa/mesa.inc21
2 files changed, 83 insertions, 5 deletions
diff --git a/meta/recipes-graphics/mesa/files/0001-rusticl-provide-cross-compilation-arguments-to-LLVM-.patch b/meta/recipes-graphics/mesa/files/0001-rusticl-provide-cross-compilation-arguments-to-LLVM-.patch
new file mode 100644
index 0000000000..d527b34087
--- /dev/null
+++ b/meta/recipes-graphics/mesa/files/0001-rusticl-provide-cross-compilation-arguments-to-LLVM-.patch
@@ -0,0 +1,67 @@
1From b9cf34f39ca7e7546508ce2ab1f053edef5fc201 Mon Sep 17 00:00:00 2001
2From: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
3Date: Wed, 26 Mar 2025 17:47:09 +0200
4Subject: [PATCH] rusticl: provide cross-compilation arguments to LLVM bindgen
5 invocation
6
7Correctly generating LLVM bindings requires several croos-compilation
8arguments. Provide them to rust.bindgen(). Karol Herbst on IRC suggested
9that a proper fix should be to fix meson's rust.bindgen() to support
10cross-compilation. Carry this patch until meson is fixed.
11
12Upstream-Status: Inappropriate [OE-Specific]
13Link: https://github.com/mesonbuild/meson/issues/13591
14Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
15---
16 meson_options.txt | 14 ++++++++++++++
17 src/gallium/frontends/rusticl/meson.build | 8 ++++++++
18 2 files changed, 22 insertions(+)
19
20diff --git a/meson_options.txt b/meson_options.txt
21index 0147cafcb146..f73e83fded18 100644
22--- a/meson_options.txt
23+++ b/meson_options.txt
24@@ -796,3 +796,17 @@ option(
25 value : false,
26 description : 'Install the drivers internal shader compilers (if needed for cross builds).'
27 )
28+
29+option(
30+ 'bindgen-includedir',
31+ type : 'string',
32+ value : '',
33+ description : 'system-wide include directory for cross-generating LLVM bindings'
34+ )
35+
36+option(
37+ 'bindgen-target',
38+ type : 'string',
39+ value : '',
40+ description : 'Clang target for cross-generating LLVM bindings'
41+ )
42diff --git a/src/gallium/frontends/rusticl/meson.build b/src/gallium/frontends/rusticl/meson.build
43index a5d1dcf3abb9..480c220b7f5f 100644
44--- a/src/gallium/frontends/rusticl/meson.build
45+++ b/src/gallium/frontends/rusticl/meson.build
46@@ -115,6 +115,11 @@ rusticl_bindgen_c_args = [
47 '-fno-builtin-malloc',
48 ]
49
50+bindgen_target = get_option('bindgen-target')
51+if bindgen_target != ''
52+ rusticl_bindgen_c_args += [ '-target', bindgen_target ]
53+endif
54+
55 cl_c_args = [
56 '-DCL_USE_DEPRECATED_OPENCL_1_0_APIS',
57 '-DCL_USE_DEPRECATED_OPENCL_1_1_APIS',
58@@ -187,6 +192,9 @@ rusticl_llvm_bindings_rs = rust.bindgen(
59 rusticl_bindgen_c_args,
60 pre_args,
61 ],
62+ include_directories : [
63+ get_option('bindgen-includedir'),
64+ ],
65 dependencies : [
66 dep_clang,
67 dep_llvm,
diff --git a/meta/recipes-graphics/mesa/mesa.inc b/meta/recipes-graphics/mesa/mesa.inc
index 9edce6b228..aca34983e9 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-rusticl-provide-cross-compilation-arguments-to-LLVM-.patch \
21" 22"
22 23
23SRC_URI[sha256sum] = "adf904d083b308df95898600ffed435f4b5c600d95fb6ec6d4c45638627fdc97" 24SRC_URI[sha256sum] = "adf904d083b308df95898600ffed435f4b5c600d95fb6ec6d4c45638627fdc97"
@@ -46,7 +47,7 @@ PROVIDES = " \
46 virtual/mesa \ 47 virtual/mesa \
47 " 48 "
48 49
49inherit meson pkgconfig python3native gettext features_check 50inherit meson pkgconfig python3native gettext features_check rust
50 51
51BBCLASSEXTEND = "native nativesdk" 52BBCLASSEXTEND = "native nativesdk"
52 53
@@ -85,6 +86,9 @@ PACKAGECONFIG = " \
85 ${@bb.utils.contains('DISTRO_FEATURES', 'vulkan', 'zink', '', d)} \ 86 ${@bb.utils.contains('DISTRO_FEATURES', 'vulkan', 'zink', '', d)} \
86" 87"
87 88
89# skip all Rust dependencies if we are not building OpenCL"
90INHIBIT_DEFAULT_RUST_DEPS = "${@bb.utils.contains('PACKAGECONFIG', 'opencl', '', '1', d)}"
91
88PACKAGECONFIG:append:x86 = " libclc gallium-llvm" 92PACKAGECONFIG:append:x86 = " libclc gallium-llvm"
89PACKAGECONFIG:append:x86-64 = " libclc gallium-llvm" 93PACKAGECONFIG:append:x86-64 = " libclc gallium-llvm"
90PACKAGECONFIG:append:i686 = " libclc gallium-llvm" 94PACKAGECONFIG:append:i686 = " libclc gallium-llvm"
@@ -144,9 +148,16 @@ PACKAGECONFIG[gles] = "-Dgles1=enabled -Dgles2=enabled, -Dgles1=disabled -Dgles2
144# "egl" requires "opengl" 148# "egl" requires "opengl"
145PACKAGECONFIG[egl] = "-Degl=enabled, -Degl=disabled" 149PACKAGECONFIG[egl] = "-Degl=enabled, -Degl=disabled"
146 150
151BINDGEN_TARGET = "${TARGET_ARCH}-${TARGET_OS}${@['-gnu', ''][d.getVar('LIBCEXTENSION') != '']}"
152BINDGEN_TARGET:class-native = ""
153
147# "opencl" also requires libclc and gallium-llvm to be present in PKGCONFIG! 154# "opencl" also requires libclc and gallium-llvm to be present in PKGCONFIG!
148# Be sure to enable them both for the target and for the native build. 155# Be sure to enable them both for the target and for the native build.
149PACKAGECONFIG[opencl] = "-Dgallium-opencl=icd,-Dgallium-opencl=disabled," 156PACKAGECONFIG[opencl] = " \
157 -Dgallium-opencl=icd -Dgallium-rusticl=true -Dbindgen-includedir=${STAGING_INCDIR} -Dbindgen-target=${BINDGEN_TARGET},\
158 -Dgallium-opencl=disabled -Dgallium-rusticl=false, \
159 bindgen-cli-native \
160"
150 161
151PACKAGECONFIG[broadcom] = "" 162PACKAGECONFIG[broadcom] = ""
152PACKAGECONFIG[etnaviv] = ",,python3-pycparser-native" 163PACKAGECONFIG[etnaviv] = ",,python3-pycparser-native"
@@ -249,7 +260,7 @@ RDEPENDS:libgles3-mesa-dev += "libgles2-mesa-dev"
249RDEPENDS:libgles2-mesa += "libgles3-mesa" 260RDEPENDS:libgles2-mesa += "libgles3-mesa"
250ALLOW_EMPTY:libgles3-mesa = "1" 261ALLOW_EMPTY:libgles3-mesa = "1"
251 262
252RDEPENDS:libopencl-mesa += "${@bb.utils.contains('PACKAGECONFIG', 'opencl', 'libclc spirv-tools', '', d)}" 263RDEPENDS:libopencl-mesa += "${@bb.utils.contains('PACKAGECONFIG', 'opencl', 'libclc spirv-tools spirv-llvm-translator', '', d)}"
253 264
254PACKAGES =+ "libegl-mesa libegl-mesa-dev \ 265PACKAGES =+ "libegl-mesa libegl-mesa-dev \
255 libosmesa libosmesa-dev \ 266 libosmesa libosmesa-dev \
@@ -355,7 +366,7 @@ FILES:libgles1-mesa = "${libdir}/libGLESv1*.so.*"
355FILES:libgles2-mesa = "${libdir}/libGLESv2.so.*" 366FILES:libgles2-mesa = "${libdir}/libGLESv2.so.*"
356FILES:libgl-mesa = "${libdir}/libGL.so.*" 367FILES:libgl-mesa = "${libdir}/libGL.so.*"
357FILES:libglx-mesa = "${libdir}/libGLX*.so.*" 368FILES:libglx-mesa = "${libdir}/libGLX*.so.*"
358FILES:libopencl-mesa = "${libdir}/libMesaOpenCL.so.* ${libdir}/gallium-pipe/*.so ${sysconfdir}/OpenCL/vendors/mesa.icd" 369FILES:libopencl-mesa = "${libdir}/lib*OpenCL.so.* ${libdir}/gallium-pipe/*.so ${sysconfdir}/OpenCL/vendors/*.icd"
359FILES:libglapi = "${libdir}/libglapi.so.*" 370FILES:libglapi = "${libdir}/libglapi.so.*"
360FILES:libosmesa = "${libdir}/libOSMesa.so.*" 371FILES:libosmesa = "${libdir}/libOSMesa.so.*"
361FILES:libxatracker = "${libdir}/libxatracker.so.*" 372FILES:libxatracker = "${libdir}/libxatracker.so.*"
@@ -369,7 +380,7 @@ FILES:libglapi-dev = "${libdir}/libglapi.*"
369FILES:libgles1-mesa-dev = "${libdir}/libGLESv1*.* ${includedir}/GLES ${libdir}/pkgconfig/glesv1*.pc" 380FILES:libgles1-mesa-dev = "${libdir}/libGLESv1*.* ${includedir}/GLES ${libdir}/pkgconfig/glesv1*.pc"
370FILES:libgles2-mesa-dev = "${libdir}/libGLESv2.* ${includedir}/GLES2 ${libdir}/pkgconfig/glesv2.pc" 381FILES:libgles2-mesa-dev = "${libdir}/libGLESv2.* ${includedir}/GLES2 ${libdir}/pkgconfig/glesv2.pc"
371FILES:libgles3-mesa-dev = "${includedir}/GLES3" 382FILES:libgles3-mesa-dev = "${includedir}/GLES3"
372FILES:libopencl-mesa-dev = "${libdir}/libMesaOpenCL.so" 383FILES:libopencl-mesa-dev = "${libdir}/lib*OpenCL.so"
373FILES:libosmesa-dev = "${libdir}/libOSMesa.* ${includedir}/GL/osmesa.h ${libdir}/pkgconfig/osmesa.pc" 384FILES:libosmesa-dev = "${libdir}/libOSMesa.* ${includedir}/GL/osmesa.h ${libdir}/pkgconfig/osmesa.pc"
374FILES:libxatracker-dev = "${libdir}/libxatracker.so ${libdir}/libxatracker.la \ 385FILES:libxatracker-dev = "${libdir}/libxatracker.so ${libdir}/libxatracker.la \
375 ${includedir}/xa_tracker.h ${includedir}/xa_composite.h ${includedir}/xa_context.h \ 386 ${includedir}/xa_tracker.h ${includedir}/xa_composite.h ${includedir}/xa_context.h \