diff mbox series

[RFC] mesa: add support for rusticl

Message ID 20240908172311.3773048-1-f_l_k@t-online.de
State Under Review
Headers show
Series [RFC] mesa: add support for rusticl | expand

Commit Message

Markus Volk Sept. 8, 2024, 5:23 p.m. UTC
Signed-off-by: Markus Volk <f_l_k@t-online.de>
---
 ...n.build-workaround-for-rusticl-build.patch | 27 +++++++++++
 ...6da9458c9d0348f2390dc0bea67cf140b1a0.patch | 47 +++++++++++++++++++
 meta/recipes-graphics/mesa/mesa.inc           | 33 +++++++++----
 3 files changed, 97 insertions(+), 10 deletions(-)
 create mode 100644 meta/recipes-graphics/mesa/files/0001-rusticl-meson.build-workaround-for-rusticl-build.patch
 create mode 100644 meta/recipes-graphics/mesa/files/93e96da9458c9d0348f2390dc0bea67cf140b1a0.patch

Comments

patchtest@automation.yoctoproject.org Sept. 8, 2024, 5:33 p.m. UTC | #1
Thank you for your submission. Patchtest identified one
or more issues with the patch. Please see the log below for
more information:

---
Testing patch /home/patchtest/share/mboxes/RFC-mesa-add-support-for-rusticl.patch

FAIL: test commit message presence: Please include a commit message on your patch explaining the change (test_mbox.TestMbox.test_commit_message_presence)

PASS: test CVE tag format (test_patch.TestPatch.test_cve_tag_format)
PASS: test Signed-off-by presence (test_mbox.TestMbox.test_signed_off_by_presence)
PASS: test Signed-off-by presence (test_patch.TestPatch.test_signed_off_by_presence)
PASS: test Upstream-Status presence (test_patch.TestPatch.test_upstream_status_presence_format)
PASS: test author valid (test_mbox.TestMbox.test_author_valid)
PASS: test max line length (test_metadata.TestMetadata.test_max_line_length)
PASS: test mbox format (test_mbox.TestMbox.test_mbox_format)
PASS: test non-AUH upgrade (test_mbox.TestMbox.test_non_auh_upgrade)
PASS: test shortlog format (test_mbox.TestMbox.test_shortlog_format)
PASS: test shortlog length (test_mbox.TestMbox.test_shortlog_length)
PASS: test target mailing list (test_mbox.TestMbox.test_target_mailing_list)

SKIP: pretest pylint: No python related patches, skipping test (test_python_pylint.PyLint.pretest_pylint)
SKIP: pretest src uri left files: Patch cannot be merged (test_metadata.TestMetadata.pretest_src_uri_left_files)
SKIP: test CVE check ignore: No modified recipes or older target branch, skipping test (test_metadata.TestMetadata.test_cve_check_ignore)
SKIP: test bugzilla entry format: No bug ID found (test_mbox.TestMbox.test_bugzilla_entry_format)
SKIP: test lic files chksum modified not mentioned: No modified recipes, skipping test (test_metadata.TestMetadata.test_lic_files_chksum_modified_not_mentioned)
SKIP: test lic files chksum presence: No added recipes, skipping test (test_metadata.TestMetadata.test_lic_files_chksum_presence)
SKIP: test license presence: No added recipes, skipping test (test_metadata.TestMetadata.test_license_presence)
SKIP: test pylint: No python related patches, skipping test (test_python_pylint.PyLint.test_pylint)
SKIP: test series merge on head: Merge test is disabled for now (test_mbox.TestMbox.test_series_merge_on_head)
SKIP: test src uri left files: Patch cannot be merged (test_metadata.TestMetadata.test_src_uri_left_files)
SKIP: test summary presence: No added recipes, skipping test (test_metadata.TestMetadata.test_summary_presence)

---

Please address the issues identified and
submit a new revision of the patch, or alternatively, reply to this
email with an explanation of why the patch should be accepted. If you
believe these results are due to an error in patchtest, please submit a
bug at https://bugzilla.yoctoproject.org/ (use the 'Patchtest' category
under 'Yocto Project Subprojects'). For more information on specific
failures, see: https://wiki.yoctoproject.org/wiki/Patchtest. Thank
you!
Alexander Kanavin Sept. 9, 2024, 8:46 a.m. UTC | #2
On Sun, 8 Sept 2024 at 19:22, Markus Volk via lists.openembedded.org
<f_l_k=t-online.de@lists.openembedded.org> wrote:
> +Subject: [PATCH] rusticl/meson.build: workaround for rusticl build
> +
> +Signed-off-by: Markus Volk <f_l_k@t-online.de>
> +
> +Upstream-Status: Inappropriate [oe-specific]
> +---
> + src/gallium/frontends/rusticl/meson.build | 1 +
> + 1 file changed, 1 insertion(+)
> +
> +diff --git a/src/gallium/frontends/rusticl/meson.build b/src/gallium/frontends/rusticl/meson.build
> +index eef09d8f01e..efac4cab964 100644
> +--- a/src/gallium/frontends/rusticl/meson.build
> ++++ b/src/gallium/frontends/rusticl/meson.build
> +@@ -211,6 +211,7 @@ rusticl_llvm_bindings_rs = rust.bindgen(
> +   c_args : [
> +     rusticl_bindgen_c_args,
> +     pre_args,
> ++   '-I@include@', '-I@include_cpp@', '-I@include_cpp_target_sys@'

This does need to be properly looked into, there's probably a better
patch possible, or a build setting we're missing, or at least an
upstream ticket to be filed. It's not a good patch when it says
'workaround' and doesn't explain the issue and the fix.

Alex
Markus Volk Sept. 9, 2024, 9:45 a.m. UTC | #3
On Mon, Sep 9 2024 at 10:46:59 AM +02:00:00, Alexander Kanavin 
<alex.kanavin@gmail.com> wrote:
> This does need to be properly looked into, there's probably a better
> patch possible, or a build setting we're missing, or at least an
> upstream ticket to be filed. It's not a good patch when it says
> 'workaround' and doesn't explain the issue and the fix.

Fully agree. This is ugly as hell. Just a quick and dirty hack to get 
things working (which is always a good starting point) but by no means 
a solution for oe-core. Thats why I marked it RFC
Zoltán Böszörményi Sept. 13, 2024, 10:40 a.m. UTC | #4
2024. 09. 09. 11:45 keltezéssel, Markus Volk via lists.openembedded.org írta:
> On Mon, Sep 9 2024 at 10:46:59 AM +02:00:00, Alexander Kanavin <alex.kanavin@gmail.com> 
> wrote:
>> This does need to be properly looked into, there's probably a better patch possible, or 
>> a build setting we're missing, or at least an upstream ticket to be filed. It's not a 
>> good patch when it says 'workaround' and doesn't explain the issue and the fix.
>
> Fully agree. This is ugly as hell. Just a quick and dirty hack to get things working 
> (which is always a good starting point) but by no means a solution for oe-core. Thats 
> why I marked it RFC

Don't call it a "workaround" then.
Call it "pass in recipe-sysroot include directories" because
that's what this patch does combined with the mesa.inc changes.

Though it's not complete in my testing.
I needed this patch against 24.2.2 so I could build Mesa Rusticl,
plus EXTRA_OEMESON += "-Dintel-rt=disabled" in my bbappend
because the iris driver failed to build otherwise, complaining for
every generated file from *.cl about "shader not available, consider
installing libclc" or something like that, eventually failing the build.

diff --git a/src/gallium/frontends/rusticl/meson.build 
b/src/gallium/frontends/rusticl/meson.build
index eef09d8f01e..efac4cab964 100644
--- a/src/gallium/frontends/rusticl/meson.build
+++ b/src/gallium/frontends/rusticl/meson.build
@@ -146,6 +146,7 @@ rusticl_opencl_bindings_rs = rust.bindgen(
      rusticl_bindgen_c_args,
      pre_args,
      cl_c_args,
+   '-I@include@', '-I@include_cpp@', '-I@include_cpp_target_sys@'
    ],
    args : [
      rusticl_bindgen_args,
@@ -190,6 +191,7 @@ rusticl_llvm_bindings_rs = rust.bindgen(
    c_args : [
      rusticl_bindgen_c_args,
      pre_args,
+   '-I@include@', '-I@include_cpp@', '-I@include_cpp_target_sys@'
    ],
    dependencies : [
      dep_clang,


>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#204323): https://lists.openembedded.org/g/openembedded-core/message/204323
> Mute This Topic: https://lists.openembedded.org/mt/108340502/3617728
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [zboszor@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
Zoltán Böszörményi Sept. 13, 2024, 10:43 a.m. UTC | #5
2024. 09. 13. 12:40 keltezéssel, Zoltan Boszormenyi via lists.openembedded.org írta:
> 2024. 09. 09. 11:45 keltezéssel, Markus Volk via lists.openembedded.org írta:
>> On Mon, Sep 9 2024 at 10:46:59 AM +02:00:00, Alexander Kanavin <alex.kanavin@gmail.com> 
>> wrote:
>>> This does need to be properly looked into, there's probably a better patch possible, 
>>> or a build setting we're missing, or at least an upstream ticket to be filed. It's not 
>>> a good patch when it says 'workaround' and doesn't explain the issue and the fix.
>>
>> Fully agree. This is ugly as hell. Just a quick and dirty hack to get things working 
>> (which is always a good starting point) but by no means a solution for oe-core. Thats 
>> why I marked it RFC
>
> Don't call it a "workaround" then.
> Call it "pass in recipe-sysroot include directories" because
> that's what this patch does combined with the mesa.inc changes.

The underlying problem seems to be that bindgen does not
seem to pick up CFLAGS or CPPFLAGS automatically, so it needs
the extra -I options passed in under Yocto to look for headers
in the correct places.

>
> Though it's not complete in my testing.
> I needed this patch against 24.2.2 so I could build Mesa Rusticl,
> plus EXTRA_OEMESON += "-Dintel-rt=disabled" in my bbappend
> because the iris driver failed to build otherwise, complaining for
> every generated file from *.cl about "shader not available, consider
> installing libclc" or something like that, eventually failing the build.
>
> diff --git a/src/gallium/frontends/rusticl/meson.build 
> b/src/gallium/frontends/rusticl/meson.build
> index eef09d8f01e..efac4cab964 100644
> --- a/src/gallium/frontends/rusticl/meson.build
> +++ b/src/gallium/frontends/rusticl/meson.build
> @@ -146,6 +146,7 @@ rusticl_opencl_bindings_rs = rust.bindgen(
>      rusticl_bindgen_c_args,
>      pre_args,
>      cl_c_args,
> +   '-I@include@', '-I@include_cpp@', '-I@include_cpp_target_sys@'
>    ],
>    args : [
>      rusticl_bindgen_args,
> @@ -190,6 +191,7 @@ rusticl_llvm_bindings_rs = rust.bindgen(
>    c_args : [
>      rusticl_bindgen_c_args,
>      pre_args,
> +   '-I@include@', '-I@include_cpp@', '-I@include_cpp_target_sys@'
>    ],
>    dependencies : [
>      dep_clang,
>
>
>>
>>
>>
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#204478): https://lists.openembedded.org/g/openembedded-core/message/204478
> Mute This Topic: https://lists.openembedded.org/mt/108340502/3617728
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [zboszor@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
Markus Volk Sept. 13, 2024, 12:59 p.m. UTC | #6
Hi,
thanks for the feedback. Yes, I accidentally added the patch I made for 
mesa 24.2.1. Currently I have it like this, which should also work:

diff --git a/src/gallium/frontends/rusticl/meson.build 
b/src/gallium/frontends/rusticl/meson.build
index 84df0a9edb9..20459f73993 100644
--- a/src/gallium/frontends/rusticl/meson.build
+++ b/src/gallium/frontends/rusticl/meson.build
@@ -122,6 +122,7 @@ endif

 rusticl_bindgen_c_args = [
   '-fno-builtin-malloc',
+  '-I@include@', '-I@include_cpp@', '-I@include_cpp_target_sys@',
 ]

 cl_c_args = [
Zoltán Böszörményi Sept. 13, 2024, 1:20 p.m. UTC | #7
2024. 09. 13. 14:59 keltezéssel, Markus Volk írta:
> Hi,
> thanks for the feedback. Yes, I accidentally added the patch I made for mesa 24.2.1. 
> Currently I have it like this, which should also work:
>
> diff --git a/src/gallium/frontends/rusticl/meson.build 
> b/src/gallium/frontends/rusticl/meson.build
> index 84df0a9edb9..20459f73993 100644
> --- a/src/gallium/frontends/rusticl/meson.build
> +++ b/src/gallium/frontends/rusticl/meson.build
> @@ -122,6 +122,7 @@ endif
>  rusticl_bindgen_c_args = [
>    '-fno-builtin-malloc',
> +  '-I@include@', '-I@include_cpp@', '-I@include_cpp_target_sys@',
>  ]
>  cl_c_args = [
> -- 
>
> One assumption on the shader issue. intel_clc is currently added only for x86-64. If you 
> are building for another platform intel_clc is not installed for mesa-native, but 
> required for 'iris'.
>
> Changing this line:
> GALLIUMDRIVERS:append ="${@bb.utils.contains_any('PACKAGECONFIG', 'opencl-rusticl 
> opencl-clover', ',iris', '', d)}"
> to:
> GALLIUMDRIVERS:append:x86-64 ="${@bb.utils.contains_any('PACKAGECONFIG', 'opencl-rusticl 
> opencl-clover', ',iris', '', d)}"
>
> might remove the need to disable raytracing in EXTRA_OEMESON
>
> Alternatively also removing x86-64 from these lines:
> EXTRA_OEMESON:append:class-target:x86-64 = " ${@bb.utils.contains_any('PACKAGECONFIG', 
> 'opencl-rusticl opencl-clover', '-Dintel-clc=system', '', d)}"
> EXTRA_OEMESON:append:class-native:x86-64 = " ${@bb.utils.contains_any('PACKAGECONFIG', 
> 'opencl-rusticl opencl-clover', '-Dintel-clc=enabled -Dinstall-intel-clc=true 
> -Dgallium-rusticl=false', '', d)}"
>
> might help, but I'm unsure if intel_clc would be of any use apart from x86-64

IIRC, Intel fixed their kernel driver to build and work on e.g. aarch64
(or was it their new "xe" driver that has this?) and the expectation is
that some 64-bit ARM systems do have PCIe and their discrete GPUs
would be usable on other platforms than x86-64.

>
>
> On Fri, Sep 13 2024 at 12:43:46 PM +02:00:00, Böszörményi Zoltán <zboszor@gmail.com> wrote:
>> 2024. 09. 13. 12:40 keltezéssel, Zoltan Boszormenyi via lists.openembedded.org írta:
>>
>>     2024. 09. 09. 11:45 keltezéssel, Markus Volk via lists.openembedded.org írta:
>>
>>         On Mon, Sep 9 2024 at 10:46:59 AM +02:00:00, Alexander Kanavin
>>         <alex.kanavin@gmail.com> wrote:
>>
>>             This does need to be properly looked into, there's probably a better patch
>>             possible, or a build setting we're missing, or at least an upstream
>>             ticket to be filed. It's not a good patch when it says 'workaround' and
>>             doesn't explain the issue and the fix. 
>>
>>         Fully agree. This is ugly as hell. Just a quick and dirty hack to get things
>>         working (which is always a good starting point) but by no means a solution
>>         for oe-core. Thats why I marked it RFC 
>>
>>     Don't call it a "workaround" then. Call it "pass in recipe-sysroot include
>>     directories" because that's what this patch does combined with the mesa.inc changes. 
>>
>> The underlying problem seems to be that bindgen does not seem to pick up CFLAGS or 
>> CPPFLAGS automatically, so it needs the extra -I options passed in under Yocto to look 
>> for headers in the correct places.
>>
>>     Though it's not complete in my testing. I needed this patch against 24.2.2 so I
>>     could build Mesa Rusticl, plus EXTRA_OEMESON += "-Dintel-rt=disabled" in my
>>     bbappend because the iris driver failed to build otherwise, complaining for every
>>     generated file from *.cl about "shader not available, consider installing libclc"
>>     or something like that, eventually failing the build. diff --git
>>     a/src/gallium/frontends/rusticl/meson.build
>>     b/src/gallium/frontends/rusticl/meson.build index eef09d8f01e..efac4cab964 100644
>>     --- a/src/gallium/frontends/rusticl/meson.build +++
>>     b/src/gallium/frontends/rusticl/meson.build @@ -146,6 +146,7 @@
>>     rusticl_opencl_bindings_rs = rust.bindgen(      rusticl_bindgen_c_args,     
>>     pre_args,      cl_c_args, +   '-I@include@', '-I@include_cpp@',
>>     '-I@include_cpp_target_sys@'    ],    args : [      rusticl_bindgen_args, @@ -190,6
>>     +191,7 @@ rusticl_llvm_bindings_rs = rust.bindgen(    c_args : [     
>>     rusticl_bindgen_c_args,      pre_args, +   '-I@include@', '-I@include_cpp@',
>>     '-I@include_cpp_target_sys@'    ],    dependencies : [      dep_clang,
>>
>>     -=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group.
>>     View/Reply Online (#204478):
>>     https://lists.openembedded.org/g/openembedded-core/message/204478 Mute This Topic:
>>     https://lists.openembedded.org/mt/108340502/3617728 Group Owner:
>>     openembedded-core+owner@lists.openembedded.org Unsubscribe:
>>     https://lists.openembedded.org/g/openembedded-core/unsub [zboszor@gmail.com]
>>     -=-=-=-=-=-=-=-=-=-=-=- 
>>
diff mbox series

Patch

diff --git a/meta/recipes-graphics/mesa/files/0001-rusticl-meson.build-workaround-for-rusticl-build.patch b/meta/recipes-graphics/mesa/files/0001-rusticl-meson.build-workaround-for-rusticl-build.patch
new file mode 100644
index 0000000000..9c953f961d
--- /dev/null
+++ b/meta/recipes-graphics/mesa/files/0001-rusticl-meson.build-workaround-for-rusticl-build.patch
@@ -0,0 +1,27 @@ 
+From b34ee4014ee9e3466ebafbd53745d9f9a13379da Mon Sep 17 00:00:00 2001
+From: Markus Volk <f_l_k@t-online.de>
+Date: Thu, 11 Jul 2024 22:52:16 +0200
+Subject: [PATCH] rusticl/meson.build: workaround for rusticl build
+
+Signed-off-by: Markus Volk <f_l_k@t-online.de>
+
+Upstream-Status: Inappropriate [oe-specific]
+---
+ src/gallium/frontends/rusticl/meson.build | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/src/gallium/frontends/rusticl/meson.build b/src/gallium/frontends/rusticl/meson.build
+index eef09d8f01e..efac4cab964 100644
+--- a/src/gallium/frontends/rusticl/meson.build
++++ b/src/gallium/frontends/rusticl/meson.build
+@@ -211,6 +211,7 @@ rusticl_llvm_bindings_rs = rust.bindgen(
+   c_args : [
+     rusticl_bindgen_c_args,
+     pre_args,
++   '-I@include@', '-I@include_cpp@', '-I@include_cpp_target_sys@'
+   ],
+   dependencies : [
+     dep_clang,
+-- 
+2.45.2
+
diff --git a/meta/recipes-graphics/mesa/files/93e96da9458c9d0348f2390dc0bea67cf140b1a0.patch b/meta/recipes-graphics/mesa/files/93e96da9458c9d0348f2390dc0bea67cf140b1a0.patch
new file mode 100644
index 0000000000..9c5c9c75ff
--- /dev/null
+++ b/meta/recipes-graphics/mesa/files/93e96da9458c9d0348f2390dc0bea67cf140b1a0.patch
@@ -0,0 +1,47 @@ 
+From 93e96da9458c9d0348f2390dc0bea67cf140b1a0 Mon Sep 17 00:00:00 2001
+From: Karol Herbst <kherbst@redhat.com>
+Date: Sun, 18 Aug 2024 00:08:50 +0200
+Subject: [PATCH] rusticl: do not use CL vector types in bindings and code
+
+Bindgen seems to miscompile them and I kinda thought I've done this
+already in the past, but apparently not.
+
+Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/11722
+Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30710>
+
+Upstream-Status: Backport [https://gitlab.freedesktop.org/mesa/mesa/-/commit/93e96da9458c9d0348f2390dc0bea67cf140b1a0]
+
+Signed-off-by: Markus Volk <f_l_k@t-online.de>
+---
+ src/gallium/frontends/rusticl/api/device.rs | 2 +-
+ src/gallium/frontends/rusticl/meson.build   | 1 +
+ 2 files changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/src/gallium/frontends/rusticl/api/device.rs b/src/gallium/frontends/rusticl/api/device.rs
+index 9793092db5ad4..c1cb7902e0371 100644
+--- a/src/gallium/frontends/rusticl/api/device.rs
++++ b/src/gallium/frontends/rusticl/api/device.rs
+@@ -196,7 +196,7 @@ impl CLInfo<cl_device_info> for cl_device_id {
+             // TODO proper retrival from devices
+             CL_DEVICE_MEM_BASE_ADDR_ALIGN => cl_prop::<cl_uint>(0x1000),
+             CL_DEVICE_MIN_DATA_TYPE_ALIGN_SIZE => {
+-                cl_prop::<cl_uint>(size_of::<cl_ulong16>() as cl_uint)
++                cl_prop::<cl_uint>(16 * size_of::<cl_ulong>() as cl_uint)
+             }
+             CL_DEVICE_NAME => cl_prop::<&str>(&dev.screen().name()),
+             CL_DEVICE_NATIVE_VECTOR_WIDTH_CHAR => cl_prop::<cl_uint>(1),
+diff --git a/src/gallium/frontends/rusticl/meson.build b/src/gallium/frontends/rusticl/meson.build
+index 612e47bfe88e1..1fe75a611444d 100644
+--- a/src/gallium/frontends/rusticl/meson.build
++++ b/src/gallium/frontends/rusticl/meson.build
+@@ -146,6 +146,7 @@ rusticl_opencl_bindings_rs = rust.bindgen(
+     '--raw-line', 'unsafe impl std::marker::Send for _cl_image_desc {}',
+     '--raw-line', 'unsafe impl std::marker::Sync for _cl_image_desc {}',
+     '--allowlist-type', 'cl_.*',
++    '--blocklist-type', '(__)?cl_.*[2348(16)]',
+     '--allowlist-type', 'cl.*_fn',
+     '--allowlist-var', 'CL_.*',
+     # needed for gl_sharing extension
+-- 
+GitLab
+
diff --git a/meta/recipes-graphics/mesa/mesa.inc b/meta/recipes-graphics/mesa/mesa.inc
index ecea7e94de..04dec3fddc 100644
--- a/meta/recipes-graphics/mesa/mesa.inc
+++ b/meta/recipes-graphics/mesa/mesa.inc
@@ -17,6 +17,8 @@  PE = "2"
 SRC_URI = "https://mesa.freedesktop.org/archive/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-meson.build-workaround-for-rusticl-build.patch \
+           file://93e96da9458c9d0348f2390dc0bea67cf140b1a0.patch \
 "
 
 SRC_URI[sha256sum] = "fd077d3104edbe459e2b8597d2757ec065f9bd2d620b8c0b9cc88c2bf9891d02"
@@ -35,7 +37,7 @@  do_install:append() {
 }
 
 DEPENDS = "expat makedepend-native flex-native bison-native libxml2-native zlib chrpath-replacement-native python3-mako-native python3-pyyaml-native gettext-native"
-DEPENDS:append:class-target = " ${@bb.utils.contains('PACKAGECONFIG', 'opencl', 'mesa-native', '', d)}"
+DEPENDS:append:class-target = " ${@bb.utils.contains_any('PACKAGECONFIG', 'opencl-rusticl opencl-clover', ' mesa-native gcc-runtime', '', d)}"
 EXTRANATIVEPATH += "chrpath-native"
 PROVIDES = " \
     ${@bb.utils.contains('PACKAGECONFIG', 'opengl', 'virtual/libgl', '', d)} \
@@ -46,7 +48,7 @@  PROVIDES = " \
     virtual/mesa \
     "
 
-inherit meson pkgconfig python3native gettext features_check
+inherit rust meson pkgconfig python3native gettext features_check
 
 BBCLASSEXTEND = "native nativesdk"
 
@@ -73,8 +75,14 @@  EXTRA_OEMESON = " \
     -Dplatforms='${@",".join("${PLATFORMS}".split())}' \
 "
 
-EXTRA_OEMESON:append:class-target:x86-64 = " ${@bb.utils.contains('PACKAGECONFIG', 'opencl', '-Dintel-clc=system', '', d)}"
-EXTRA_OEMESON:append:class-native:x86-64 = " ${@bb.utils.contains('PACKAGECONFIG', 'opencl', '-Dintel-clc=enabled -Dinstall-intel-clc=true', '', d)}"
+EXTRA_OEMESON:append:class-target:x86-64 = " ${@bb.utils.contains_any('PACKAGECONFIG', 'opencl-rusticl opencl-clover', '-Dintel-clc=system', '', d)}"
+EXTRA_OEMESON:append:class-native:x86-64 = " ${@bb.utils.contains_any('PACKAGECONFIG', 'opencl-rusticl opencl-clover', '-Dintel-clc=enabled -Dinstall-intel-clc=true -Dgallium-rusticl=false', '', d)}"
+
+do_configure:prepend() {
+	sed -i "s|@include@|${STAGING_INCDIR}|" ${S}/src/gallium/frontends/rusticl/meson.build
+	sed -i "s|@include_cpp@|${STAGING_INCDIR}\/c++\/14.2.0|" ${S}/src/gallium/frontends/rusticl/meson.build
+	sed -i "s|@include_cpp_target_sys@|${STAGING_INCDIR}\/c++\/14.2.0\/${TARGET_SYS}|" ${S}/src/gallium/frontends/rusticl/meson.build
+}
 
 def strip_comma(s):
     return s.strip(',')
@@ -104,10 +112,10 @@  PACKAGECONFIG[dri3] = "-Ddri3=enabled, -Ddri3=disabled, xorgproto libxshmfence"
 # Vulkan drivers need dri3 enabled
 # amd could be enabled as well but requires gallium-llvm with llvm >= 3.9
 VULKAN_DRIVERS = ""
-VULKAN_DRIVERS:append:x86 = "${@bb.utils.contains('PACKAGECONFIG', ',opencl', ',intel', '', d)},intel_hasvk,amd"
-VULKAN_DRIVERS:append:x86-64 = "${@bb.utils.contains('PACKAGECONFIG', 'opencl', ',intel', '', d)},intel_hasvk,amd"
+VULKAN_DRIVERS:append:x86 = "${@bb.utils.contains_any('PACKAGECONFIG', 'opencl-rusticl opencl-clover', ',intel', '', d)},intel_hasvk,amd"
+VULKAN_DRIVERS:append:x86-64 = "${@bb.utils.contains_any('PACKAGECONFIG', 'opencl-rusticl opencl-clover', ',intel', '', d)},intel_hasvk,amd"
 # i686 is a 32 bit override for mesa-native
-VULKAN_DRIVERS:append:i686 = "${@bb.utils.contains('PACKAGECONFIG', 'opencl', ',intel', '', d)},intel_hasvk,amd"
+VULKAN_DRIVERS:append:i686 = "${@bb.utils.contains_any('PACKAGECONFIG', 'opencl-rusticl opencl-clover', ',intel', '', d)},intel_hasvk,amd"
 VULKAN_DRIVERS:append ="${@bb.utils.contains('PACKAGECONFIG', 'freedreno', ',freedreno', '', d)}"
 VULKAN_DRIVERS:append ="${@bb.utils.contains('PACKAGECONFIG', 'broadcom', ',broadcom', '', d)}"
 VULKAN_DRIVERS:append ="${@bb.utils.contains('PACKAGECONFIG', 'gallium-llvm', ',swrast', '', d)}"
@@ -141,8 +149,10 @@  PACKAGECONFIG[gles] = "-Dgles1=enabled -Dgles2=enabled, -Dgles1=disabled -Dgles2
 # "egl" requires "opengl"
 PACKAGECONFIG[egl] = "-Degl=enabled, -Degl=disabled"
 
-# "opencl" requires libclc from meta-clang
-PACKAGECONFIG[opencl] = "-Dgallium-opencl=icd -Dopencl-spirv=true,-Dgallium-opencl=disabled -Dopencl-spirv=false,libclc spirv-tools python3-ply-native"
+# "opencl-clover" requires libclc from meta-clang
+PACKAGECONFIG[opencl-clover] = "-Dgallium-opencl=icd -Dopencl-spirv=true,-Dgallium-opencl=disabled -Dopencl-spirv=false,libclc spirv-tools python3-ply-native"
+# "opencl-rusticl" requires libclc, bindgen-cli and clang from meta-clang
+PACKAGECONFIG[opencl-rusticl] = "-Dgallium-rusticl=true,-Dgallium-rusticl=false,libclc bindgen-cli-native python3-ply-native clang"
 
 PACKAGECONFIG[broadcom] = ""
 PACKAGECONFIG[etnaviv] = ",,python3-pycparser-native"
@@ -164,7 +174,7 @@  GALLIUMDRIVERS:append ="${@bb.utils.contains('PACKAGECONFIG', 'freedreno', ',fre
 GALLIUMDRIVERS:append ="${@bb.utils.contains('PACKAGECONFIG', 'vc4', ',vc4', '', d)}"
 GALLIUMDRIVERS:append ="${@bb.utils.contains('PACKAGECONFIG', 'v3d', ',v3d', '', d)}"
 GALLIUMDRIVERS:append ="${@bb.utils.contains('PACKAGECONFIG', 'zink', ',zink', '', d)}"
-GALLIUMDRIVERS:append ="${@bb.utils.contains('PACKAGECONFIG', 'opencl', ',iris', '', d)}"
+GALLIUMDRIVERS:append ="${@bb.utils.contains_any('PACKAGECONFIG', 'opencl-rusticl opencl-clover', ',iris', '', d)}"
 
 # radeonsi requires LLVM
 GALLIUMDRIVERS_RADEONSI = "${@bb.utils.contains('PACKAGECONFIG', 'r600', ',radeonsi', '', d)}"
@@ -239,6 +249,7 @@  PACKAGES =+ "libegl-mesa libegl-mesa-dev \
              libgles2-mesa libgles2-mesa-dev \
              libgles3-mesa libgles3-mesa-dev \
              libopencl-mesa libopencl-mesa-dev \
+             libopencl-rusticl libopencl-rusticl-dev \
              libxatracker libxatracker-dev \
              mesa-megadriver mesa-vulkan-drivers \
              mesa-vdpau-drivers mesa-gallium-drivers mesa-tools \
@@ -333,6 +344,7 @@  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-rusticl = "${libdir}/libRusticlOpenCL.so.* ${sysconfdir}/OpenCL/vendors/rusticl.icd"
 FILES:libglapi = "${libdir}/libglapi.so.*"
 FILES:libosmesa = "${libdir}/libOSMesa.so.*"
 FILES:libxatracker = "${libdir}/libxatracker.so.*"
@@ -347,6 +359,7 @@  FILES:libgles1-mesa-dev = "${libdir}/libGLESv1*.* ${includedir}/GLES ${libdir}/p
 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-rusticl-dev = "${libdir}/libRusticlOpenCL.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 \