mesa: small improvements after 25.0 merge
v2 cover mesa: small improvements after 25.0 merge
Several bugfixes after Mesa 25.0 recipe was merged:
- Replace the bindgen patches with meson-based fix (Dylan Baker)
- Bundle OpenCL C headers
---
Changes in v2:
- Dropped applied patches
- Add the bundle-opencl-headers patch
- Link to v1: https://lore.kernel.org/r/[email protected]
---
Dmitry Baryshkov (3):
meson: pass -target and -I to bindgen calls
mesa: drop the bindgen patch
mesa: bundle Clang OpenCL headers into meta-clc
meta/classes-recipe/meson.bbclass | 1 + ...d-an-option-to-force-inclusion-of-OpenCL-.patch | 57 ++++++++++++++++++ ...vide-cross-compilation-arguments-to-LLVM-.patch | 67 ---------------------- meta/recipes-graphics/mesa/mesa.inc | 9 +-- 4 files changed, 61 insertions(+), 73 deletions(-)
---
base-commit: 53c772c941d5ce69ab89f35cd04724b740daf269
change-id: 20250411-mesa-25-fixes-5a38fe55dd3c
Best regards,
Signature · 1 line
Dmitry Baryshkov <[email protected]>
PATCH v2 1/3 meson: pass -target and -I to bindgen calls
In order to properly generate Rust bindings for the target systems, we need to pass '-taget foo-linux-gnueabi' flags and a correct include target include path (${STAGING_INCDIR}) to the bindgen. Add those flags to the generated meson target file.
--- meta/classes-recipe/meson.bbclass | 1 + 1 file changed, 1 insertion(+)
meta/classes-recipe/meson.bbclass +1 -0
@@ -93,6 +93,7 @@ cpp_link_args = ${@meson_array('LDFLAGS', d)} [properties] needs_exe_wrapper = true sys_root = '${STAGING_DIR_HOST}' +bindgen_clang_arguments = ['-target', '${@d.getVar('RUST_HOST_SYS')}', '-I${STAGING_INCDIR}'] [host_machine] system = '${@meson_operating_system('HOST_OS', d)}'
Signature · 1 line
2.39.5
PATCH v2 2/3 mesa: drop the bindgen patch
In reply to Dmitry BaryshkovDrop the bingen-target and bindgen-includedir options in favour of the bindgen_clang_args being passed through the meson target file.
--- ...vide-cross-compilation-arguments-to-LLVM-.patch | 67 ---------------------- meta/recipes-graphics/mesa/mesa.inc | 6 +- 2 files changed, 1 insertion(+), 72 deletions(-)
meta/recipes-graphics/mesa/files/0001-rusticl-provide-cross-compilation-arguments-to-LLVM-.patch deleted +0 -67
@@ -1,67 +0,0 @@ -From b9cf34f39ca7e7546508ce2ab1f053edef5fc201 Mon Sep 17 00:00:00 2001 -From: Dmitry Baryshkov <[email protected]> -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 <[email protected]> ---- - 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 -@@ -115,6 +115,11 @@ rusticl_bindgen_c_args = [ - '-fno-builtin-malloc', - ] - -+bindgen_target = get_option('bindgen-target') -+if bindgen_target != '' -+ rusticl_bindgen_c_args += [ '-target', bindgen_target ] -+endif -+ - cl_c_args = [ - '-DCL_USE_DEPRECATED_OPENCL_1_0_APIS', - '-DCL_USE_DEPRECATED_OPENCL_1_1_APIS', -@@ -187,6 +192,9 @@ rusticl_llvm_bindings_rs = rust.bindgen( - rusticl_bindgen_c_args, - pre_args, - ], -+ include_directories : [ -+ get_option('bindgen-includedir'), -+ ], - dependencies : [ - dep_clang, - dep_llvm,
meta/recipes-graphics/mesa/mesa.inc +1 -5
@@ -18,7 +18,6 @@ SRC_URI = "https://archive.mesa3d.org/mesa-${PV}.tar.xz \ file://0001-meson-misdetects-64bit-atomics-on-mips-clang.patch \ file://0001-meson-disable-SIMD-blake-optimisations-on-x32-host.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"
@@ -143,13 +142,10 @@ 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') != '']}" -BINDGEN_TARGET:class-native = "" - # "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-rusticl=true -Dbindgen-includedir=${STAGING_INCDIR} -Dbindgen-target=${BINDGEN_TARGET},\ + -Dgallium-opencl=icd -Dgallium-rusticl=true, \ -Dgallium-opencl=disabled -Dgallium-rusticl=false, \ bindgen-cli-native \ "
Signature · 1 line
2.39.5
PATCH v2 3/3 mesa: bundle Clang OpenCL headers into meta-clc
In reply to Dmitry BaryshkovAdd a patch bundling OpenCL headers into meta-clc. This removes extra runtime dependencies when runnign meta-clc compiler.
--- ...d-an-option-to-force-inclusion-of-OpenCL-.patch | 57 ++++++++++++++++++++++ meta/recipes-graphics/mesa/mesa.inc | 3 +- 2 files changed, 59 insertions(+), 1 deletion(-)
meta/recipes-graphics/mesa/files/0001-mesa-clc-add-an-option-to-force-inclusion-of-OpenCL-.patch new file +57 -0
@@ -0,0 +1,57 @@ +From f9b6175e7c446a82c568ff1a214885d707c95f49 Mon Sep 17 00:00:00 2001 +From: Dmitry Baryshkov <[email protected]> +Date: Wed, 16 Apr 2025 14:35:37 +0300 +Subject: [PATCH] mesa-clc: add an option to force inclusion of OpenCL headers + +Currently mesa-clc bundles OpenCL headers from Clang only if the static +LLVM is used (which means Clang / LLVM are not present on the target +system). In some cases (e.g. when building in OpenEmbedded environemnt) +it is desirable to have shared LLVM library, but skip installing the +whole Clang runtime just to compile shaders. Add an option that forces +OpenCL headers to be bundled with the mesa-clc binary. + +Signed-off-by: Dmitry Baryshkov <[email protected]> +Upstream-Status: Submitted [https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34551] +--- + meson_options.txt | 10 ++++++++++ + src/compiler/clc/meson.build | 3 ++- + 2 files changed, 12 insertions(+), 1 deletion(-) + +diff --git a/meson_options.txt b/meson_options.txt +index 18da31eff507..addd274ecef7 100644 +--- a/meson_options.txt ++++ b/meson_options.txt +@@ -797,6 +797,16 @@ option( + description : 'Install the mesa-clc compiler (if needed for cross builds).' + ) + ++option( ++ 'mesa-clc-bundle-headers', ++ type : 'combo', ++ value : 'auto', ++ choices : [ ++ 'enabled', 'auto' ++ ], ++ 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).' ++) ++ + option( + 'precomp-compiler', + type : 'combo', +diff --git a/src/compiler/clc/meson.build b/src/compiler/clc/meson.build +index 263eba527191..9ff61440f0da 100644 +--- a/src/compiler/clc/meson.build ++++ b/src/compiler/clc/meson.build +@@ -11,7 +11,8 @@ _libmesaclc_c_args = [] + _libmesaclc_cpp_args = ['-DLLVM_LIB_DIR="@0@"'.format(llvm_libdir)] + _libmesaclc_sources = [] + +-if not _shared_llvm ++if not _shared_llvm or \ ++ get_option('mesa-clc-bundle-headers') == 'enabled' + # LLVM 16 moved clang header path from using full version to only major version + if dep_llvm.version().version_compare('< 16') + # Prior to LLVM 16, this path used a full version +-- +2.47.2 +
meta/recipes-graphics/mesa/mesa.inc +2 -1
@@ -18,6 +18,7 @@ SRC_URI = "https://archive.mesa3d.org/mesa-${PV}.tar.xz \ file://0001-meson-misdetects-64bit-atomics-on-mips-clang.patch \ file://0001-meson-disable-SIMD-blake-optimisations-on-x32-host.patch \ file://0001-freedreno-don-t-encode-build-path-into-binaries.patch\ + file://0001-mesa-clc-add-an-option-to-force-inclusion-of-OpenCL-.patch \ " SRC_URI[sha256sum] = "adf904d083b308df95898600ffed435f4b5c600d95fb6ec6d4c45638627fdc97"
@@ -193,7 +194,7 @@ MESA_NATIVE:class-native = "" PACKAGECONFIG[gallium] = "-Dgallium-drivers=${@strip_comma('${GALLIUMDRIVERS}')}, -Dgallium-drivers='', libdrm" PACKAGECONFIG[gallium-llvm] = "-Dllvm=enabled -Dshared-llvm=enabled, -Dllvm=disabled, llvm llvm-native elfutils" -PACKAGECONFIG[libclc] = "-Dmesa-clc=${MESA_CLC} -Dinstall-mesa-clc=${INSTALL_MESA_CLC},,libclc spirv-tools spirv-llvm-translator ${MESA_NATIVE}" +PACKAGECONFIG[libclc] = "-Dmesa-clc=${MESA_CLC} -Dinstall-mesa-clc=${INSTALL_MESA_CLC} -Dmesa-clc-bundle-headers=enabled,,libclc spirv-tools spirv-llvm-translator ${MESA_NATIVE}" PACKAGECONFIG[xa] = "-Dgallium-xa=enabled, -Dgallium-xa=disabled" PACKAGECONFIG[va] = "-Dgallium-va=enabled,-Dgallium-va=disabled,libva-initial" PACKAGECONFIG[vdpau] = "-Dgallium-vdpau=enabled,-Dgallium-vdpau=disabled,libvdpau"
Signature · 1 line
2.39.5
Hi Dmitry
I have picked these patch into clang-merge-2 branch.
https://web.git.yoctoproject.org/poky-contrib/log/?h=kraj/clang-merge-2
They help with some mesa-native build failures however, I am still seeing a build failure build mesa-native
on musl targets. I am not sure why target should matter but it seems to see the error
https://autobuilder.yoctoproject.org/valkyrie/#/builders/111/builds/150
Error is that mesa_clc is not available before its use. Interestingly, it never fails locally here but it always fails on AB. Is there some sort of build race or something else going on?
Would appreciate help.
Quoted 40 lines · Dmitry Baryshkov via lists.openembedded.org
Several bugfixes after Mesa 25.0 recipe was merged:
- Replace the bindgen patches with meson-based fix (Dylan Baker)
- Bundle OpenCL C headersSigned-off-by Dmitry Baryshkov <[email protected]>---
Changes in v2:
- Dropped applied patches
- Add the bundle-opencl-headers patch
- Link to v1: https://lore.kernel.org/r/[email protected]---
Dmitry Baryshkov (3):
meson: pass -target and -I to bindgen calls
mesa: drop the bindgen patch
mesa: bundle Clang OpenCL headers into meta-clcmeta/classes-recipe/meson.bbclass | 1 + ...d-an-option-to-force-inclusion-of-OpenCL-.patch | 57 ++++++++++++++++++ ...vide-cross-compilation-arguments-to-LLVM-.patch | 67 ---------------------- meta/recipes-graphics/mesa/mesa.inc | 9 +-- 4 files changed, 61 insertions(+), 73 deletions(-)---
base-commit:53c772c941d5ce69ab89f35cd04724b740daf269
change-id: 20250411-mesa-25-fixes-5a38fe55dd3cBest regards,
--
Dmitry Baryshkov <[email protected]>-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#215115): https://lists.openembedded.org/g/openembedded-core/message/215115
Mute This Topic: https://lists.openembedded.org/mt/112324544/1997914
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-
Quoted 11 lines · Khem Raj
Hi Dmitry
I have picked these patch into clang-merge-2 branch.
https://web.git.yoctoproject.org/poky-contrib/log/?h=kraj/clang-merge-2
They help with some mesa-native build failures however, I am still seeing a build failure build mesa-native
on musl targets. I am not sure why target should matter but it seems to see the error
Note, the error is about 'required file', it usually means that the dynamic loader is not found.
I'll try reproducing it locally.
Quoted 6 lines
https://autobuilder.yoctoproject.org/valkyrie/#/builders/111/builds/150
Error is that
mesa_clcis not available before its use. Interestingly, it never fails locally here but it always fails on AB. Is there some sort of build race or something else going on?
And this is usually because there was a uninative-enabled build in sstate cache which is now being reused for the non-uninative. Let's see if I can reproduce it...
Quoted 45 lines
Would appreciate help.
Quoted 40 lines · Dmitry Baryshkov via lists.openembedded.org
Several bugfixes after Mesa 25.0 recipe was merged:
- Replace the bindgen patches with meson-based fix (Dylan Baker)
- Bundle OpenCL C headersSigned-off-by Dmitry Baryshkov <[email protected]>---
Changes in v2:
- Dropped applied patches
- Add the bundle-opencl-headers patch
- Link to v1: https://lore.kernel.org/r/[email protected]---
Dmitry Baryshkov (3):
meson: pass -target and -I to bindgen calls
mesa: drop the bindgen patch
mesa: bundle Clang OpenCL headers into meta-clcmeta/classes-recipe/meson.bbclass | 1 + ...d-an-option-to-force-inclusion-of-OpenCL-.patch | 57 ++++++++++++++++++ ...vide-cross-compilation-arguments-to-LLVM-.patch | 67 ---------------------- meta/recipes-graphics/mesa/mesa.inc | 9 +-- 4 files changed, 61 insertions(+), 73 deletions(-)---
base-commit:53c772c941d5ce69ab89f35cd04724b740daf269
change-id: 20250411-mesa-25-fixes-5a38fe55dd3cBest regards,
--
Dmitry Baryshkov <[email protected]>-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#215115): https://lists.openembedded.org/g/openembedded-core/message/215115
Mute This Topic: https://lists.openembedded.org/mt/112324544/1997914
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-
Signature · 2 lines
With best wishes Dmitry
Quoted 20 lines · Dmitry Baryshkov
Quoted 11 lines · Khem Raj
Hi Dmitry
I have picked these patch into clang-merge-2 branch.
https://web.git.yoctoproject.org/poky-contrib/log/?h=kraj/clang-merge-2
They help with some mesa-native build failures however, I am still seeing a build failure build mesa-native
on musl targets. I am not sure why target should matter but it seems to see the errorNote, the error is about 'required file', it usually means that the dynamic loader is not found.
I'll try reproducing it locally.
Quoted 7 lines
Quoted 3 lines
Error is that
mesa_clcis not available before its use. Interestingly, it never fails locally here but it always fails on AB. Is there some sort of build race or something else going on?And this is usually because there was a uninative-enabled build in sstate cache which is now being reused for the non-uninative. Let's see if I can reproduce it...
Its in right direction, I could get the information from the worker machine
build-renamed/tmp/work/x86_64-linux/mesa-native/25.0.2$ ./build/src/compiler/clc/mesa_clc -bash: ./build/src/compiler/clc/mesa_clc: cannot execute: required file not found
if dump the ELF headers it looks for interpreter from a uninative path which is absolute and points to the location where it was built in another build
[Requesting program interpreter:/srv/pokybuild/yocto-worker/meta-oe/build/build/tmp/sysroots-uninative/x86_64-linux/lib/ld-linux-x86-64.so.2]
This file does not exist in current build.
Quoted 49 lines
Quoted 46 lines
Would appreciate help.
Quoted 40 lines · Dmitry Baryshkov via lists.openembedded.org
Several bugfixes after Mesa 25.0 recipe was merged:
- Replace the bindgen patches with meson-based fix (Dylan Baker)
- Bundle OpenCL C headersSigned-off-by Dmitry Baryshkov <[email protected]>---
Changes in v2:
- Dropped applied patches
- Add the bundle-opencl-headers patch
- Link to v1: https://lore.kernel.org/r/[email protected]---
Dmitry Baryshkov (3):
meson: pass -target and -I to bindgen calls
mesa: drop the bindgen patch
mesa: bundle Clang OpenCL headers into meta-clcmeta/classes-recipe/meson.bbclass | 1 + ...d-an-option-to-force-inclusion-of-OpenCL-.patch | 57 ++++++++++++++++++ ...vide-cross-compilation-arguments-to-LLVM-.patch | 67 ---------------------- meta/recipes-graphics/mesa/mesa.inc | 9 +-- 4 files changed, 61 insertions(+), 73 deletions(-)---
base-commit:53c772c941d5ce69ab89f35cd04724b740daf269
change-id: 20250411-mesa-25-fixes-5a38fe55dd3cBest regards,
--
Dmitry Baryshkov <[email protected]>-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#215115): https://lists.openembedded.org/g/openembedded-core/message/215115
Mute This Topic: https://lists.openembedded.org/mt/112324544/1997914
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-
Quoted 35 lines · Khem Raj
Quoted 20 lines · Dmitry Baryshkov
Quoted 11 lines · Khem Raj
Hi Dmitry
I have picked these patch into clang-merge-2 branch.
https://web.git.yoctoproject.org/poky-contrib/log/?h=kraj/clang-merge-2
They help with some mesa-native build failures however, I am still seeing a build failure build mesa-native
on musl targets. I am not sure why target should matter but it seems to see the errorNote, the error is about 'required file', it usually means that the dynamic loader is not found.
I'll try reproducing it locally.Quoted 7 lines
Quoted 3 lines
Error is that
mesa_clcis not available before its use. Interestingly, it never fails locally here but it always fails on AB. Is there some sort of build race or something else going on?And this is usually because there was a uninative-enabled build in sstate cache which is now being reused for the non-uninative. Let's see if I can reproduce it...
Its in right direction, I could get the information from the worker machine
build-renamed/tmp/work/x86_64-linux/mesa-native/25.0.2$ ./build/src/ compiler/clc/mesa_clc -bash: ./build/src/compiler/clc/mesa_clc: cannot execute: required file
not found
Quoted 7 lines
if dump the ELF headers it looks for interpreter from a uninative path which is absolute and points to the location where it was built in another build
[Requesting program interpreter:
/srv/pokybuild/yocto-worker/
meta-oe/build/build/tmp/sysroots-uninative/x86_64-linux/lib/ld-linux- x86-64.so.2]This file does not exist in current build.
I think I got the problem, its ldflags being injected from llvm-config containing the buildtime paths where llvm/clang-native was built in, you have sent a patch to fix it which is already applied to core, I missed applying it to clang :(. I have applied it to all clang variants since we use shared sources for all clang recipes, we need to keep source tree in sync for all of them, also pushed it into the kraj/clang-merge-2 branch now. I think this should get us through this bump.
Would be good, to get some more feedback on how it plays out in your testing.
Quoted 54 lines
Quoted 54 lines
Quoted 51 lines
Would appreciate help.
Quoted 43 lines · Dmitry Baryshkov via lists.openembedded.org
Several bugfixes after Mesa 25.0 recipe was merged:
- Replace the bindgen patches with meson-based fix (Dylan Baker)
- Bundle OpenCL C headersSigned-off-by Dmitry Baryshkov <[email protected]>---
Changes in v2:
- Dropped applied patches
- Add the bundle-opencl-headers patch
- Link to v1: https://lore.kernel.org/r/20250412-mesa-25-fixes-
[email protected]---
Dmitry Baryshkov (3):
meson: pass -target and -I to bindgen calls
mesa: drop the bindgen patch
mesa: bundle Clang OpenCL headers into meta-clcmeta/classes-recipe/meson.bbclass | 1 + ...d-an-option-to-force-inclusion-of-OpenCL-.patch | 57 ++++++++++
++++++++
...vide-cross-compilation-arguments-to-LLVM-.patch | 67
----------------------
meta/recipes-graphics/mesa/mesa.inc | 9 +--4 files changed, 61 insertions(+), 73 deletions(-)---
base-commit:53c772c941d5ce69ab89f35cd04724b740daf269
change-id: 20250411-mesa-25-fixes-5a38fe55dd3cBest regards,
Signature · 10 lines
Dmitry Baryshkov <[email protected]> -=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#215115): https://lists.openembedded.org/g/ openembedded-core/message/215115 Mute This Topic: https://lists.openembedded.org/mt/112324544/1997914 Group Owner: [email protected] Unsubscribe: https://lists.openembedded.org/g/openembedded-core/ unsub [[email protected]] -=-=-=-=-=-=-=-=-=-=-=-