diff options
| -rw-r--r-- | meta/recipes-graphics/mesa/files/0001-rusticl-provide-cross-compilation-arguments-to-LLVM-.patch | 67 | ||||
| -rw-r--r-- | meta/recipes-graphics/mesa/mesa.inc | 21 |
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 @@ | |||
| 1 | From b9cf34f39ca7e7546508ce2ab1f053edef5fc201 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com> | ||
| 3 | Date: Wed, 26 Mar 2025 17:47:09 +0200 | ||
| 4 | Subject: [PATCH] rusticl: provide cross-compilation arguments to LLVM bindgen | ||
| 5 | invocation | ||
| 6 | |||
| 7 | Correctly generating LLVM bindings requires several croos-compilation | ||
| 8 | arguments. Provide them to rust.bindgen(). Karol Herbst on IRC suggested | ||
| 9 | that a proper fix should be to fix meson's rust.bindgen() to support | ||
| 10 | cross-compilation. Carry this patch until meson is fixed. | ||
| 11 | |||
| 12 | Upstream-Status: Inappropriate [OE-Specific] | ||
| 13 | Link: https://github.com/mesonbuild/meson/issues/13591 | ||
| 14 | Signed-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 | |||
| 20 | diff --git a/meson_options.txt b/meson_options.txt | ||
| 21 | index 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 | + ) | ||
| 42 | diff --git a/src/gallium/frontends/rusticl/meson.build b/src/gallium/frontends/rusticl/meson.build | ||
| 43 | index 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 | ||
| 23 | SRC_URI[sha256sum] = "adf904d083b308df95898600ffed435f4b5c600d95fb6ec6d4c45638627fdc97" | 24 | SRC_URI[sha256sum] = "adf904d083b308df95898600ffed435f4b5c600d95fb6ec6d4c45638627fdc97" |
| @@ -46,7 +47,7 @@ PROVIDES = " \ | |||
| 46 | virtual/mesa \ | 47 | virtual/mesa \ |
| 47 | " | 48 | " |
| 48 | 49 | ||
| 49 | inherit meson pkgconfig python3native gettext features_check | 50 | inherit meson pkgconfig python3native gettext features_check rust |
| 50 | 51 | ||
| 51 | BBCLASSEXTEND = "native nativesdk" | 52 | BBCLASSEXTEND = "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" | ||
| 90 | INHIBIT_DEFAULT_RUST_DEPS = "${@bb.utils.contains('PACKAGECONFIG', 'opencl', '', '1', d)}" | ||
| 91 | |||
| 88 | PACKAGECONFIG:append:x86 = " libclc gallium-llvm" | 92 | PACKAGECONFIG:append:x86 = " libclc gallium-llvm" |
| 89 | PACKAGECONFIG:append:x86-64 = " libclc gallium-llvm" | 93 | PACKAGECONFIG:append:x86-64 = " libclc gallium-llvm" |
| 90 | PACKAGECONFIG:append:i686 = " libclc gallium-llvm" | 94 | PACKAGECONFIG: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" |
| 145 | PACKAGECONFIG[egl] = "-Degl=enabled, -Degl=disabled" | 149 | PACKAGECONFIG[egl] = "-Degl=enabled, -Degl=disabled" |
| 146 | 150 | ||
| 151 | BINDGEN_TARGET = "${TARGET_ARCH}-${TARGET_OS}${@['-gnu', ''][d.getVar('LIBCEXTENSION') != '']}" | ||
| 152 | BINDGEN_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. |
| 149 | PACKAGECONFIG[opencl] = "-Dgallium-opencl=icd,-Dgallium-opencl=disabled," | 156 | PACKAGECONFIG[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 | ||
| 151 | PACKAGECONFIG[broadcom] = "" | 162 | PACKAGECONFIG[broadcom] = "" |
| 152 | PACKAGECONFIG[etnaviv] = ",,python3-pycparser-native" | 163 | PACKAGECONFIG[etnaviv] = ",,python3-pycparser-native" |
| @@ -249,7 +260,7 @@ RDEPENDS:libgles3-mesa-dev += "libgles2-mesa-dev" | |||
| 249 | RDEPENDS:libgles2-mesa += "libgles3-mesa" | 260 | RDEPENDS:libgles2-mesa += "libgles3-mesa" |
| 250 | ALLOW_EMPTY:libgles3-mesa = "1" | 261 | ALLOW_EMPTY:libgles3-mesa = "1" |
| 251 | 262 | ||
| 252 | RDEPENDS:libopencl-mesa += "${@bb.utils.contains('PACKAGECONFIG', 'opencl', 'libclc spirv-tools', '', d)}" | 263 | RDEPENDS:libopencl-mesa += "${@bb.utils.contains('PACKAGECONFIG', 'opencl', 'libclc spirv-tools spirv-llvm-translator', '', d)}" |
| 253 | 264 | ||
| 254 | PACKAGES =+ "libegl-mesa libegl-mesa-dev \ | 265 | PACKAGES =+ "libegl-mesa libegl-mesa-dev \ |
| 255 | libosmesa libosmesa-dev \ | 266 | libosmesa libosmesa-dev \ |
| @@ -355,7 +366,7 @@ FILES:libgles1-mesa = "${libdir}/libGLESv1*.so.*" | |||
| 355 | FILES:libgles2-mesa = "${libdir}/libGLESv2.so.*" | 366 | FILES:libgles2-mesa = "${libdir}/libGLESv2.so.*" |
| 356 | FILES:libgl-mesa = "${libdir}/libGL.so.*" | 367 | FILES:libgl-mesa = "${libdir}/libGL.so.*" |
| 357 | FILES:libglx-mesa = "${libdir}/libGLX*.so.*" | 368 | FILES:libglx-mesa = "${libdir}/libGLX*.so.*" |
| 358 | FILES:libopencl-mesa = "${libdir}/libMesaOpenCL.so.* ${libdir}/gallium-pipe/*.so ${sysconfdir}/OpenCL/vendors/mesa.icd" | 369 | FILES:libopencl-mesa = "${libdir}/lib*OpenCL.so.* ${libdir}/gallium-pipe/*.so ${sysconfdir}/OpenCL/vendors/*.icd" |
| 359 | FILES:libglapi = "${libdir}/libglapi.so.*" | 370 | FILES:libglapi = "${libdir}/libglapi.so.*" |
| 360 | FILES:libosmesa = "${libdir}/libOSMesa.so.*" | 371 | FILES:libosmesa = "${libdir}/libOSMesa.so.*" |
| 361 | FILES:libxatracker = "${libdir}/libxatracker.so.*" | 372 | FILES:libxatracker = "${libdir}/libxatracker.so.*" |
| @@ -369,7 +380,7 @@ FILES:libglapi-dev = "${libdir}/libglapi.*" | |||
| 369 | FILES:libgles1-mesa-dev = "${libdir}/libGLESv1*.* ${includedir}/GLES ${libdir}/pkgconfig/glesv1*.pc" | 380 | FILES:libgles1-mesa-dev = "${libdir}/libGLESv1*.* ${includedir}/GLES ${libdir}/pkgconfig/glesv1*.pc" |
| 370 | FILES:libgles2-mesa-dev = "${libdir}/libGLESv2.* ${includedir}/GLES2 ${libdir}/pkgconfig/glesv2.pc" | 381 | FILES:libgles2-mesa-dev = "${libdir}/libGLESv2.* ${includedir}/GLES2 ${libdir}/pkgconfig/glesv2.pc" |
| 371 | FILES:libgles3-mesa-dev = "${includedir}/GLES3" | 382 | FILES:libgles3-mesa-dev = "${includedir}/GLES3" |
| 372 | FILES:libopencl-mesa-dev = "${libdir}/libMesaOpenCL.so" | 383 | FILES:libopencl-mesa-dev = "${libdir}/lib*OpenCL.so" |
| 373 | FILES:libosmesa-dev = "${libdir}/libOSMesa.* ${includedir}/GL/osmesa.h ${libdir}/pkgconfig/osmesa.pc" | 384 | FILES:libosmesa-dev = "${libdir}/libOSMesa.* ${includedir}/GL/osmesa.h ${libdir}/pkgconfig/osmesa.pc" |
| 374 | FILES:libxatracker-dev = "${libdir}/libxatracker.so ${libdir}/libxatracker.la \ | 385 | FILES: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 \ |
