mesa: upgrade to 25.0.2
cover mesa: upgrade to 25.0.2
libclc is required in order to build Intel drivers in Mesa 24.1 and later. Thus OE-Core is currently locked to the 24.0.x branch, which is no longer maintained, having last release in June 2024.
A clean solution is to package Clang, then use it to build libclc and SPIRV-LLVM-Translator (required for Mesa OpenCL support). However creating proper recipes for Clang is a long process (ongoing by Khem Raj).
This patchset attempts to solve the issue in a simpler way: by building libclc and SPIRV-LLVM-Translator together with the LLVM. This way we don't have to create target Clang recipes, there is no extra toolchain to support, etc. Clang binaries are creted as a part of the build process (in order to support building target packages), however it only hits the LLVM sysroot-native and is only used by the LLVM target build.
Future work by Khem (once Clang is properly supported in OE-Core) should allow us to create proper recipes for libclc and spirv-llvm-translator and drop them from the llvm / clang recipe.
I think this approach provides a good balance between OE-Core being stuck with the outdated Mesa release and being able to upgrade it, bringing support for new hardware.
Last two patches of the series bring in RustiCL support, a new OpenCL implementation within Mesa. They are optional for the sake of the upgrade and can be dropped if there is any issue with those. RustiCL support is mostly compile-tested at this point.
Dmitry Baryshkov (7):
llvm: move libLLVM.so.N.M to llvm-libllvm package
llvm: use OECMAKE_SOURCEPATH to specify cmake dir
llvm: support building libclc
llvm: import YOCTO_ALTERNATE_LIBDIR patch from meta-clang
llvm: add SPIRV-LLVM-Translator support
mesa: upgrade 24.0.7 -> 25.0.2
bindgen-cli: a tool to generate Rust bindings
Zoltán Böszörményi (1):
mesa: add support for RustiCL under PACKAGECONFIG "opencl"
meta/conf/distro/include/maintainers.inc | 1 + .../bindgen-cli/bindgen-cli-crates.inc | 186 ++++++++++++++++++ .../bindgen-cli/bindgen-cli_0.71.1.bb | 19 ++ ...ossCompile-pass-SPIR-V-headers-path-.patch | 40 ++++ ...-llvm-allow-env-override-of-exe-path.patch | 41 +++- .../llvm/llvm/fix-native-compilation.patch | 67 +++++++ meta/recipes-devtools/llvm/llvm/llvm-config | 7 + .../llvm/llvm/spirv-internal-build.patch | 27 +++ meta/recipes-devtools/llvm/llvm_20.1.0.bb | 76 ++++++- ...-meson-do-not-pull-in-clc-for-clover.patch | 53 ----- ...lude-missing-llvm-IR-header-Module.h.patch | 41 ---- .../0001-drisw-fix-build-without-dri3.patch | 58 ------ ...on-t-encode-build-path-into-binaries.patch | 46 ++++- ...son-use-target-path-for-Clang-libdir.patch | 42 ++++ ...cross-compilation-arguments-to-LLVM-.patch | 64 ++++++ ...on-t-try-zink-if-not-enabled-in-mesa.patch | 42 ---- meta/recipes-graphics/mesa/mesa.inc | 103 +++++----- 17 files changed, 656 insertions(+), 257 deletions(-) create mode 100644 meta/recipes-devtools/bindgen-cli/bindgen-cli-crates.inc create mode 100644 meta/recipes-devtools/bindgen-cli/bindgen-cli_0.71.1.bb create mode 100644 meta/recipes-devtools/llvm/llvm/0001-cmake-modules-CrossCompile-pass-SPIR-V-headers-path-.patch create mode 100644 meta/recipes-devtools/llvm/llvm/fix-native-compilation.patch create mode 100644 meta/recipes-devtools/llvm/llvm/spirv-internal-build.patch delete mode 100644 meta/recipes-graphics/mesa/files/0001-Revert-meson-do-not-pull-in-clc-for-clover.patch delete mode 100644 meta/recipes-graphics/mesa/files/0001-amd-Include-missing-llvm-IR-header-Module.h.patch delete mode 100644 meta/recipes-graphics/mesa/files/0001-drisw-fix-build-without-dri3.patch create mode 100644 meta/recipes-graphics/mesa/files/0001-meson-use-target-path-for-Clang-libdir.patch create mode 100644 meta/recipes-graphics/mesa/files/0001-rusticl-provide-cross-compilation-arguments-to-LLVM-.patch delete mode 100644 meta/recipes-graphics/mesa/files/0002-glxext-don-t-try-zink-if-not-enabled-in-mesa.patch
Signature · 1 line
2.39.5
PATCH 1/8 llvm: move libLLVM.so.N.M to llvm-libllvm package
Neither MAJOR_VER nor MINOR_VER are defined, so libLLVM.so.N.M ends up in the main libllvm package rather than the llvm-libllvm package, as expected. Fix this by properly using two-component version.
--- meta/recipes-devtools/llvm/llvm_20.1.0.bb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
meta/recipes-devtools/llvm/llvm_20.1.0.bb +2 -1
@@ -19,6 +19,7 @@ VER_SUFFIX = "" PV .= "${VER_SUFFIX}" MAJOR_VERSION = "${@oe.utils.trim_version("${PV}", 1)}" +MAJ_MIN_VERSION = "${@oe.utils.trim_version("${PV}", 2)}" LLVM_RELEASE = "${PV}"
@@ -152,7 +153,7 @@ FILES:${PN}-bugpointpasses = "\ FILES:${PN}-libllvm = "\ ${libdir}/libLLVM-${MAJOR_VERSION}.so \ - ${libdir}/libLLVM.so.${MAJOR_VER}.${MINOR_VER} \ + ${libdir}/libLLVM.so.${MAJ_MIN_VERSION} \ " FILES:${PN}-liblto += "\
Signature · 1 line
2.39.5
PATCH 2/8 llvm: use OECMAKE_SOURCEPATH to specify cmake dir
In reply to Dmitry BaryshkovInstead of pushing an llvm sourcedir into S, specify it through the OECMAKE_SOURCEPATH so that all the patches are applied to the topdir and debug paths also use top path to map.
--- meta/recipes-devtools/llvm/llvm_20.1.0.bb | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
meta/recipes-devtools/llvm/llvm_20.1.0.bb +5 -3
@@ -24,15 +24,17 @@ MAJ_MIN_VERSION = "${@oe.utils.trim_version("${PV}", 2)}" LLVM_RELEASE = "${PV}" SRC_URI = "https://github.com/llvm/llvm-project/releases/download/llvmorg-${PV}/llvm-project-${PV}.src.tar.xz \ - file://0007-llvm-allow-env-override-of-exe-path.patch;striplevel=2 \ - file://0001-AsmMatcherEmitter-sort-ClassInfo-lists-by-name-as-we.patch;striplevel=2 \ + file://0007-llvm-allow-env-override-of-exe-path.patch \ + file://0001-AsmMatcherEmitter-sort-ClassInfo-lists-by-name-as-we.patch \ file://llvm-config \ " SRC_URI[sha256sum] = "4579051e3c255fb4bb795d54324f5a7f3ef79bd9181e44293d7ee9a7f62aad9a" UPSTREAM_CHECK_URI = "https://github.com/llvm/llvm-project" UPSTREAM_CHECK_REGEX = "llvmorg-(?P<pver>\d+(\.\d+)+)" -S = "${WORKDIR}/llvm-project-${PV}.src/llvm" +S = "${WORKDIR}/llvm-project-${PV}.src" + +OECMAKE_SOURCEPATH = "${S}/llvm" LLVM_INSTALL_DIR = "${WORKDIR}/llvm-install"
Signature · 1 line
2.39.5
PATCH 3/8 llvm: support building libclc
In reply to Dmitry BaryshkovCurrent Mesa requires libclc in order to build Intel Gallium (iris) or Vulkan drivers. In order to unblock Mesa updates, build libclc (and clang) as a part of the build process. Don't install clang into the target system, it is only used during the build process. Proper handling of clang as a toolchain is a separate and much more complicated topic.
--- .../llvm/llvm/fix-native-compilation.patch | 67 +++++++++++++++++++ meta/recipes-devtools/llvm/llvm_20.1.0.bb | 43 ++++++++++-- 2 files changed, 106 insertions(+), 4 deletions(-) create mode 100644 meta/recipes-devtools/llvm/llvm/fix-native-compilation.patch
meta/recipes-devtools/llvm/llvm/fix-native-compilation.patch new file +67 -0
@@ -0,0 +1,67 @@ +From e94e529aefb28b65165e978daa2bfd89867ee8d0 Mon Sep 17 00:00:00 2001 +From: Dmitry Baryshkov <[email protected]> +Date: Fri, 21 Mar 2025 17:17:52 +0200 +Subject: [PATCH] cmake/modules/CrossCompile: fix NATIVE build setup + +Fix variables being passed to cmake when generating NATIVE build dir. + +Upstream-Status: Inappropriate [OE-Specific build-system fix] +Signed-off-by: Dmitry Baryshkov <[email protected]> + +Index: llvm-project-20.1.0.src/llvm/cmake/modules/CrossCompile.cmake +=================================================================== +--- llvm-project-20.1.0.src.orig/llvm/cmake/modules/CrossCompile.cmake ++++ llvm-project-20.1.0.src/llvm/cmake/modules/CrossCompile.cmake +@@ -23,19 +23,37 @@ function(llvm_create_cross_target projec + if (EXISTS ${LLVM_MAIN_SRC_DIR}/cmake/platforms/${toolchain}.cmake) + set(CROSS_TOOLCHAIN_FLAGS_INIT + -DCMAKE_TOOLCHAIN_FILE=\"${LLVM_MAIN_SRC_DIR}/cmake/platforms/${toolchain}.cmake\") ++ elseif (${target_name} STREQUAL NATIVE) ++ set(CROSS_TOOLCHAIN_FLAGS_INIT ++ -DCMAKE_C_COMPILER=\"${LLVM_NATIVE_C_COMPILER}\" ++ -DCMAKE_CXX_COMPILER=\"${LLVM_NATIVE_CXX_COMPILER}\" ++ -DCMAKE_C_FLAGS=\"${LLVM_NATIVE_C_FLAGS}\" ++ -DCMAKE_CXX_FLAGS=\"${LLVM_NATIVE_CXX_FLAGS}\" ++ -DCMAKE_EXE_LINKER_FLAGS=\"${LLVM_NATIVE_LD_FLAGS}\" ++ ) + elseif (NOT CMAKE_CROSSCOMPILING) + set(CROSS_TOOLCHAIN_FLAGS_INIT + -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} + -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} + ) + endif() + set(CROSS_TOOLCHAIN_FLAGS_${target_name} ${CROSS_TOOLCHAIN_FLAGS_INIT} + CACHE STRING "Toolchain configuration for ${target_name}") + + # project specific version of the flags up above + set(CROSS_TOOLCHAIN_FLAGS_${project_name}_${target_name} "" + CACHE STRING "Toolchain configuration for ${project_name}_${target_name}") + ++ if (${target_name} STREQUAL NATIVE) ++ set(cross_flags ++ "-DLLVM_DEFAULT_TARGET_TRIPLE='${LLVM_NATIVE_TRIPLE}'") ++ else() ++ set(cross_flags ++ "-DLLVM_DEFAULT_TARGET_TRIPLE='${LLVM_TARGET_TRIPLE}'" ++ "-DLLVM_TARGET_ARCH='${LLVM_TARGET_ARCH}'" ++ "-DLLVM_TARGET_IS_CROSSCOMPILE_HOST=TRUE") ++ endif() ++ + if (buildtype) + set(build_type_flags "-DCMAKE_BUILD_TYPE=${buildtype}") + endif() +@@ -91,12 +111,11 @@ function(llvm_create_cross_target projec + -DCMAKE_C_COMPILER_LAUNCHER="${CMAKE_C_COMPILER_LAUNCHER}" + -DCMAKE_CXX_COMPILER_LAUNCHER="${CMAKE_CXX_COMPILER_LAUNCHER}" + ${CROSS_TOOLCHAIN_FLAGS_${target_name}} ${CMAKE_CURRENT_SOURCE_DIR} ++ #${CROSS_TOOLCHAIN_FLAGS_INIT} ${CMAKE_CURRENT_SOURCE_DIR} + ${CROSS_TOOLCHAIN_FLAGS_${project_name}_${target_name}} +- -DLLVM_TARGET_IS_CROSSCOMPILE_HOST=TRUE ++ ${cross_flags} + -DLLVM_TARGETS_TO_BUILD="${targets_to_build_arg}" + -DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD="${experimental_targets_to_build_arg}" +- -DLLVM_DEFAULT_TARGET_TRIPLE="${LLVM_TARGET_TRIPLE}" +- -DLLVM_TARGET_ARCH="${LLVM_TARGET_ARCH}" + -DLLVM_ENABLE_PROJECTS="${llvm_enable_projects_arg}" + -DLLVM_EXTERNAL_PROJECTS="${llvm_external_projects_arg}" + -DLLVM_ENABLE_RUNTIMES="${llvm_enable_runtimes_arg}"
meta/recipes-devtools/llvm/llvm_20.1.0.bb +39 -4
110 lines not on this page · raw message
Signature · 1 line
2.39.5
PATCH 4/8 llvm: import YOCTO_ALTERNATE_LIBDIR patch from meta-clang
In reply to Dmitry BaryshkovCross-building of mesa requires us to be able to provide target-specific value for --libdir. Update the cross-environment llvm-config patch from meta-clang in order to allow overriding the --libdir output.
--- ...-llvm-allow-env-override-of-exe-path.patch | 41 +++++++++++++++++-- meta/recipes-devtools/llvm/llvm/llvm-config | 7 ++++ 2 files changed, 45 insertions(+), 3 deletions(-)
meta/recipes-devtools/llvm/llvm/0007-llvm-allow-env-override-of-exe-path.patch +38 -3
@@ -8,16 +8,18 @@ return the libraries, include directories, etc. from inside the sysroot rather than from the native sysroot. Thus provide an env override for calling llvm-config from a target sysroot. +Add YOCTO_ALTERNATE_LIBDIR and YOCTO_ALTERNATE_EXE_PATH env variables + Upstream-Status: Inappropriate [OE-specific] Signed-off-by: Martin Kelly <[email protected]> Signed-off-by: Khem Raj <[email protected]> --- - llvm/tools/llvm-config/llvm-config.cpp | 7 +++++++ - 1 file changed, 7 insertions(+) + llvm/tools/llvm-config/llvm-config.cpp | 25 +++++++++++++++++++------ + 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/llvm/tools/llvm-config/llvm-config.cpp b/llvm/tools/llvm-config/llvm-config.cpp -index d5b76b1bb..6c28c34bc 100644 +index d5b76b1bb6c1..a739f0d8dbea 100644 --- a/llvm/tools/llvm-config/llvm-config.cpp +++ b/llvm/tools/llvm-config/llvm-config.cpp @@ -246,6 +246,13 @@ Typical components:\n\
@@ -34,3 +36,36 @@ index d5b76b1bb..6c28c34bc 100644 // This just needs to be some symbol in the binary; C++ doesn't // allow taking the address of ::main however. void *P = (void *)(intptr_t)GetExecutablePath; +@@ -325,7 +332,7 @@ int main(int argc, char **argv) { + // Compute various directory locations based on the derived location + // information. + std::string ActivePrefix, ActiveBinDir, ActiveIncludeDir, ActiveLibDir, +- ActiveCMakeDir; ++ ActiveCMakeDir, BaseLibDir; + std::string ActiveIncludeOption; + if (IsInDevelopmentTree) { + ActiveIncludeDir = std::string(LLVM_SRC_ROOT) + "/include"; +@@ -366,12 +373,18 @@ int main(int argc, char **argv) { + sys::fs::make_absolute(ActivePrefix, Path); + ActiveBinDir = std::string(Path); + } +- ActiveLibDir = ActivePrefix + "/lib" + LLVM_LIBDIR_SUFFIX; +- { +- SmallString<256> Path(LLVM_INSTALL_PACKAGE_DIR); +- sys::fs::make_absolute(ActivePrefix, Path); +- ActiveCMakeDir = std::string(Path); ++ // Hack for Yocto: we need to override the lib path when we are using ++ // llvm-config from within a target sysroot since LLVM_LIBDIR_SUFFIX ++ // maybe different for host llvm vs target e.g. ppc64 Libdir=lib64 but ++ // x86_64 Libdir = lib ++ const char *YoctoLibDir = std::getenv("YOCTO_ALTERNATE_LIBDIR"); ++ if (YoctoLibDir != nullptr) { ++ BaseLibDir = std::string(YoctoLibDir); ++ } else { ++ BaseLibDir = std::string("/lib") + LLVM_LIBDIR_SUFFIX; + } ++ ActiveLibDir = ActivePrefix + BaseLibDir; ++ ActiveCMakeDir = ActiveLibDir + "/cmake/llvm"; + ActiveIncludeOption = "-I" + ActiveIncludeDir; + } +
meta/recipes-devtools/llvm/llvm/llvm-config +7 -0
@@ -9,6 +9,13 @@ # Provide ours from the environment instead. NEXT_LLVM_CONFIG="$(which -a llvm-config | sed -n 2p)" +SCRIPT_DIR="$(dirname "$(readlink -f "$0")")" +export YOCTO_ALTERNATE_EXE_PATH="${YOCTO_ALTERNATE_EXE_PATH:="$(readlink -f "$SCRIPT_DIR/../llvm-config")"}" +if [ -n "$( echo $base_libdir | sed -n '/lib64/p')" ]; then + export YOCTO_ALTERNATE_LIBDIR="${YOCTO_ALTERNATE_LIBDIR:="/lib64"}" +else + export YOCTO_ALTERNATE_LIBDIR="${YOCTO_ALTERNATE_LIBDIR:="/lib"}" +fi if [[ $# == 0 ]]; then exec "$NEXT_LLVM_CONFIG" fi
Signature · 1 line
2.39.5
PATCH 5/8 llvm: add SPIRV-LLVM-Translator support
In reply to Dmitry BaryshkovMesa builds require SPIRV-LLVM-Translator in order to build CLC support. While it is possible to build it separately (like meta-clang does), it also requires a separate clang compiler (which OE-Core doesn't provide).
Use an alternative path and build SPIRV-LLVM-Translator as a part of the LLVM build process, lifting the requirement for the separate clang. Once clang is properly integrated into the OE-Core layer, this can be split to a separate package and dropped.
--- ...ossCompile-pass-SPIR-V-headers-path-.patch | 40 +++++++++++++++++++ .../llvm/llvm/spirv-internal-build.patch | 27 +++++++++++++ meta/recipes-devtools/llvm/llvm_20.1.0.bb | 32 ++++++++++++--- 3 files changed, 94 insertions(+), 5 deletions(-) create mode 100644 meta/recipes-devtools/llvm/llvm/0001-cmake-modules-CrossCompile-pass-SPIR-V-headers-path-.patch create mode 100644 meta/recipes-devtools/llvm/llvm/spirv-internal-build.patch
meta/recipes-devtools/llvm/llvm/0001-cmake-modules-CrossCompile-pass-SPIR-V-headers-path-.patch new file +40 -0
@@ -0,0 +1,40 @@ +From e94e529aefb28b65165e978daa2bfd89867ee8d0 Mon Sep 17 00:00:00 2001 +From: Dmitry Baryshkov <[email protected]> +Date: Fri, 21 Mar 2025 17:17:52 +0200 +Subject: [PATCH] cmake/modules/CrossCompile: pass SPIR-V headers path to + native build + +In case LLVM is being built together with SPIRV-LLVM-Translator, it +might be required to pass LLVM_EXTERNAL_SPIRV_HEADERS_SOURCE_DIR define +to the native build too. Extend native build setup to pass that variable +to the called cmake too. + +Upstream-Status: Inappropriate [OE-Specific build-system fix] +Signed-off-by: Dmitry Baryshkov <[email protected]> +--- + llvm/cmake/modules/CrossCompile.cmake | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/llvm/cmake/modules/CrossCompile.cmake b/llvm/cmake/modules/CrossCompile.cmake +index 3b31d3e218a3..24b62f4ff8af 100644 +--- a/llvm/cmake/modules/CrossCompile.cmake ++++ b/llvm/cmake/modules/CrossCompile.cmake +@@ -81,6 +81,10 @@ function(llvm_create_cross_target project_name target_name toolchain buildtype) + set(libc_flags -DLLVM_LIBC_GPU_BUILD=ON) + endif() + ++ if (LLVM_EXTERNAL_SPIRV_HEADERS_SOURCE_DIR) ++ set(spirv_headers "-DLLVM_EXTERNAL_SPIRV_HEADERS_SOURCE_DIR=${LLVM_EXTERNAL_SPIRV_HEADERS_SOURCE_DIR}") ++ endif() ++ + add_custom_command(OUTPUT ${${project_name}_${target_name}_BUILD}/CMakeCache.txt + COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" + -DCMAKE_MAKE_PROGRAM="${CMAKE_MAKE_PROGRAM}" +@@ -101,6 +105,7 @@ function(llvm_create_cross_target project_name target_name toolchain buildtype) + -DLLVM_INCLUDE_BENCHMARKS=OFF + -DLLVM_INCLUDE_TESTS=OFF + ${build_type_flags} ${linker_flag} ${external_clang_dir} ${libc_flags} ++ ${spirv_headers} + ${ARGN} + WORKING_DIRECTORY ${${project_name}_${target_name}_BUILD} + DEPENDS CREATE_${project_name}_${target_name}
meta/recipes-devtools/llvm/llvm/spirv-internal-build.patch new file +27 -0
@@ -0,0 +1,27 @@ +From e94e529aefb28b65165e978daa2bfd89867ee8d0 Mon Sep 17 00:00:00 2001 +From: Dmitry Baryshkov <[email protected]> +Date: Fri, 21 Mar 2025 17:17:52 +0200 +Subject: [PATCH] SPIRV-LLVM-Translator: fix handling of built-in SPIRV targer + +Upstream-Status: Pending +Signed-off-by: Dmitry Baryshkov <[email protected]> + +Index: llvm-project-20.1.0.src/llvm/projects/SPIRV-LLVM-Translator/CMakeLists.txt +=================================================================== +--- llvm-project-20.1.0.src.orig/llvm/projects/SPIRV-LLVM-Translator/CMakeLists.txt ++++ llvm-project-20.1.0.src/llvm/projects/SPIRV-LLVM-Translator/CMakeLists.txt +@@ -116,6 +116,14 @@ if(LLVM_SPIRV_BUILD_EXTERNAL) + set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache) + set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache) + endif() ++else() ++ message(STATUS "Internal LLVM library") ++ is_llvm_target_library("SPIRV" spirv_present_result INCLUDED_TARGETS) ++ if(spirv_present_result) ++ message(STATUS "Found SPIR-V Backend") ++ set(SPIRV_BACKEND_FOUND TRUE) ++ add_compile_definitions(LLVM_SPIRV_BACKEND_TARGET_PRESENT) ++ endif() + endif() + + set(LLVM_SPIRV_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/include)
meta/recipes-devtools/llvm/llvm_20.1.0.bb +27 -5
@@ -23,10 +23,20 @@ MAJ_MIN_VERSION = "${@oe.utils.trim_version("${PV}", 2)}" LLVM_RELEASE = "${PV}" +SRCREV_spirv = "68edc9d3d10ff6ec6353803a1bc60a5c25e7b715" +SPIRV_BRANCH = "llvm_release_200" + +SRC_URI_SPIRV = " \ + git://github.com/KhronosGroup/SPIRV-LLVM-Translator;protocol=https;name=spirv;branch=${SPIRV_BRANCH};destsuffix=llvm-project-${PV}.src/llvm/projects/SPIRV-LLVM-Translator \ + file://0001-cmake-modules-CrossCompile-pass-SPIR-V-headers-path-.patch \ + file://spirv-internal-build.patch \ +" + SRC_URI = "https://github.com/llvm/llvm-project/releases/download/llvmorg-${PV}/llvm-project-${PV}.src.tar.xz \ file://0007-llvm-allow-env-override-of-exe-path.patch \ file://0001-AsmMatcherEmitter-sort-ClassInfo-lists-by-name-as-we.patch \ file://fix-native-compilation.patch \ + ${@bb.utils.contains('PACKAGECONFIG', 'spirv', '${SRC_URI_SPIRV}', '', d)} \ file://llvm-config \ "
@@ -58,11 +68,12 @@ def get_llvm_arch(bb, d, arch_var): def get_llvm_host_arch(bb, d): return get_llvm_arch(bb, d, 'HOST_ARCH') -PACKAGECONFIG ??= "libllvm libclc" +PACKAGECONFIG ??= "libllvm libclc spirv" # if optviewer OFF, force the modules to be not found or the ones on the host would be found PACKAGECONFIG[optviewer] = ",-DPY_PYGMENTS_FOUND=OFF -DPY_PYGMENTS_LEXERS_C_CPP_FOUND=OFF -DPY_YAML_FOUND=OFF,python3-pygments python3-pyyaml,python3-pygments python3-pyyaml" PACKAGECONFIG[libllvm] = "" PACKAGECONFIG[libclc] = "" +PACKAGECONFIG[spirv] = "-DLLVM_EXTERNAL_SPIRV_HEADERS_SOURCE_DIR=${STAGING_INCDIR}/.. ,,spirv-tools-native spirv-headers" # # Default to build all OE-Core supported target arches (user overridable).
@@ -72,7 +83,9 @@ LLVM_TARGETS ?= "AMDGPU;NVPTX;SPIRV;${@get_llvm_host_arch(bb, d)}" ARM_INSTRUCTION_SET:armv5 = "arm" ARM_INSTRUCTION_SET:armv4t = "arm" -LLVM_PROJECTS = "${@bb.utils.contains('PACKAGECONFIG', 'libclc', 'clang;libclc', '', d)}" +LLVM_PROJECTS_CLANG = "${@bb.utils.contains_any('PACKAGECONFIG', 'libclc spirv', 'clang', '', d)}" +LLVM_PROJECTS_CLC = "${@bb.utils.contains('PACKAGECONFIG', 'libclc', ';libclc', '', d)}" +LLVM_PROJECTS = "${LLVM_PROJECTS_CLANG}${LLVM_PROJECTS_CLC}" EXTRA_OECMAKE += "-DLLVM_ENABLE_ASSERTIONS=OFF \ -DLLVM_ENABLE_EXPENSIVE_CHECKS=OFF \
@@ -147,7 +160,7 @@ do_install() { fi # Remove clang bits from target packages, we are not providing it for the system - if ${@bb.utils.contains('PACKAGECONFIG', 'libclc', 'true', 'false', d)} && + if ${@bb.utils.contains_any('PACKAGECONFIG', 'libclc spirv', 'true', 'false', d)} && [ "${CLASSOVERRIDE}" != "class-native" ] ; then rm -f ${D}${bindir}/clang* rm -fr ${D}${libdir}/clang
@@ -176,11 +189,12 @@ llvm_sysroot_preprocess() { ln -sf llvm-config ${SYSROOT_DESTDIR}${bindir_crossscripts}/llvm-config${PV} } -PACKAGES =+ "${PN}-bugpointpasses ${PN}-llvmhello ${PN}-libllvm ${PN}-liboptremarks ${PN}-liblto ${PN}-clc" -PROVIDES = "libclc" +PACKAGES =+ "${PN}-bugpointpasses ${PN}-llvmhello ${PN}-libllvm ${PN}-liboptremarks ${PN}-liblto ${PN}-clc ${PN}-spirv" +PROVIDES = "libclc spirv-llvm-translator" RRECOMMENDS:${PN}-dev += "${PN}-bugpointpasses ${PN}-llvmhello ${PN}-liboptremarks" RPROVIDES:${PN}-clc += "libclc" +RPROVIDES:${PN}-spirv += "spirv-llvm-translator" FILES:${PN}-bugpointpasses = "\ ${libdir}/BugpointPasses.so \
@@ -215,6 +229,14 @@ FILES:${PN}-staticdev += "\ FILES:${PN}-clc += "${datadir}/clc" +FILES:${PN}-spirv = " \ + ${bindir}/llvm-spirv \ + ${includedir}/LLVMSPIRVLib \ + ${libdir}/pkgconfig/LLVMSPIRVLib.pc \ + ${libdir}/libLLVMSPIRV* \ +" + INSANE_SKIP:${PN}-libllvm += "dev-so" +INSANE_SKIP:${PN}-spirv += "staticdev" BBCLASSEXTEND = "native nativesdk"
Signature · 1 line
2.39.5
PATCH 6/8 mesa: upgrade 24.0.7 -> 25.0.2
In reply to Dmitry BaryshkovUpgrade the Mesa package, dropping applied and refreshing outstanding patches. The dri3 config option is now gone, dependencies are merged into X11 deps. The swrast gallium driver has been split into softpipe and llvmpipe drivers. Reworked OpenCL support to use mesa_clc compiler.
Changelog:
https://docs.mesa3d.org/relnotes/25.0.2.html
License-Update: license text cleared and clarified.
--- ...-meson-do-not-pull-in-clc-for-clover.patch | 53 ------------ ...lude-missing-llvm-IR-header-Module.h.patch | 41 --------- .../0001-drisw-fix-build-without-dri3.patch | 58 ------------- ...on-t-encode-build-path-into-binaries.patch | 46 ++++++++-- ...son-use-target-path-for-Clang-libdir.patch | 28 +++++++ ...on-t-try-zink-if-not-enabled-in-mesa.patch | 42 ---------- meta/recipes-graphics/mesa/mesa.inc | 84 ++++++++++--------- 7 files changed, 110 insertions(+), 242 deletions(-) delete mode 100644 meta/recipes-graphics/mesa/files/0001-Revert-meson-do-not-pull-in-clc-for-clover.patch delete mode 100644 meta/recipes-graphics/mesa/files/0001-amd-Include-missing-llvm-IR-header-Module.h.patch delete mode 100644 meta/recipes-graphics/mesa/files/0001-drisw-fix-build-without-dri3.patch create mode 100644 meta/recipes-graphics/mesa/files/0001-meson-use-target-path-for-Clang-libdir.patch delete mode 100644 meta/recipes-graphics/mesa/files/0002-glxext-don-t-try-zink-if-not-enabled-in-mesa.patch
meta/recipes-graphics/mesa/files/0001-Revert-meson-do-not-pull-in-clc-for-clover.patch deleted +0 -53
@@ -1,53 +0,0 @@ -From 051f41beda540f0ae77b341db01a6de83c9e938a Mon Sep 17 00:00:00 2001 -From: Markus Volk <[email protected]> -Date: Fri, 8 Mar 2024 15:53:11 +0100 -Subject: [PATCH] Revert "meson: do not pull in clc for clover" - -This reverts commit 815a6647eb1383e9dc704ffcc266d85f3b13338a. -Upstream-Status: Inappropriate [https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27783/diffs?commit_id=a976f2c9f0c07f9e06cc9affd9124b45bc60c2bd] - -Once the merge request above was added, it will only be possible to provide opencl spir-v with gallium-rusticl=true. This is not yet supported in the mesa recipe. -For now reverting this commit allows to still use clover with opencl-spirv, which would otherwise be broken starting from mesa 24.0.2. - -After it was merged, this patch needs to be removed and rusticl support will be required - -Signed-off-by: Markus Volk <[email protected]> ---- - meson.build | 3 ++- - src/compiler/meson.build | 2 +- - 2 files changed, 3 insertions(+), 2 deletions(-) - -diff --git a/meson.build b/meson.build -index 2db6185..741b5d1 100644 ---- a/meson.build -+++ b/meson.build -@@ -813,6 +813,7 @@ if _opencl != 'disabled' - error('The Clover OpenCL state tracker requires rtti') - endif - -+ with_clc = true - with_gallium_opencl = true - with_opencl_icd = _opencl == 'icd' - else -@@ -837,7 +838,7 @@ if with_gallium_rusticl - endif - - dep_clc = null_dep --if with_gallium_opencl or with_clc -+if with_clc - dep_clc = dependency('libclc') - endif - -diff --git a/src/compiler/meson.build b/src/compiler/meson.build -index 8d73544..1dae56d 100644 ---- a/src/compiler/meson.build -+++ b/src/compiler/meson.build -@@ -79,7 +79,7 @@ subdir('nir') - - subdir('spirv') - --if with_clc -+if with_opencl_spirv - subdir('clc') - endif - if with_gallium
meta/recipes-graphics/mesa/files/0001-amd-Include-missing-llvm-IR-header-Module.h.patch deleted +0 -41
41 lines not on this page · raw message
meta/recipes-graphics/mesa/files/0001-drisw-fix-build-without-dri3.patch deleted +0 -58
58 lines not on this page · raw message
meta/recipes-graphics/mesa/files/0001-freedreno-don-t-encode-build-path-into-binaries.patch +39 -7
65 lines not on this page · raw message
meta/recipes-graphics/mesa/files/0001-meson-use-target-path-for-Clang-libdir.patch new file +28 -0
@@ -0,0 +1,28 @@ +From ecea6fe0d250c3026c22a60ac5420528cc3632d8 Mon Sep 17 00:00:00 2001 +From: Dmitry Baryshkov <[email protected]> +Date: Wed, 26 Mar 2025 12:19:10 +0200 +Subject: [PATCH] meson: use target path for Clang libdir + +Instead of trying to detect the target libdir through llvm-config tool +(and ending up with the sysroot path), get libdir from the build +options. Clang is known to use the same libdir in OE build environment. + +Upstream-Status: Inappropriate [OE-Specific] +Signed-off-by: Dmitry Baryshkov <[email protected]> +--- + src/gallium/frontends/clover/meson.build | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/gallium/frontends/clover/meson.build b/src/gallium/frontends/clover/meson.build +index e569b86a1bea..2fc30ffe1ac2 100644 +--- a/src/gallium/frontends/clover/meson.build ++++ b/src/gallium/frontends/clover/meson.build +@@ -44,7 +44,7 @@ libclllvm = static_library( + clover_cpp_args, + clover_opencl_cpp_args, + '-DCLANG_RESOURCE_DIR="@0@"'.format(join_paths( +- dep_llvm.get_variable(cmake : 'LLVM_LIBRARY_DIR', configtool: 'libdir'), 'clang', ++ get_option('libdir'), 'clang', + dep_llvm.version(), 'include', + )), + ],
meta/recipes-graphics/mesa/files/0002-glxext-don-t-try-zink-if-not-enabled-in-mesa.patch deleted +0 -42
42 lines not on this page · raw message
meta/recipes-graphics/mesa/mesa.inc +43 -41
191 lines not on this page · raw message
Signature · 1 line
2.39.5
PATCH 7/8 bindgen-cli: a tool to generate Rust bindings
In reply to Dmitry BaryshkovImport bindgen-cli from the meta-clang layer, as it is required to generate bindings for Mesa / RustiCL. Specify Khem as maintainer as he is maintaining the meta-clang layer, which included this recipe too.
--- meta/conf/distro/include/maintainers.inc | 1 + .../bindgen-cli/bindgen-cli-crates.inc | 186 ++++++++++++++++++ .../bindgen-cli/bindgen-cli_0.71.1.bb | 19 ++ 3 files changed, 206 insertions(+) create mode 100644 meta/recipes-devtools/bindgen-cli/bindgen-cli-crates.inc create mode 100644 meta/recipes-devtools/bindgen-cli/bindgen-cli_0.71.1.bb
meta/conf/distro/include/maintainers.inc +1 -0
@@ -64,6 +64,7 @@ RECIPE_MAINTAINER:pn-bash = "Hongxu Jia <[email protected]>" RECIPE_MAINTAINER:pn-bash-completion = "Unassigned <[email protected]>" RECIPE_MAINTAINER:pn-bc = "Anuj Mittal <[email protected]>" RECIPE_MAINTAINER:pn-bind = "Unassigned <[email protected]>" +RECIPE_MAINTAINER:pn-bindgen-cli = "Khem Raj <[email protected]>" RECIPE_MAINTAINER:pn-binutils = "Khem Raj <[email protected]>" RECIPE_MAINTAINER:pn-binutils-cross-${TARGET_ARCH} = "Khem Raj <[email protected]>" RECIPE_MAINTAINER:pn-binutils-cross-canadian-${TRANSLATED_TARGET_ARCH} = "Khem Raj <[email protected]>"
meta/recipes-devtools/bindgen-cli/bindgen-cli-crates.inc new file +186 -0
187 lines not on this page · raw message
meta/recipes-devtools/bindgen-cli/bindgen-cli_0.71.1.bb new file +19 -0
@@ -0,0 +1,19 @@ +SUMMARY = "Automatically generates Rust FFI bindings to C and C++ libraries." +HOMEPAGE = "https://rust-lang.github.io/rust-bindgen/" +LICENSE = "BSD-3-Clause" + +LIC_FILES_CHKSUM = "file://LICENSE;md5=0b9a98cb3dcdefcceb145324693fda9b" + +inherit rust cargo cargo-update-recipe-crates + +SRC_URI += "git://github.com/rust-lang/rust-bindgen.git;protocol=https;branch=main" +SRCREV = "af7fd38d5e80514406fb6a8bba2d407d252c30b9" +S = "${WORKDIR}/git" + +require ${BPN}-crates.inc + +do_install:append:class-native() { + create_wrapper ${D}/${bindir}/bindgen LIBCLANG_PATH="${STAGING_LIBDIR_NATIVE}" +} + +BBCLASSEXTEND = "native"
Signature · 1 line
2.39.5
PATCH 8/8 mesa: add support for RustiCL under PACKAGECONFIG "opencl"
In reply to Dmitry BaryshkovFrom: Zoltán Böszörményi <[email protected]>
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.
--- ...son-use-target-path-for-Clang-libdir.patch | 18 +++++- ...cross-compilation-arguments-to-LLVM-.patch | 64 +++++++++++++++++++ meta/recipes-graphics/mesa/mesa.inc | 21 ++++-- 3 files changed, 96 insertions(+), 7 deletions(-) create mode 100644 meta/recipes-graphics/mesa/files/0001-rusticl-provide-cross-compilation-arguments-to-LLVM-.patch
meta/recipes-graphics/mesa/files/0001-meson-use-target-path-for-Clang-libdir.patch +16 -2
@@ -1,4 +1,4 @@ -From ecea6fe0d250c3026c22a60ac5420528cc3632d8 Mon Sep 17 00:00:00 2001 +From 11b93f72936ce367306ae299549c39fc21ef21c3 Mon Sep 17 00:00:00 2001 From: Dmitry Baryshkov <[email protected]> Date: Wed, 26 Mar 2025 12:19:10 +0200 Subject: [PATCH] meson: use target path for Clang libdir
@@ -10,9 +10,23 @@ options. Clang is known to use the same libdir in OE build environment. Upstream-Status: Inappropriate [OE-Specific] Signed-off-by: Dmitry Baryshkov <[email protected]> --- + src/compiler/clc/meson.build | 2 +- src/gallium/frontends/clover/meson.build | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) + 2 files changed, 2 insertions(+), 2 deletions(-) +diff --git a/src/compiler/clc/meson.build b/src/compiler/clc/meson.build +index 743cd236bb5c..af36dae3dde9 100644 +--- a/src/compiler/clc/meson.build ++++ b/src/compiler/clc/meson.build +@@ -8,7 +8,7 @@ files_libmesaclc = files( + ) + + _libmesaclc_c_args = [] +-_libmesaclc_cpp_args = ['-DLLVM_LIB_DIR="@0@"'.format(llvm_libdir)] ++_libmesaclc_cpp_args = ['-DLLVM_LIB_DIR="@0@"'.format(get_option('libdir'))] + _libmesaclc_sources = [] + + if not _shared_llvm diff --git a/src/gallium/frontends/clover/meson.build b/src/gallium/frontends/clover/meson.build index e569b86a1bea..2fc30ffe1ac2 100644 --- a/src/gallium/frontends/clover/meson.build
meta/recipes-graphics/mesa/files/0001-rusticl-provide-cross-compilation-arguments-to-LLVM-.patch new file +64 -0
64 lines not on this page · raw message
meta/recipes-graphics/mesa/mesa.inc +16 -5
@@ -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-freedreno-don-t-encode-build-path-into-binaries.patch\ file://0001-meson-use-target-path-for-Clang-libdir.patch \ + file://0001-rusticl-provide-cross-compilation-arguments-to-LLVM-.patch \ " SRC_URI[sha256sum] = "adf904d083b308df95898600ffed435f4b5c600d95fb6ec6d4c45638627fdc97"
@@ -46,7 +47,7 @@ PROVIDES = " \ virtual/mesa \ " -inherit meson pkgconfig python3native gettext features_check +inherit meson pkgconfig python3native gettext features_check rust BBCLASSEXTEND = "native nativesdk"
@@ -85,6 +86,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"
@@ -147,9 +151,16 @@ INSTALL_MESA_CLC:class-native = "true" MESA_NATIVE = "mesa-native" MESA_NATIVE:class-native = "" +BINDGEN_TARGET = "${TARGET_ARCH}-${TARGET_OS}${LIBCEXTENSION}${@['-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 -Dmesa-clc=${MESA_CLC} -Dinstall-mesa-clc=${INSTALL_MESA_CLC},-Dgallium-opencl=disabled,${MESA_NATIVE}" +PACKAGECONFIG[opencl] = " \ + -Dgallium-opencl=icd -Dmesa-clc=${MESA_CLC} -Dinstall-mesa-clc=${INSTALL_MESA_CLC} \ + -Dgallium-rusticl=true -Dbindgen-includedir=${STAGING_INCDIR} -Dbindgen-target=${BINDGEN_TARGET},\ + -Dgallium-opencl=disabled -Dgallium-rusticl=false, \ + ${MESA_NATIVE} bindgen-cli-native \ +" PACKAGECONFIG[broadcom] = "" PACKAGECONFIG[etnaviv] = ",,python3-pycparser-native"
@@ -242,7 +253,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 \
@@ -348,7 +359,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.*"
@@ -362,7 +373,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 \
Signature · 1 line
2.39.5
Quoted 3 lines · Dmitry Baryshkov via lists.openembedded.org
I think this approach provides a good balance between OE-Core being stuck with the outdated Mesa release and being able to upgrade it, bringing support for new hardware.
I like the approach, but I don't particularly like the volume and amount of 'Inappropriate' patches this set brings in. This will complicate future maintenance, and particularly version updates.
In addition to what Ross said, can you see what can be reworked for upstream submission, and what can be at least reported to upstream?
Alex
Quoted 7 lines · Alexander Kanavin
Quoted 3 lines · Dmitry Baryshkov via lists.openembedded.org
I think this approach provides a good balance between OE-Core being stuck with the outdated Mesa release and being able to upgrade it, bringing support for new hardware.
Quoted 6 lines
I like the approach, but I don't particularly like the volume and amount of 'Inappropriate' patches this set brings in. This will complicate future maintenance, and particularly version updates.
In addition to what Ross said, can you see what can be reworked for upstream submission, and what can be at least reported to upstream?
I have reworked the patch to use prefix+libdir instead of LLVM_LIBRARY_DIR, but I'll investigate if we can drop that completely in favour of reporting a correct libdir from llvm-config script.
Other than that, I'll ping Karol regarding the bindgen invocation hacks.
Signature · 2 lines
With best wishes Dmitry