diff mbox series

[meta-oe,2/2] opencl-icd-loader: make use of the 'opencl' DISTRO_FEATURE

Message ID 20250917140203.895760-2-dmitry.baryshkov@oss.qualcomm.com
State Accepted
Headers show
Series [meta-oe,1/2] opencl-icd-loader: pull in ICD packages | expand

Commit Message

Dmitry Baryshkov Sept. 17, 2025, 2:02 p.m. UTC
Currently packages like Mesa list 'opengl' and 'vulkan' as required
DISTRO_FEATURES, disabling GPU support for non-graphics-enabled cases.
However in the modern world it's a perfectly fine usecase to have a
headless box with GPU being used by OpenCL only. The OE-Core has added
the 'opencl' DISTRO_FEATURE, making it possible to specify whether
OpenCL is enabled or not and also making it possible to enable GPU
packages if only OpenCL is required.

Follow the example of GLVND and vulkan-loader and disable OpenCL ICD
loader if corresponding feature is not enabled.

Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>

---

Note, this depends on https://lore.kernel.org/openembedded-core/20250915232557.536762-1-dmitry.baryshkov@oss.qualcomm.com/

Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
---
 meta-oe/recipes-core/opencl/opencl-icd-loader_2024.05.08.bb | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Khem Raj Sept. 17, 2025, 7:59 p.m. UTC | #1
I think more recipes need this conditional.

ERROR: Nothing PROVIDES 'virtual/opencl-icd' (but
/home/kraj200/yoe/sources/meta-openembedded/meta-oe/recipes-support/opencl/clinfo_3.0.23.01.25.bb,
/home/kraj200/yoe/
   ↪ sources/meta-openembedded/meta-oe/recipes-core/opencl/clpeak_1.1.5.bb
DEPENDS on or otherwise requires it)
   ocl-icd PROVIDES virtual/opencl-icd but was skipped:
PREFERRED_PROVIDER_virtual/opencl-icd set to opencl-icd-loader, not
ocl-icd
   opencl-icd-loader PROVIDES virtual/opencl-icd but was skipped:
missing required distro feature 'opencl' (not in DISTRO_FEATURES)
   ERROR: Nothing RPROVIDES 'clinfo' (but
/home/kraj200/yoe/sources/meta-openembedded/meta-oe/recipes-support/opencl/clinfo_3.0.23.01.25.bb
RDEPENDS on or otherwise requires
   ↪ it)

On Wed, Sep 17, 2025 at 7:02 AM Dmitry Baryshkov via
lists.openembedded.org
<dmitry.baryshkov=oss.qualcomm.com@lists.openembedded.org> wrote:
>
> Currently packages like Mesa list 'opengl' and 'vulkan' as required
> DISTRO_FEATURES, disabling GPU support for non-graphics-enabled cases.
> However in the modern world it's a perfectly fine usecase to have a
> headless box with GPU being used by OpenCL only. The OE-Core has added
> the 'opencl' DISTRO_FEATURE, making it possible to specify whether
> OpenCL is enabled or not and also making it possible to enable GPU
> packages if only OpenCL is required.
>
> Follow the example of GLVND and vulkan-loader and disable OpenCL ICD
> loader if corresponding feature is not enabled.
>
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
>
> ---
>
> Note, this depends on https://lore.kernel.org/openembedded-core/20250915232557.536762-1-dmitry.baryshkov@oss.qualcomm.com/
>
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
> ---
>  meta-oe/recipes-core/opencl/opencl-icd-loader_2024.05.08.bb | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/meta-oe/recipes-core/opencl/opencl-icd-loader_2024.05.08.bb b/meta-oe/recipes-core/opencl/opencl-icd-loader_2024.05.08.bb
> index 16c070e4b538..8c8f1ae7dbe0 100644
> --- a/meta-oe/recipes-core/opencl/opencl-icd-loader_2024.05.08.bb
> +++ b/meta-oe/recipes-core/opencl/opencl-icd-loader_2024.05.08.bb
> @@ -4,7 +4,9 @@ LICENSE = "Apache-2.0"
>  LIC_FILES_CHKSUM = "file://LICENSE;md5=86d3f3a95c324c9479bd8986968f4327"
>  SECTION = "base"
>
> -inherit pkgconfig cmake
> +inherit pkgconfig cmake features_check
> +
> +REQUIRED_DISTRO_FEATURES = "opencl"
>
>  DEPENDS += "opencl-headers"
>
> --
> 2.47.3
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#119484): https://lists.openembedded.org/g/openembedded-devel/message/119484
> Mute This Topic: https://lists.openembedded.org/mt/115291651/1997914
> Group Owner: openembedded-devel+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub [raj.khem@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
diff mbox series

Patch

diff --git a/meta-oe/recipes-core/opencl/opencl-icd-loader_2024.05.08.bb b/meta-oe/recipes-core/opencl/opencl-icd-loader_2024.05.08.bb
index 16c070e4b538..8c8f1ae7dbe0 100644
--- a/meta-oe/recipes-core/opencl/opencl-icd-loader_2024.05.08.bb
+++ b/meta-oe/recipes-core/opencl/opencl-icd-loader_2024.05.08.bb
@@ -4,7 +4,9 @@  LICENSE = "Apache-2.0"
 LIC_FILES_CHKSUM = "file://LICENSE;md5=86d3f3a95c324c9479bd8986968f4327"
 SECTION = "base"
 
-inherit pkgconfig cmake
+inherit pkgconfig cmake features_check
+
+REQUIRED_DISTRO_FEATURES = "opencl"
 
 DEPENDS += "opencl-headers"