From: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
To: openembedded-core@lists.openembedded.org
Cc: "Khem Raj" <raj.khem@gmail.com>,
"Zoltán Böszörményi" <zboszor@gmail.com>
Subject: [PATCH v4 9/9] mesa: add support for RustiCL under PACKAGECONFIG "opencl"
Date: Mon, 31 Mar 2025 15:21:42 +0300 [thread overview]
Message-ID: <20250331-mesa-25-v4-9-e62fc54a6efc@oss.qualcomm.com> (raw)
In-Reply-To: <20250331-mesa-25-v4-0-e62fc54a6efc@oss.qualcomm.com>
From: Zoltán Böszörményi <zboszor@gmail.com>
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.
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>
---
...vide-cross-compilation-arguments-to-LLVM-.patch | 67 ++++++++++++++++++++++
meta/recipes-graphics/mesa/mesa.inc | 20 +++++--
2 files changed, 82 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 0000000000000000000000000000000000000000..9506a43376857afdf271aed3e08b8f0e3b54081b
--- /dev/null
+++ b/meta/recipes-graphics/mesa/files/0001-rusticl-provide-cross-compilation-arguments-to-LLVM-.patch
@@ -0,0 +1,67 @@
+From b9cf34f39ca7e7546508ce2ab1f053edef5fc201 Mon Sep 17 00:00:00 2001
+From: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
+Date: Wed, 26 Mar 2025 17:47:09 +0200
+Subject: [PATCH] rusticl: provide cross-compilation arguments to LLVM bindgen
+ invocation
+
+Correctly generating LLVM bindings requires several croos-compilation
+arguments. Provide them to rust.bindgen(). Karol Herbst on IRC suggested
+that a proper fix should be to fix meson's rust.bindgen() to support
+cross-compilation. Carry this patch until meson is fixed.
+
+Upstream-Status: Inappropriate [OE-Specific]
+Link: https://github.com/mesonbuild/meson/issues/13591
+Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
+---
+ meson_options.txt | 14 ++++++++++++++
+ src/gallium/frontends/rusticl/meson.build | 8 ++++++++
+ 2 files changed, 22 insertions(+)
+
+diff --git a/meson_options.txt b/meson_options.txt
+index 0147cafcb146..f73e83fded18 100644
+--- a/meson_options.txt
++++ b/meson_options.txt
+@@ -796,3 +796,17 @@ option(
+ value : false,
+ description : 'Install the drivers internal shader compilers (if needed for cross builds).'
+ )
++
++option(
++ 'bindgen-includedir',
++ type : 'string',
++ value : '',
++ description : 'system-wide include directory for cross-generating LLVM bindings'
++ )
++
++option(
++ 'bindgen-target',
++ type : 'string',
++ value : '',
++ description : 'Clang target for cross-generating LLVM bindings'
++ )
+diff --git a/src/gallium/frontends/rusticl/meson.build b/src/gallium/frontends/rusticl/meson.build
+index a5d1dcf3abb9..480c220b7f5f 100644
+--- a/src/gallium/frontends/rusticl/meson.build
++++ b/src/gallium/frontends/rusticl/meson.build
+@@ -180,13 +180,21 @@ rusticl_opencl_gen = static_library(
+ ],
+ )
+
++bindgen_c_args = []
++bindgen_target = get_option('bindgen-target')
++if bindgen_target != ''
++ bindgen_c_args += [ '-target', bindgen_target ]
++endif
++
+ rusticl_llvm_bindings_rs = rust.bindgen(
+ input : 'rusticl_llvm_bindings.hpp',
+ output : 'rusticl_llvm_bindings.rs',
+ c_args : [
+ rusticl_bindgen_c_args,
+ pre_args,
++ bindgen_c_args,
+ ],
++ include_directories : get_option('bindgen-includedir'),
+ dependencies : [
+ dep_clang,
+ dep_llvm,
diff --git a/meta/recipes-graphics/mesa/mesa.inc b/meta/recipes-graphics/mesa/mesa.inc
index 3518ac488d46012652b62094b913e5ae8ce9b111..4db08530bac9fd27a62ad9b8a336cfe072b0c20f 100644
--- a/meta/recipes-graphics/mesa/mesa.inc
+++ b/meta/recipes-graphics/mesa/mesa.inc
@@ -17,6 +17,7 @@ PE = "2"
SRC_URI = "https://archive.mesa3d.org/mesa-${PV}.tar.xz \
file://0001-meson-misdetects-64bit-atomics-on-mips-clang.patch \
file://0001-freedreno-don-t-encode-build-path-into-binaries.patch\
+ file://0001-rusticl-provide-cross-compilation-arguments-to-LLVM-.patch \
"
SRC_URI[sha256sum] = "adf904d083b308df95898600ffed435f4b5c600d95fb6ec6d4c45638627fdc97"
@@ -45,7 +46,7 @@ PROVIDES = " \
virtual/mesa \
"
-inherit meson pkgconfig python3native gettext features_check
+inherit meson pkgconfig python3native gettext features_check rust
BBCLASSEXTEND = "native nativesdk"
@@ -84,6 +85,9 @@ PACKAGECONFIG = " \
${@bb.utils.contains('DISTRO_FEATURES', 'vulkan', 'zink', '', d)} \
"
+# skip all Rust dependencies if we are not building OpenCL"
+INHIBIT_DEFAULT_RUST_DEPS = "${@bb.utils.contains('PACKAGECONFIG', 'opencl', '', '1', d)}"
+
PACKAGECONFIG:append:x86 = " libclc gallium-llvm"
PACKAGECONFIG:append:x86-64 = " libclc gallium-llvm"
PACKAGECONFIG:append:class-native = " libclc gallium-llvm r600"
@@ -139,9 +143,15 @@ PACKAGECONFIG[gles] = "-Dgles1=enabled -Dgles2=enabled, -Dgles1=disabled -Dgles2
# "egl" requires "opengl"
PACKAGECONFIG[egl] = "-Degl=enabled, -Degl=disabled"
+BINDGEN_TARGET = "${TARGET_ARCH}-${TARGET_OS}${@['-gnu', ''][d.getVar('LIBCEXTENSION') != '']}"
+
# "opencl" also requires libclc and gallium-llvm to be present in PKGCONFIG!
# Be sure to enable them both for the target and for the native build.
-PACKAGECONFIG[opencl] = "-Dgallium-opencl=icd,-Dgallium-opencl=disabled,"
+PACKAGECONFIG[opencl] = " \
+ -Dgallium-opencl=icd -Dgallium-rusticl=true -Dbindgen-includedir=${STAGING_INCDIR} -Dbindgen-target=${BINDGEN_TARGET},\
+ -Dgallium-opencl=disabled -Dgallium-rusticl=false, \
+ bindgen-cli-native \
+"
PACKAGECONFIG[broadcom] = ""
PACKAGECONFIG[etnaviv] = ",,python3-pycparser-native"
@@ -241,7 +251,7 @@ RDEPENDS:libgles3-mesa-dev += "libgles2-mesa-dev"
RDEPENDS:libgles2-mesa += "libgles3-mesa"
ALLOW_EMPTY:libgles3-mesa = "1"
-RDEPENDS:libopencl-mesa += "${@bb.utils.contains('PACKAGECONFIG', 'opencl', 'libclc spirv-tools', '', d)}"
+RDEPENDS:libopencl-mesa += "${@bb.utils.contains('PACKAGECONFIG', 'opencl', 'libclc spirv-tools spirv-llvm-translator', '', d)}"
PACKAGES =+ "libegl-mesa libegl-mesa-dev \
libosmesa libosmesa-dev \
@@ -347,7 +357,7 @@ FILES:libgles1-mesa = "${libdir}/libGLESv1*.so.*"
FILES:libgles2-mesa = "${libdir}/libGLESv2.so.*"
FILES:libgl-mesa = "${libdir}/libGL.so.*"
FILES:libglx-mesa = "${libdir}/libGLX*.so.*"
-FILES:libopencl-mesa = "${libdir}/libMesaOpenCL.so.* ${libdir}/gallium-pipe/*.so ${sysconfdir}/OpenCL/vendors/mesa.icd"
+FILES:libopencl-mesa = "${libdir}/lib*OpenCL.so.* ${libdir}/gallium-pipe/*.so ${sysconfdir}/OpenCL/vendors/*.icd"
FILES:libglapi = "${libdir}/libglapi.so.*"
FILES:libosmesa = "${libdir}/libOSMesa.so.*"
FILES:libxatracker = "${libdir}/libxatracker.so.*"
@@ -361,7 +371,7 @@ FILES:libglapi-dev = "${libdir}/libglapi.*"
FILES:libgles1-mesa-dev = "${libdir}/libGLESv1*.* ${includedir}/GLES ${libdir}/pkgconfig/glesv1*.pc"
FILES:libgles2-mesa-dev = "${libdir}/libGLESv2.* ${includedir}/GLES2 ${libdir}/pkgconfig/glesv2.pc"
FILES:libgles3-mesa-dev = "${includedir}/GLES3"
-FILES:libopencl-mesa-dev = "${libdir}/libMesaOpenCL.so"
+FILES:libopencl-mesa-dev = "${libdir}/lib*OpenCL.so"
FILES:libosmesa-dev = "${libdir}/libOSMesa.* ${includedir}/GL/osmesa.h ${libdir}/pkgconfig/osmesa.pc"
FILES:libxatracker-dev = "${libdir}/libxatracker.so ${libdir}/libxatracker.la \
${includedir}/xa_tracker.h ${includedir}/xa_composite.h ${includedir}/xa_context.h \
--
2.39.5
next prev parent reply other threads:[~2025-03-31 12:22 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-31 12:21 [PATCH v4 0/9] mesa: upgrade to 25.0.2 Dmitry Baryshkov
2025-03-31 12:21 ` [PATCH v4 1/9] llvm: move libLLVM.so.N.M to llvm-libllvm package Dmitry Baryshkov
2025-03-31 12:21 ` [PATCH v4 2/9] llvm: use OECMAKE_SOURCEPATH to specify cmake dir Dmitry Baryshkov
2025-03-31 12:21 ` [PATCH v4 3/9] llvm: handle libdir in llvm-config Dmitry Baryshkov
2025-03-31 12:21 ` [PATCH v4 4/9] llvm: also use llvm-config wrapper for nativesdk recipes Dmitry Baryshkov
2025-03-31 12:21 ` [PATCH v4 5/9] llvm: support building libclc Dmitry Baryshkov
2025-03-31 12:21 ` [PATCH v4 6/9] llvm: add SPIRV-LLVM-Translator support Dmitry Baryshkov
2025-03-31 12:21 ` [PATCH v4 7/9] mesa: upgrade 24.0.7 -> 25.0.2 Dmitry Baryshkov
2025-03-31 12:21 ` [PATCH v4 8/9] bindgen-cli: a tool to generate Rust bindings Dmitry Baryshkov
2025-03-31 12:21 ` Dmitry Baryshkov [this message]
2025-04-01 7:40 ` [OE-core] [PATCH v4 0/9] mesa: upgrade to 25.0.2 Mathieu Dubois-Briand
2025-04-01 8:06 ` Alexander Kanavin
2025-04-01 8:27 ` Mathieu Dubois-Briand
2025-04-01 8:41 ` Alexander Kanavin
2025-04-01 16:19 ` Dmitry Baryshkov
2025-04-01 16:28 ` Alexander Kanavin
2025-04-02 1:45 ` Dmitry Baryshkov
2025-04-02 6:55 ` Mathieu Dubois-Briand
2025-04-02 7:56 ` Alexander Kanavin
2025-04-02 12:50 ` Dmitry Baryshkov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250331-mesa-25-v4-9-e62fc54a6efc@oss.qualcomm.com \
--to=dmitry.baryshkov@oss.qualcomm.com \
--cc=openembedded-core@lists.openembedded.org \
--cc=raj.khem@gmail.com \
--cc=zboszor@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox