Skip to contentSkip to conversation

bitbake.conf: add vulkan to DISTRO_FEATURES_FILTER_NATIVE{,SDK}

PATCH In review Dmitry Baryshkov 3 participants 5 messages Sep 12, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 bitbake.conf: add vulkan to DISTRO_FEATURES_FILTER_NATIVE{,SDK}

Follow the example of OpenGL and propagate vulkan from the target DISTRO_FEATURES into the native build. This helps us to resolve mesa -> mesa-native dependency if 'opengl' is not a part of DISTRO_FEATURES

---
 meta/conf/bitbake.conf | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
meta/conf/bitbake.conf +2 -2
index 8e90c7bbc85c..6ed8128b101a 100644
@@ -915,8 +915,8 @@ DISTRO_FEATURES_NATIVESDK:mingw32 = "x11 ipv6"
 
 # Normally target distro features will not be applied to native builds:
 # Native distro features on this list will use the target feature value
-DISTRO_FEATURES_FILTER_NATIVE ?= "api-documentation debuginfod opengl wayland"
-DISTRO_FEATURES_FILTER_NATIVESDK ?= "api-documentation debuginfod opengl wayland"
+DISTRO_FEATURES_FILTER_NATIVE ?= "api-documentation debuginfod opengl wayland vulkan"
+DISTRO_FEATURES_FILTER_NATIVESDK ?= "api-documentation debuginfod opengl wayland vulkan"
 
 DISTRO_FEATURES_BACKFILL = "pulseaudio sysvinit gobject-introspection-data ldconfig"
 MACHINE_FEATURES_BACKFILL = "rtc qemu-usermode"
Signature · 1 line
2.47.3
#1 lore raw

PATCH 2/3 mesa: add opencl DISTRO_FEATURE

OpenCL is an important part of the GPU-related world. It makes sense to be able to provide headless environment (without OpenGL and Vulkan), but having just OpenCL as a GPU user. Currently it is not possible since mesa requires either of those to be enabled for the DISTRO.

Add new 'opencl' DISTRO_FEATURE, controlling enablement of OpenCL.
Note: it's required to propagate this feature to the native set in order to be able to fulfill mesa -> mesa-native dependency.

---

A patch to disable OpenCL ICD Loader (which is a part of meta-oe) will be submitted separately.

---
 meta/conf/bitbake.conf              | 4 ++--
 meta/recipes-graphics/mesa/mesa.bb  | 1 +
 meta/recipes-graphics/mesa/mesa.inc | 2 +-
 3 files changed, 4 insertions(+), 3 deletions(-)
meta/conf/bitbake.conf +2 -2
index 6ed8128b101a..5f28037a57e3 100644
@@ -915,8 +915,8 @@ DISTRO_FEATURES_NATIVESDK:mingw32 = "x11 ipv6"
 
 # Normally target distro features will not be applied to native builds:
 # Native distro features on this list will use the target feature value
-DISTRO_FEATURES_FILTER_NATIVE ?= "api-documentation debuginfod opengl wayland vulkan"
-DISTRO_FEATURES_FILTER_NATIVESDK ?= "api-documentation debuginfod opengl wayland vulkan"
+DISTRO_FEATURES_FILTER_NATIVE ?= "api-documentation debuginfod opencl opengl wayland vulkan"
+DISTRO_FEATURES_FILTER_NATIVESDK ?= "api-documentation debuginfod opencl opengl wayland vulkan"
 
 DISTRO_FEATURES_BACKFILL = "pulseaudio sysvinit gobject-introspection-data ldconfig"
 MACHINE_FEATURES_BACKFILL = "rtc qemu-usermode"
meta/recipes-graphics/mesa/mesa.bb +1 -0
index 49e077b20cd2..cfa5d0f40f0a 100644
@@ -5,6 +5,7 @@ PACKAGECONFIG = " \
 	video-codecs \
 	${@bb.utils.filter('DISTRO_FEATURES', 'x11 vulkan wayland glvnd', d)} \
 	${@bb.utils.contains('DISTRO_FEATURES', 'opengl', 'opengl egl gles gbm virgl', '', d)} \
+	${@bb.utils.contains('DISTRO_FEATURES', 'opencl', 'opencl libclc gallium-llvm', '', d)} \
 	${@bb.utils.contains('DISTRO_FEATURES', 'vulkan', 'zink', '', d)} \
 	xmlconfig \
 "
meta/recipes-graphics/mesa/mesa.inc +1 -1
index 3f09cfd4df21..a58de5ebc3da 100644
@@ -46,7 +46,7 @@ EXTRANATIVEPATH += "chrpath-native"
 
 inherit meson pkgconfig python3native gettext features_check rust
 
-ANY_OF_DISTRO_FEATURES = "opengl vulkan"
+ANY_OF_DISTRO_FEATURES = "opencl opengl vulkan"
 
 PLATFORMS ??= "${@bb.utils.filter('PACKAGECONFIG', 'x11 wayland', d)}"
 
Signature · 1 line
2.47.3
#2 lore raw

PATCH 3/3 clang: enable GPU backends for the opencl DISTRO_FEATURE

In reply to Dmitry Baryshkov

Clang gates enabling of several backends (AMDGPU, NVPTX and SPIR-V) by the GPU-related distro features (opengl, vulkan). Now as we got a separate feature for OpenCL, enable those backends for the OpenCL-only configurations.

---
 meta/recipes-devtools/clang/clang_git.bb | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
meta/recipes-devtools/clang/clang_git.bb +2 -2
index 0009a95628de..4462ab9712d9 100644
@@ -73,14 +73,14 @@ PACKAGECONFIG[libclang-python] = "-DCLANG_PYTHON_BINDINGS_VERSIONS=${PYTHON_BASE
 OECMAKE_SOURCEPATH = "${S}/llvm"
 
 # By default we build all the supported CPU architectures, and the GPU targets
-# if the opengl or vulkan DISTRO_FEATURES are enabled.
+# if the opencl, opengl or vulkan DISTRO_FEATURES are enabled.
 #
 # For target builds we default to building that specific architecture, BPF, and the GPU targets if required.
 #
 # The available target list can be seen in the source code
 # in the LLVM_ALL_TARGETS assignment:
 # https://github.com/llvm/llvm-project/blob/main/llvm/CMakeLists.txt
-LLVM_TARGETS_GPU ?= "${@bb.utils.contains_any('DISTRO_FEATURES', 'opengl vulkan', 'AMDGPU;NVPTX;SPIRV', '', d)}"
+LLVM_TARGETS_GPU ?= "${@bb.utils.contains_any('DISTRO_FEATURES', 'opencl opengl vulkan', 'AMDGPU;NVPTX;SPIRV', '', d)}"
 LLVM_TARGETS_TO_BUILD ?= "AArch64;ARM;BPF;Mips;PowerPC;RISCV;X86;LoongArch;${LLVM_TARGETS_GPU}"
 LLVM_TARGETS_TO_BUILD:class-target ?= "${@get_clang_host_arch(bb, d)};BPF;${LLVM_TARGETS_GPU}"
 
Signature · 1 line
2.47.3
#3 lore raw
In reply to Dmitry Baryshkov

Hi Dmitry,

Quoted 4 lines · Dmitry Baryshkov via lists.openembedded.org

Follow the example of OpenGL and propagate vulkan from the target DISTRO_FEATURES into the native build. This helps us to resolve mesa -> mesa-native dependency if 'opengl' is not a part of DISTRO_FEATURES

It's unclear to me how this "helps us to resolve mesa -> mesa-native dependency if 'opengl' is not a part of DISTRO_FEATURES" and same remark for patch 2/3 in this series.

Can you please provide a bit more context on the issue you're trying to solve?

Thanks!
Quentin

#4 lore raw
Quoted 9 lines · Quentin Schulz via lists.openembedded.org

Hi Dmitry,

Quoted 4 lines · Dmitry Baryshkov via lists.openembedded.org

Follow the example of OpenGL and propagate vulkan from the target DISTRO_FEATURES into the native build. This helps us to resolve mesa -> mesa-native dependency if 'opengl' is not a part of DISTRO_FEATURES

Quoted 6 lines

It's unclear to me how this "helps us to resolve mesa -> mesa-native dependency if 'opengl' is not a part of DISTRO_FEATURES" and same remark for patch 2/3 in this series.

Can you please provide a bit more context on the issue you're trying to solve?

I agree; this needs to be more specific and explain what native bits need native vulkan distro feature set in order for target vulkan to work.

Alex