Openembedded Core Discussions
 help / color / mirror / Atom feed
* [PATCH v5 0/9] mesa: lighten up target's libclc dependencies and fix panfrost support
@ 2025-08-19  8:16 Quentin Schulz
  2025-08-19  8:16 ` [PATCH v5 1/9] mesa-gl: make mesa-gl really openGL-only Quentin Schulz
                   ` (10 more replies)
  0 siblings, 11 replies; 13+ messages in thread
From: Quentin Schulz @ 2025-08-19  8:16 UTC (permalink / raw)
  To: openembedded-core
  Cc: Dmitry Baryshkov, Markus Volk, Trevor Woerner, Ross Burton,
	Otavio Salvador, Quentin Schulz

@Otavio, can I add the new mesa-tools-native recipe under your
maintainership in meta/conf/distro/include/maintainers.inc, it is after
all still mesa?

Panfrost support has been broken for a while already because it now
requires libclc which isn't enforced by default. This fixes this
oversight.

While re-adding support for panfrost, the build time for libclc were a
bit too much to my taste and I tried to figure out if we could lighten
up the dependencies for the target recipe and it seems to be the case.

libclc brings very expensive dependencies such as llvm and clang.
Building clang and llvm for each target architecture is very expensive,
but mesa allows to depend on prebuilt host binaries (mesa-clc and
precomp-compiler). Those are built by mesa as well, but can be compiled
in mesa-native instead of mesa, making the dependency expensive but only
once regardless of the number of target architectures to build for.
Ideally the mesa-clc and precomp-compiler would only be compiled in
mesa-native if target mesa requires libclc support, however this is not
possible as a target recipe cannot impact or depend on a native recipe's
configuration. We thus have two choices, always build libclc in
mesa-native with its heavy dependencies and impact every build or force
the user to modify the mesa-native recipe in a custom layer (as a native
recipe cannot use target's OVERRIDES). The latter is unacceptable so the
former seems to be the only option. Another big downside is that
mesa-native currently builds drivers (amd, nouveau, svga) which we may
have absolutely no interest in building, increasing the build time and
possibly dependencies list).

A third choice is to spin-off the native mesa recipe with libclc support
into a new recipe without drivers and only what's necessary to build
mesa-clc and precomp-compiler binaries.
This allows to keep a "clean" mesa-native recipe for whoever needs those
drivers built-in (e.g. for testing, for qemu-native, or whatever else)
and only bring the libclc dependency when required by the target recipe.

Because libclc is now only built for the host, opencl support now needs
to explicitly bring libclc and others to build as libclc won't bring it
in the build environment anymore.

Note that this was essentially only build tested (run tested on RK3588
with panfrost though).

I tried to enable OpenCL support but it triggers a buildpaths QA error,
which can be worked around with the following patch:

  commit f5508086477eb900bb0bcfa1a65f46c8d853595a
  Author: Quentin Schulz <quentin.schulz@cherry.de>
  Date:   Mon Jul 21 11:15:54 2025 +0200
  
      clc: avoid host path poisoning
      
      LLVM_LIB_DIR is derived from llvm_libdir meson variable. The latter is
      required to figure out where the clang/llvm libraries are for the
      cross-compiler but the former is only useful for debugging purposes
      while running on the target. When in a cross-compiling environment,
      LLVM_LIB_DIR would actually point at a non-existing path (the sysroot
      path on the build host) instead of the target path.
      
      I don't know how to fix this properly so I just hardcode it for now to
      silence build warnings.
      
      Upstream-Status: Inappropriate [proper fix sent to mesa stripping the sysroot would be much better]
      Signed-off-by: Quentin Schulz <quentin.schulz@cherry.de>
  
  diff --git a/src/compiler/clc/clc_helpers.cpp b/src/compiler/clc/clc_helpers.cpp
  index 3c0c9db653f..fbc3b2b3d21 100644
  --- a/src/compiler/clc/clc_helpers.cpp
  +++ b/src/compiler/clc/clc_helpers.cpp
  @@ -936,7 +936,7 @@ clc_compile_to_llvm_module(LLVMContext &llvm_ctx,
                                       false, false);
   
      auto clang_install_res_path =
  -      fs::path(LLVM_LIB_DIR) / "clang" / std::to_string(LLVM_VERSION_MAJOR) / "include";
  +      fs::path("/usr/lib/clang") / std::to_string(LLVM_VERSION_MAJOR) / "include";
      c->getHeaderSearchOpts().AddPath(clang_install_res_path.string(),
                                       clang::frontend::Angled,
                                       false, false);

However, building OpenCL support with Asahi enabled triggers a bunch of
other buildpaths QA errors and I believe those are triggered by:
https://gitlab.freedesktop.org/mesa/mesa/-/blob/main/src/compiler/libcl/assert.h#L33
with __FILE__ pointing at the path on the build host. This should have
been mitigated by DEBUG_PREFIX_MAP (-ffile-prefix-map=) but it probably
isn't propagated by mesa's build system to the LLVM-only parts of the
build?

Signed-off-by: Quentin Schulz <quentin.schulz@cherry.de>
---
Changes in v5:
- removed RFC prefix as it's gone through multiple reviews already, I
  guess it should be fine by now,
- reworded patch 3 to hopefully make it clearer why mesa-gl doesn't get
  any of the changes mesa.bb gets,
- Link to v4: https://lore.kernel.org/r/20250801-mesa-libclc-panfrost-v4-0-101c6dcf564f@cherry.de

Changes in v4:
- revamped patch removing egl/gles from mesa-gl by making the native and
  nativesdk PACKAGECONFIG use = instead of ??= (see patch 1),
- added "No intended change in behavior" wherever it is expected,
- Link to v3: https://lore.kernel.org/r/20250729-mesa-libclc-panfrost-v3-0-42559ddc93ef@cherry.de

Changes in v3:
- added patch to move S into mesa.inc,
- added patch to remove egl/gles from mesa-gl,
- added patch to make mesa-gl a target-only recipe,
- updated comment for PACKAGECONFIG[opencl] dependency on other
  PACKAGECONFIG,
- added clarification in commit log of commit adding asahi to TOOLS,
- Link to v2: https://lore.kernel.org/r/20250721-mesa-libclc-panfrost-v2-0-f713d0858949@cherry.de

Changes in v2:
- spin-off mesa-clc/precomp-compiler host binary building into a
  mesa-tools-native recipe to lighten the dependency even more (no
  native mesa drivers to build),
- make libclc's target mesa depend on mesa-tools-native instead of
  mesa-native,
- Link to v1: https://lore.kernel.org/r/20250624-mesa-libclc-panfrost-v1-0-9ed8ca980e21@cherry.de

---
Quentin Schulz (8):
      mesa-gl: make mesa-gl really openGL-only
      mesa: move PACKAGECONFIG defaults to recipes
      mesa: move PROVIDES out of include file
      mesa: move BBCLASSEXTEND out of the include file
      mesa-gl: make recipe target only
      mesa: add asahi to TOOLS when selected in PACKAGECONFIG
      mesa: use simpler mesa-tools-native recipe as dependency for libclc
      mesa: fix panfrost driver build

Ross Burton (1):
      mesa: assign S in include file

 meta/recipes-graphics/mesa/mesa-gl.bb           |  8 ++---
 meta/recipes-graphics/mesa/mesa-tools-native.bb | 19 ++++++++++
 meta/recipes-graphics/mesa/mesa.bb              | 25 +++++++++++++
 meta/recipes-graphics/mesa/mesa.inc             | 47 +++++--------------------
 4 files changed, 57 insertions(+), 42 deletions(-)
---
base-commit: a2d9103bcd114f636bd8a7113dbad5844d2c9745
change-id: 20250624-mesa-libclc-panfrost-108d62e1899b

Best regards,
-- 
Quentin Schulz <quentin.schulz@cherry.de>



^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH v5 1/9] mesa-gl: make mesa-gl really openGL-only
  2025-08-19  8:16 [PATCH v5 0/9] mesa: lighten up target's libclc dependencies and fix panfrost support Quentin Schulz
@ 2025-08-19  8:16 ` Quentin Schulz
  2025-08-19 17:57   ` [OE-core] " Khem Raj
  2025-08-19  8:16 ` [PATCH v5 2/9] mesa: move PACKAGECONFIG defaults to recipes Quentin Schulz
                   ` (9 subsequent siblings)
  10 siblings, 1 reply; 13+ messages in thread
From: Quentin Schulz @ 2025-08-19  8:16 UTC (permalink / raw)
  To: openembedded-core
  Cc: Dmitry Baryshkov, Markus Volk, Trevor Woerner, Ross Burton,
	Otavio Salvador, Quentin Schulz

From: Quentin Schulz <quentin.schulz@cherry.de>

The ??= operator for PACKAGECONFIG doesn't actually do anything because
the recipe includes mesa.inc which already sets this variable (with the
= operator).

This probably wasn't noticed until now because mesa-gl is likely only
ever built in its target flavor which was already set correctly thanks
to the :class-target override.

This essentially only make mesa-gl-native and nativesdk-mesa-gl follow
the same configuration as the target.

Suggested-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Signed-off-by: Quentin Schulz <quentin.schulz@cherry.de>
---
 meta/recipes-graphics/mesa/mesa-gl.bb | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/meta/recipes-graphics/mesa/mesa-gl.bb b/meta/recipes-graphics/mesa/mesa-gl.bb
index e2f03c81c4588c6257ffec2892fef7fcbe9f82bf..35d6dc854cf4dfac7a757e333e25e4ddeab10b6e 100644
--- a/meta/recipes-graphics/mesa/mesa-gl.bb
+++ b/meta/recipes-graphics/mesa/mesa-gl.bb
@@ -9,6 +9,4 @@ S = "${UNPACKDIR}/mesa-${PV}"
 TARGET_CFLAGS = "-I${STAGING_INCDIR}/drm"
 
 # At least one DRI rendering engine is required to build mesa.
-PACKAGECONFIG ??= "opengl gallium ${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'x11', '', d)}"
-PACKAGECONFIG:class-target = "opengl gallium ${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'x11', '', d)}"
-
+PACKAGECONFIG = "opengl gallium ${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'x11', '', d)}"

-- 
2.50.1



^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v5 2/9] mesa: move PACKAGECONFIG defaults to recipes
  2025-08-19  8:16 [PATCH v5 0/9] mesa: lighten up target's libclc dependencies and fix panfrost support Quentin Schulz
  2025-08-19  8:16 ` [PATCH v5 1/9] mesa-gl: make mesa-gl really openGL-only Quentin Schulz
@ 2025-08-19  8:16 ` Quentin Schulz
  2025-08-19  8:16 ` [PATCH v5 3/9] mesa: move PROVIDES out of include file Quentin Schulz
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 13+ messages in thread
From: Quentin Schulz @ 2025-08-19  8:16 UTC (permalink / raw)
  To: openembedded-core
  Cc: Dmitry Baryshkov, Markus Volk, Trevor Woerner, Ross Burton,
	Otavio Salvador, Quentin Schulz

From: Quentin Schulz <quentin.schulz@cherry.de>

We're planning on reusing mesa.inc for a new mesa-tools-native recipe
which will require much less in terms of PACKAGECONFIG than the actual
mesa recipes.

It also doesn't make a lot of sense to have a default PACKAGECONFIG in
an include file inherited by multiple recipes (here mesa and mesa-gl)
which is highlighted by the fact that the only other recipe that
includes mesa.inc (mesa-gl) overrides PACKAGECONFIG (hence why mesa-gl
only gets a partial migration of PACKAGECONFIG defaults.

No intended change in behavior.

Signed-off-by: Quentin Schulz <quentin.schulz@cherry.de>
---
 meta/recipes-graphics/mesa/mesa-gl.bb |  5 +++++
 meta/recipes-graphics/mesa/mesa.bb    | 12 ++++++++++++
 meta/recipes-graphics/mesa/mesa.inc   | 13 -------------
 3 files changed, 17 insertions(+), 13 deletions(-)

diff --git a/meta/recipes-graphics/mesa/mesa-gl.bb b/meta/recipes-graphics/mesa/mesa-gl.bb
index 35d6dc854cf4dfac7a757e333e25e4ddeab10b6e..42120687197d663a157786916392d52f8f180999 100644
--- a/meta/recipes-graphics/mesa/mesa-gl.bb
+++ b/meta/recipes-graphics/mesa/mesa-gl.bb
@@ -10,3 +10,8 @@ TARGET_CFLAGS = "-I${STAGING_INCDIR}/drm"
 
 # At least one DRI rendering engine is required to build mesa.
 PACKAGECONFIG = "opengl gallium ${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'x11', '', d)}"
+
+PACKAGECONFIG:append:x86 = " libclc gallium-llvm intel amd nouveau svga"
+PACKAGECONFIG:append:x86-64 = " libclc gallium-llvm intel amd nouveau svga"
+PACKAGECONFIG:append:i686 = " libclc gallium-llvm intel amd nouveau svga"
+PACKAGECONFIG:append:class-native = " libclc gallium-llvm amd nouveau svga"
diff --git a/meta/recipes-graphics/mesa/mesa.bb b/meta/recipes-graphics/mesa/mesa.bb
index 96e8aa38d61661c02d2228d825f70cf41f985382..305b18070d6a47a53f204906a16bc8d4833fd9d6 100644
--- a/meta/recipes-graphics/mesa/mesa.bb
+++ b/meta/recipes-graphics/mesa/mesa.bb
@@ -1,2 +1,14 @@
 require ${BPN}.inc
 
+PACKAGECONFIG = " \
+	gallium \
+	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', 'vulkan', 'zink', '', d)} \
+"
+
+PACKAGECONFIG:append:x86 = " libclc gallium-llvm intel amd nouveau svga"
+PACKAGECONFIG:append:x86-64 = " libclc gallium-llvm intel amd nouveau svga"
+PACKAGECONFIG:append:i686 = " libclc gallium-llvm intel amd nouveau svga"
+PACKAGECONFIG:append:class-native = " libclc gallium-llvm amd nouveau svga"
diff --git a/meta/recipes-graphics/mesa/mesa.inc b/meta/recipes-graphics/mesa/mesa.inc
index a848a2ad8c73dad945039b5374c66e221b5b9a05..387f954789c603dac767ccf18ad60acb6731d35a 100644
--- a/meta/recipes-graphics/mesa/mesa.inc
+++ b/meta/recipes-graphics/mesa/mesa.inc
@@ -80,22 +80,9 @@ EXTRA_OEMESON = " \
 def strip_comma(s):
     return s.strip(',')
 
-PACKAGECONFIG = " \
-	gallium \
-	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', '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 intel amd nouveau svga"
-PACKAGECONFIG:append:x86-64 = " libclc gallium-llvm intel amd nouveau svga"
-PACKAGECONFIG:append:i686 = " libclc gallium-llvm intel amd nouveau svga"
-PACKAGECONFIG:append:class-native = " libclc gallium-llvm amd nouveau svga"
-
 # "gbm" requires "opengl"
 PACKAGECONFIG[gbm] = "-Dgbm=enabled,-Dgbm=disabled"
 

-- 
2.50.1



^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v5 3/9] mesa: move PROVIDES out of include file
  2025-08-19  8:16 [PATCH v5 0/9] mesa: lighten up target's libclc dependencies and fix panfrost support Quentin Schulz
  2025-08-19  8:16 ` [PATCH v5 1/9] mesa-gl: make mesa-gl really openGL-only Quentin Schulz
  2025-08-19  8:16 ` [PATCH v5 2/9] mesa: move PACKAGECONFIG defaults to recipes Quentin Schulz
@ 2025-08-19  8:16 ` Quentin Schulz
  2025-08-19  8:16 ` [PATCH v5 4/9] mesa: move BBCLASSEXTEND out of the " Quentin Schulz
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 13+ messages in thread
From: Quentin Schulz @ 2025-08-19  8:16 UTC (permalink / raw)
  To: openembedded-core
  Cc: Dmitry Baryshkov, Markus Volk, Trevor Woerner, Ross Burton,
	Otavio Salvador, Quentin Schulz

From: Quentin Schulz <quentin.schulz@cherry.de>

There currently are two recipes including mesa.inc: mesa-gl and mesa.

Because mesa-gl.bb already sets PROVIDES, overriding the value it should
be getting from mesa.inc, move PROVIDES from mesa.inc to mesa.bb,
keeping the value in mesa-gl.bb intact.

Because GLPROVIDES is not used in mesa-gl.bb, it also is only moved to
mesa.bb.

No intended change in behavior.

Signed-off-by: Quentin Schulz <quentin.schulz@cherry.de>
---
 meta/recipes-graphics/mesa/mesa.bb  | 11 +++++++++++
 meta/recipes-graphics/mesa/mesa.inc | 10 ----------
 2 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/meta/recipes-graphics/mesa/mesa.bb b/meta/recipes-graphics/mesa/mesa.bb
index 305b18070d6a47a53f204906a16bc8d4833fd9d6..51d0384ef5930f36ff2f5c20ebad2d7ad8b817a9 100644
--- a/meta/recipes-graphics/mesa/mesa.bb
+++ b/meta/recipes-graphics/mesa/mesa.bb
@@ -12,3 +12,14 @@ PACKAGECONFIG:append:x86 = " libclc gallium-llvm intel amd nouveau svga"
 PACKAGECONFIG:append:x86-64 = " libclc gallium-llvm intel amd nouveau svga"
 PACKAGECONFIG:append:i686 = " libclc gallium-llvm intel amd nouveau svga"
 PACKAGECONFIG:append:class-native = " libclc gallium-llvm amd nouveau svga"
+
+GLPROVIDES = " \
+    ${@bb.utils.contains('PACKAGECONFIG', 'opengl', 'virtual/libgl', '', d)} \
+    ${@bb.utils.contains('PACKAGECONFIG', 'gles', 'virtual/libgles1 virtual/libgles2 virtual/libgles3', '', d)} \
+    ${@bb.utils.contains('PACKAGECONFIG', 'egl', 'virtual/egl', '', d)} \
+"
+PROVIDES = " \
+    ${@bb.utils.contains('PACKAGECONFIG', 'glvnd', '', d.getVar('GLPROVIDES'), d)} \
+    ${@bb.utils.contains('PACKAGECONFIG', 'gbm', 'virtual/libgbm', '', d)} \
+    virtual/mesa \
+"
diff --git a/meta/recipes-graphics/mesa/mesa.inc b/meta/recipes-graphics/mesa/mesa.inc
index 387f954789c603dac767ccf18ad60acb6731d35a..46fe465cd84ae9e799571d8c519a1d7933c716a6 100644
--- a/meta/recipes-graphics/mesa/mesa.inc
+++ b/meta/recipes-graphics/mesa/mesa.inc
@@ -40,16 +40,6 @@ do_install:append() {
 
 DEPENDS = "expat makedepend-native flex-native bison-native libxml2-native zlib chrpath-replacement-native python3-mako-native gettext-native python3-pyyaml-native"
 EXTRANATIVEPATH += "chrpath-native"
-GLPROVIDES = " \
-    ${@bb.utils.contains('PACKAGECONFIG', 'opengl', 'virtual/libgl', '', d)} \
-    ${@bb.utils.contains('PACKAGECONFIG', 'gles', 'virtual/libgles1 virtual/libgles2 virtual/libgles3', '', d)} \
-    ${@bb.utils.contains('PACKAGECONFIG', 'egl', 'virtual/egl', '', d)} \
-"
-PROVIDES = " \
-    ${@bb.utils.contains('PACKAGECONFIG', 'glvnd', '', d.getVar('GLPROVIDES'), d)} \
-    ${@bb.utils.contains('PACKAGECONFIG', 'gbm', 'virtual/libgbm', '', d)} \
-    virtual/mesa \
-    "
 
 inherit meson pkgconfig python3native gettext features_check rust
 

-- 
2.50.1



^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v5 4/9] mesa: move BBCLASSEXTEND out of the include file
  2025-08-19  8:16 [PATCH v5 0/9] mesa: lighten up target's libclc dependencies and fix panfrost support Quentin Schulz
                   ` (2 preceding siblings ...)
  2025-08-19  8:16 ` [PATCH v5 3/9] mesa: move PROVIDES out of include file Quentin Schulz
@ 2025-08-19  8:16 ` Quentin Schulz
  2025-08-19  8:16 ` [PATCH v5 5/9] mesa: assign S in " Quentin Schulz
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 13+ messages in thread
From: Quentin Schulz @ 2025-08-19  8:16 UTC (permalink / raw)
  To: openembedded-core
  Cc: Dmitry Baryshkov, Markus Volk, Trevor Woerner, Ross Burton,
	Otavio Salvador, Quentin Schulz

From: Quentin Schulz <quentin.schulz@cherry.de>

We're going to have a new mesa-tools-native recipe include mesa.inc
soon. We don't need a target mesa-tools recipe for now so we'll go with
a native-only recipe which this BBCLASSEXTEND prevents us to do
properly, so let's move them to the recipes instead.

No intended change in behavior.

Signed-off-by: Quentin Schulz <quentin.schulz@cherry.de>
---
 meta/recipes-graphics/mesa/mesa-gl.bb | 2 ++
 meta/recipes-graphics/mesa/mesa.bb    | 2 ++
 meta/recipes-graphics/mesa/mesa.inc   | 2 --
 3 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/meta/recipes-graphics/mesa/mesa-gl.bb b/meta/recipes-graphics/mesa/mesa-gl.bb
index 42120687197d663a157786916392d52f8f180999..1a594a52f8c6dabbc282af0769b27a755d0e7b22 100644
--- a/meta/recipes-graphics/mesa/mesa-gl.bb
+++ b/meta/recipes-graphics/mesa/mesa-gl.bb
@@ -15,3 +15,5 @@ PACKAGECONFIG:append:x86 = " libclc gallium-llvm intel amd nouveau svga"
 PACKAGECONFIG:append:x86-64 = " libclc gallium-llvm intel amd nouveau svga"
 PACKAGECONFIG:append:i686 = " libclc gallium-llvm intel amd nouveau svga"
 PACKAGECONFIG:append:class-native = " libclc gallium-llvm amd nouveau svga"
+
+BBCLASSEXTEND = "native nativesdk"
diff --git a/meta/recipes-graphics/mesa/mesa.bb b/meta/recipes-graphics/mesa/mesa.bb
index 51d0384ef5930f36ff2f5c20ebad2d7ad8b817a9..db5eab5fb27c6a7228f6e0fd823514352c42ad1f 100644
--- a/meta/recipes-graphics/mesa/mesa.bb
+++ b/meta/recipes-graphics/mesa/mesa.bb
@@ -23,3 +23,5 @@ PROVIDES = " \
     ${@bb.utils.contains('PACKAGECONFIG', 'gbm', 'virtual/libgbm', '', d)} \
     virtual/mesa \
 "
+
+BBCLASSEXTEND = "native nativesdk"
diff --git a/meta/recipes-graphics/mesa/mesa.inc b/meta/recipes-graphics/mesa/mesa.inc
index 46fe465cd84ae9e799571d8c519a1d7933c716a6..4c079fe0aba8125763f0a598d6e114082a8453ee 100644
--- a/meta/recipes-graphics/mesa/mesa.inc
+++ b/meta/recipes-graphics/mesa/mesa.inc
@@ -43,8 +43,6 @@ EXTRANATIVEPATH += "chrpath-native"
 
 inherit meson pkgconfig python3native gettext features_check rust
 
-BBCLASSEXTEND = "native nativesdk"
-
 ANY_OF_DISTRO_FEATURES = "opengl vulkan"
 
 PLATFORMS ??= "${@bb.utils.filter('PACKAGECONFIG', 'x11 wayland', d)}"

-- 
2.50.1



^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v5 5/9] mesa: assign S in include file
  2025-08-19  8:16 [PATCH v5 0/9] mesa: lighten up target's libclc dependencies and fix panfrost support Quentin Schulz
                   ` (3 preceding siblings ...)
  2025-08-19  8:16 ` [PATCH v5 4/9] mesa: move BBCLASSEXTEND out of the " Quentin Schulz
@ 2025-08-19  8:16 ` Quentin Schulz
  2025-08-19  8:16 ` [PATCH v5 6/9] mesa-gl: make recipe target only Quentin Schulz
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 13+ messages in thread
From: Quentin Schulz @ 2025-08-19  8:16 UTC (permalink / raw)
  To: openembedded-core
  Cc: Dmitry Baryshkov, Markus Volk, Trevor Woerner, Ross Burton,
	Otavio Salvador, Quentin Schulz

From: Ross Burton <ross.burton@arm.com>

Anything including mesa.inc will have the sources extracted in
${UNPACKDIR}/mesa-${PV}.

The default for S is ${UNPACKDIR}/${BP}. ${BP} is ${BPN}-${PV}. Because
mesa.bb is named mesa, BPN will be mesa and thus S wasn't required for
mesa.bb but only for mesa-gl.bb. This also explains why this change is
fine for mesa.bb as the value of S won't have changed, the ${BPN} part
is now just hardcoded to "mesa" for mesa.bb instead.

No intended change in behavior.

Signed-off-by: Ross Burton <ross.burton@arm.com>
[added commit log and title]
Signed-off-by: Quentin Schulz <quentin.schulz@cherry.de>
---
 meta/recipes-graphics/mesa/mesa-gl.bb | 2 --
 meta/recipes-graphics/mesa/mesa.inc   | 2 ++
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/meta/recipes-graphics/mesa/mesa-gl.bb b/meta/recipes-graphics/mesa/mesa-gl.bb
index 1a594a52f8c6dabbc282af0769b27a755d0e7b22..979a6f97374741f5fd8716c87039af0a6ad37749 100644
--- a/meta/recipes-graphics/mesa/mesa-gl.bb
+++ b/meta/recipes-graphics/mesa/mesa-gl.bb
@@ -4,8 +4,6 @@ SUMMARY += " (OpenGL only, no EGL/GLES)"
 
 PROVIDES = "virtual/libgl virtual/mesa"
 
-S = "${UNPACKDIR}/mesa-${PV}"
-
 TARGET_CFLAGS = "-I${STAGING_INCDIR}/drm"
 
 # At least one DRI rendering engine is required to build mesa.
diff --git a/meta/recipes-graphics/mesa/mesa.inc b/meta/recipes-graphics/mesa/mesa.inc
index 4c079fe0aba8125763f0a598d6e114082a8453ee..45499f6c421e7fb0b06ef95179168c6cb9fff1cf 100644
--- a/meta/recipes-graphics/mesa/mesa.inc
+++ b/meta/recipes-graphics/mesa/mesa.inc
@@ -24,6 +24,8 @@ PV = "25.2.0"
 
 UPSTREAM_CHECK_GITTAGREGEX = "mesa-(?P<pver>\d+(\.\d+)+)"
 
+S = "${UNPACKDIR}/mesa-${PV}"
+
 #because we cannot rely on the fact that all apps will use pkgconfig,
 #make eglplatform.h independent of MESA_EGL_NO_X11_HEADER
 do_install:append() {

-- 
2.50.1



^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v5 6/9] mesa-gl: make recipe target only
  2025-08-19  8:16 [PATCH v5 0/9] mesa: lighten up target's libclc dependencies and fix panfrost support Quentin Schulz
                   ` (4 preceding siblings ...)
  2025-08-19  8:16 ` [PATCH v5 5/9] mesa: assign S in " Quentin Schulz
@ 2025-08-19  8:16 ` Quentin Schulz
  2025-08-19  8:16 ` [PATCH v5 7/9] mesa: add asahi to TOOLS when selected in PACKAGECONFIG Quentin Schulz
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 13+ messages in thread
From: Quentin Schulz @ 2025-08-19  8:16 UTC (permalink / raw)
  To: openembedded-core
  Cc: Dmitry Baryshkov, Markus Volk, Trevor Woerner, Ross Burton,
	Otavio Salvador, Quentin Schulz

From: Quentin Schulz <quentin.schulz@cherry.de>

According to the introducing commit log[1] and Dmitry's recollection[2],
the whole point of mesa-gl recipe is to provide GL library in case there
are vendor-provided GLES libraries.

Therefore, let's make this recipe target only by removing the
BBCLASSEXTEND variable.

No intended change in behavior for the target recipe.

[1] https://git.yoctoproject.org/poky/commit/?id=015cb13a67c672de30f5384dab5ab4b8db305281
[2] https://lore.kernel.org/openembedded-core/5ebxxyvkcur3zpef5krvyizomgdgtls4qau7s2i2mgcmvs2loy@ilcud37qk6sn/

Suggested-by: Ross Burton <ross.burton@arm.com>
Suggested-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Signed-off-by: Quentin Schulz <quentin.schulz@cherry.de>
---
 meta/recipes-graphics/mesa/mesa-gl.bb | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/meta/recipes-graphics/mesa/mesa-gl.bb b/meta/recipes-graphics/mesa/mesa-gl.bb
index 979a6f97374741f5fd8716c87039af0a6ad37749..86ea21d5c6daf39dd48905ff31eb5c5a5759c686 100644
--- a/meta/recipes-graphics/mesa/mesa-gl.bb
+++ b/meta/recipes-graphics/mesa/mesa-gl.bb
@@ -12,6 +12,3 @@ PACKAGECONFIG = "opengl gallium ${@bb.utils.contains('DISTRO_FEATURES', 'x11', '
 PACKAGECONFIG:append:x86 = " libclc gallium-llvm intel amd nouveau svga"
 PACKAGECONFIG:append:x86-64 = " libclc gallium-llvm intel amd nouveau svga"
 PACKAGECONFIG:append:i686 = " libclc gallium-llvm intel amd nouveau svga"
-PACKAGECONFIG:append:class-native = " libclc gallium-llvm amd nouveau svga"
-
-BBCLASSEXTEND = "native nativesdk"

-- 
2.50.1



^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v5 7/9] mesa: add asahi to TOOLS when selected in PACKAGECONFIG
  2025-08-19  8:16 [PATCH v5 0/9] mesa: lighten up target's libclc dependencies and fix panfrost support Quentin Schulz
                   ` (5 preceding siblings ...)
  2025-08-19  8:16 ` [PATCH v5 6/9] mesa-gl: make recipe target only Quentin Schulz
@ 2025-08-19  8:16 ` Quentin Schulz
  2025-08-19  8:16 ` [PATCH v5 8/9] mesa: use simpler mesa-tools-native recipe as dependency for libclc Quentin Schulz
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 13+ messages in thread
From: Quentin Schulz @ 2025-08-19  8:16 UTC (permalink / raw)
  To: openembedded-core
  Cc: Dmitry Baryshkov, Markus Volk, Trevor Woerner, Ross Burton,
	Otavio Salvador, Quentin Schulz

From: Quentin Schulz <quentin.schulz@cherry.de>

Similarly to panfrost and other PACKAGECONFIG, mesa has tools for asahi.
So let's build the tools whenever asked.

While the tools are often built regardless of their presence in the
"tools" mesa option whenever the appropriate gallium or vulkan driver is
built, this allows to build the tool(s) without building the drivers
which can be beneficial for native recipes where it makes little sense
to build drivers.

This will be useful for building asahi_clc precomp-compiler in native
mesa for example which only builds if:
 - one enables the asahi gallium driver, or
 - one enables the asahi vulkan driver, or
 - one builds the asahi tools
c.f. https://gitlab.freedesktop.org/mesa/mesa/-/blob/mesa-25.1.5/src/asahi/meson.build?ref_type=tags#L12-L17

Signed-off-by: Quentin Schulz <quentin.schulz@cherry.de>
---
 meta/recipes-graphics/mesa/mesa.inc | 1 +
 1 file changed, 1 insertion(+)

diff --git a/meta/recipes-graphics/mesa/mesa.inc b/meta/recipes-graphics/mesa/mesa.inc
index 45499f6c421e7fb0b06ef95179168c6cb9fff1cf..81b099bf6e5fe624e91e6a780f8bb55854580c2d 100644
--- a/meta/recipes-graphics/mesa/mesa.inc
+++ b/meta/recipes-graphics/mesa/mesa.inc
@@ -100,6 +100,7 @@ PACKAGECONFIG[vulkan] = "-Dvulkan-drivers=${@strip_comma('${VULKAN_DRIVERS}')},
 # mesa development and testing tools support, per driver
 TOOLS = ""
 TOOLS_DEPS = ""
+TOOLS:append = "${@bb.utils.contains('PACKAGECONFIG', 'asahi', ',asahi', '', d)}"
 TOOLS:append = "${@bb.utils.contains('PACKAGECONFIG', 'etnaviv', ',etnaviv', '', d)}"
 TOOLS:append = "${@bb.utils.contains('PACKAGECONFIG', 'freedreno', ',freedreno', '', d)}"
 TOOLS:append = "${@bb.utils.contains('PACKAGECONFIG', 'lima', ',lima', '', d)}"

-- 
2.50.1



^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v5 8/9] mesa: use simpler mesa-tools-native recipe as dependency for libclc
  2025-08-19  8:16 [PATCH v5 0/9] mesa: lighten up target's libclc dependencies and fix panfrost support Quentin Schulz
                   ` (6 preceding siblings ...)
  2025-08-19  8:16 ` [PATCH v5 7/9] mesa: add asahi to TOOLS when selected in PACKAGECONFIG Quentin Schulz
@ 2025-08-19  8:16 ` Quentin Schulz
  2025-08-19  8:16 ` [PATCH v5 9/9] mesa: fix panfrost driver build Quentin Schulz
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 13+ messages in thread
From: Quentin Schulz @ 2025-08-19  8:16 UTC (permalink / raw)
  To: openembedded-core
  Cc: Dmitry Baryshkov, Markus Volk, Trevor Woerner, Ross Burton,
	Otavio Salvador, Quentin Schulz

From: Quentin Schulz <quentin.schulz@cherry.de>

libclc is required for some drivers (asahi, panfrost and intel at the
very least).
libclc brings very expensive dependencies such as llvm and clang.
Building clang and llvm for each target architecture is very expensive,
but mesa allows to depend on prebuilt host binaries (mesa-clc and
precomp-compiler). Those are built by mesa as well, but can be compiled
in mesa-native instead of mesa, making the dependency expensive but only
once regardless of the number of target architectures to build for.
Ideally the mesa-clc and precomp-compiler would only be compiled in
mesa-native if target mesa requires libclc support, however this is not
possible as a target recipe cannot impact or depend on a native recipe's
configuration. We thus have two choices, always build libclc in
mesa-native with its heavy dependencies and impact every build or force
the user to modify the mesa-native recipe in a custom layer (as a native
recipe cannot use target's OVERRIDES). The latter is unacceptable so the
former seems to be the only option. Another big downside is that
mesa-native currently builds drivers (amd, nouveau, svga) which we may
have absolutely no interest in building, increasing the build time and
possibly dependencies list).

A third choice is to spin-off the native mesa recipe with libclc support
into a new recipe without drivers and only what's necessary to build
mesa-clc and precomp-compiler binaries.
This allows to keep a "clean" mesa-native recipe for whoever needs those
drivers built-in (e.g. for testing, for qemu-native, or whatever else)
and only bring the libclc dependency when required by the target recipe.

Because libclc is now only built for the host, opencl support now needs
to explicitly bring libclc and others to build as libclc won't bring it
in the build environment anymore.

Suggested-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Quentin Schulz <quentin.schulz@cherry.de>
---
 meta/recipes-graphics/mesa/mesa-tools-native.bb | 19 +++++++++++++++++++
 meta/recipes-graphics/mesa/mesa.inc             | 15 ++++-----------
 2 files changed, 23 insertions(+), 11 deletions(-)

diff --git a/meta/recipes-graphics/mesa/mesa-tools-native.bb b/meta/recipes-graphics/mesa/mesa-tools-native.bb
new file mode 100644
index 0000000000000000000000000000000000000000..144b5101f155c4be9fca9f72add4aa41c8b80e59
--- /dev/null
+++ b/meta/recipes-graphics/mesa/mesa-tools-native.bb
@@ -0,0 +1,19 @@
+require mesa.inc
+inherit native
+
+SUMMARY += " (tools only)"
+
+PACKAGECONFIG = "tools asahi intel panfrost"
+# llvm required for libclc
+PACKAGECONFIG += "gallium-llvm"
+# Doesn't compile without wayland-scanner if PLATFORMS has wayland in, and,
+# doesn't compile at all if PLATFORMS is empty so add x11 and wayland
+# to PACKAGECONFIG like in mesa.inc
+PACKAGECONFIG += "${@bb.utils.filter('DISTRO_FEATURES', 'x11 wayland', d)}"
+
+DEPENDS += "libclc-native spirv-tools-native spirv-llvm-translator-native"
+
+EXTRA_OEMESON += " \
+    -Dmesa-clc=enabled -Dinstall-mesa-clc=true -Dmesa-clc-bundle-headers=enabled \
+    -Dprecomp-compiler=enabled -Dinstall-precomp-compiler=true \
+"
diff --git a/meta/recipes-graphics/mesa/mesa.inc b/meta/recipes-graphics/mesa/mesa.inc
index 81b099bf6e5fe624e91e6a780f8bb55854580c2d..e4c606e4a253a5c2b0d641fbae7156665dc447a2 100644
--- a/meta/recipes-graphics/mesa/mesa.inc
+++ b/meta/recipes-graphics/mesa/mesa.inc
@@ -125,9 +125,9 @@ PACKAGECONFIG[gles] = "-Dgles1=enabled -Dgles2=enabled, -Dgles1=disabled -Dgles2
 # "egl" requires "opengl"
 PACKAGECONFIG[egl] = "-Degl=enabled, -Degl=disabled"
 
-# "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-rusticl=true, -Dgallium-rusticl=false, bindgen-cli-native"
+# "opencl" also requires gallium-llvm to be present in PACKAGECONFIG!
+# Be sure to enable it for the target and for the native build.
+PACKAGECONFIG[opencl] = "-Dgallium-rusticl=true, -Dgallium-rusticl=false, bindgen-cli-native libclc spirv-tools spirv-llvm-translator"
 
 PACKAGECONFIG[broadcom] = ""
 PACKAGECONFIG[etnaviv] = ",,python3-pycparser-native"
@@ -166,16 +166,9 @@ GALLIUMDRIVERS:append = "${@bb.utils.contains('PACKAGECONFIG', 'gallium-llvm', '
 GALLIUMDRIVERS:append = "${@bb.utils.contains('PACKAGECONFIG', 'amd', ',r600', '', d)}"
 GALLIUMDRIVERS:append = "${@bb.utils.contains('PACKAGECONFIG', 'virgl', ',virgl', '', d)}"
 
-MESA_CLC = "system"
-MESA_CLC:class-native = "enabled"
-INSTALL_MESA_CLC = "false"
-INSTALL_MESA_CLC:class-native = "true"
-MESA_NATIVE = "mesa-native"
-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} -Dmesa-clc-bundle-headers=enabled,,libclc spirv-tools spirv-llvm-translator ${MESA_NATIVE}"
+PACKAGECONFIG[libclc] = "-Dmesa-clc=system -Dprecomp-compiler=system,,mesa-tools-native"
 PACKAGECONFIG[va] = "-Dgallium-va=enabled,-Dgallium-va=disabled,libva-initial"
 PACKAGECONFIG[vdpau] = "-Dgallium-vdpau=enabled,-Dgallium-vdpau=disabled,libvdpau"
 

-- 
2.50.1



^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v5 9/9] mesa: fix panfrost driver build
  2025-08-19  8:16 [PATCH v5 0/9] mesa: lighten up target's libclc dependencies and fix panfrost support Quentin Schulz
                   ` (7 preceding siblings ...)
  2025-08-19  8:16 ` [PATCH v5 8/9] mesa: use simpler mesa-tools-native recipe as dependency for libclc Quentin Schulz
@ 2025-08-19  8:16 ` Quentin Schulz
  2025-08-19 14:03 ` [OE-core] [PATCH v5 0/9] mesa: lighten up target's libclc dependencies and fix panfrost support Mathieu Dubois-Briand
  2025-08-19 18:33 ` Dmitry Baryshkov
  10 siblings, 0 replies; 13+ messages in thread
From: Quentin Schulz @ 2025-08-19  8:16 UTC (permalink / raw)
  To: openembedded-core
  Cc: Dmitry Baryshkov, Markus Volk, Trevor Woerner, Ross Burton,
	Otavio Salvador, Quentin Schulz

From: Quentin Schulz <quentin.schulz@cherry.de>

Panfrost drivers require libclc, so let's force libclc to be present in
the PACKAGECONFIG to build the drivers.

Reported-by: Trevor Woerner <twoerner@gmail.com>
Signed-off-by: Quentin Schulz <quentin.schulz@cherry.de>
---
 meta/recipes-graphics/mesa/mesa.inc | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/meta/recipes-graphics/mesa/mesa.inc b/meta/recipes-graphics/mesa/mesa.inc
index e4c606e4a253a5c2b0d641fbae7156665dc447a2..d38f96429ceb07311c236e7f183e224667a4c094 100644
--- a/meta/recipes-graphics/mesa/mesa.inc
+++ b/meta/recipes-graphics/mesa/mesa.inc
@@ -94,7 +94,7 @@ VULKAN_DRIVERS:append = "${@bb.utils.contains('PACKAGECONFIG', 'freedreno', ',fr
 VULKAN_DRIVERS:append = "${@bb.utils.contains('PACKAGECONFIG', 'broadcom', ',broadcom', '', d)}"
 VULKAN_DRIVERS:append = "${@bb.utils.contains('PACKAGECONFIG', 'gallium-llvm', '${VULKAN_DRIVERS_LLVM}', '', d)}"
 VULKAN_DRIVERS:append = "${@bb.utils.contains('PACKAGECONFIG', 'imagination', ',imagination-experimental', '', d)}"
-VULKAN_DRIVERS:append = "${@bb.utils.contains('PACKAGECONFIG', 'panfrost', ',panfrost', '', d)}"
+VULKAN_DRIVERS:append = "${@bb.utils.contains('PACKAGECONFIG', 'panfrost libclc', ',panfrost', '', d)}"
 PACKAGECONFIG[vulkan] = "-Dvulkan-drivers=${@strip_comma('${VULKAN_DRIVERS}')}, -Dvulkan-drivers='',glslang-native vulkan-loader vulkan-headers"
 
 # mesa development and testing tools support, per driver
@@ -183,7 +183,7 @@ PACKAGECONFIG[lima] = ""
 GALLIUMDRIVERS:append = "${@bb.utils.contains('PACKAGECONFIG', 'lima', ',lima', '', d)}"
 
 PACKAGECONFIG[panfrost] = ""
-GALLIUMDRIVERS:append = "${@bb.utils.contains('PACKAGECONFIG', 'panfrost', ',panfrost', '', d)}"
+GALLIUMDRIVERS:append = "${@bb.utils.contains('PACKAGECONFIG', 'panfrost libclc', ',panfrost', '', d)}"
 
 PACKAGECONFIG[tegra] = ""
 GALLIUMDRIVERS:append = "${@bb.utils.contains('PACKAGECONFIG', 'tegra', ',tegra,nouveau', '', d)}"

-- 
2.50.1



^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [OE-core] [PATCH v5 0/9] mesa: lighten up target's libclc dependencies and fix panfrost support
  2025-08-19  8:16 [PATCH v5 0/9] mesa: lighten up target's libclc dependencies and fix panfrost support Quentin Schulz
                   ` (8 preceding siblings ...)
  2025-08-19  8:16 ` [PATCH v5 9/9] mesa: fix panfrost driver build Quentin Schulz
@ 2025-08-19 14:03 ` Mathieu Dubois-Briand
  2025-08-19 18:33 ` Dmitry Baryshkov
  10 siblings, 0 replies; 13+ messages in thread
From: Mathieu Dubois-Briand @ 2025-08-19 14:03 UTC (permalink / raw)
  To: Quentin Schulz, openembedded-core
  Cc: Dmitry Baryshkov, Markus Volk, Trevor Woerner, Ross Burton,
	Otavio Salvador, Quentin Schulz

Hi Quentin,

Thanks for your patch.

It looks like this is causing some issue:
ERROR: libepoxy-native-1.5.10-r0 do_prepare_recipe_sysroot: The file /usr/share/drirc.d/00-mesa-defaults.conf is installed by both mesa-native and mesa-tools-native, aborting
ERROR: libsdl2-native-2.32.8-r0 do_prepare_recipe_sysroot: The file /usr/share/drirc.d/00-mesa-defaults.conf is installed by both mesa-native and mesa-tools-native, aborting

https://autobuilder.yoctoproject.org/valkyrie/#/builders/73/builds/2135
https://autobuilder.yoctoproject.org/valkyrie/#/builders/63/builds/2073

Can you have a loot at it please?

Best regards,
Mathieu

-- 
Mathieu Dubois-Briand, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [OE-core] [PATCH v5 1/9] mesa-gl: make mesa-gl really openGL-only
  2025-08-19  8:16 ` [PATCH v5 1/9] mesa-gl: make mesa-gl really openGL-only Quentin Schulz
@ 2025-08-19 17:57   ` Khem Raj
  0 siblings, 0 replies; 13+ messages in thread
From: Khem Raj @ 2025-08-19 17:57 UTC (permalink / raw)
  To: foss
  Cc: openembedded-core, Dmitry Baryshkov, Markus Volk, Trevor Woerner,
	Ross Burton, Otavio Salvador, Quentin Schulz

On Tue, Aug 19, 2025 at 1:16 AM Quentin Schulz via
lists.openembedded.org <foss=0leil.net@lists.openembedded.org> wrote:
>
> From: Quentin Schulz <quentin.schulz@cherry.de>
>
> The ??= operator for PACKAGECONFIG doesn't actually do anything because
> the recipe includes mesa.inc which already sets this variable (with the
> = operator).
>
> This probably wasn't noticed until now because mesa-gl is likely only
> ever built in its target flavor which was already set correctly thanks
> to the :class-target override.
>
> This essentially only make mesa-gl-native and nativesdk-mesa-gl follow
> the same configuration as the target.
>
> Suggested-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
> Signed-off-by: Quentin Schulz <quentin.schulz@cherry.de>
> ---
>  meta/recipes-graphics/mesa/mesa-gl.bb | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/meta/recipes-graphics/mesa/mesa-gl.bb b/meta/recipes-graphics/mesa/mesa-gl.bb
> index e2f03c81c4588c6257ffec2892fef7fcbe9f82bf..35d6dc854cf4dfac7a757e333e25e4ddeab10b6e 100644
> --- a/meta/recipes-graphics/mesa/mesa-gl.bb
> +++ b/meta/recipes-graphics/mesa/mesa-gl.bb
> @@ -9,6 +9,4 @@ S = "${UNPACKDIR}/mesa-${PV}"
>  TARGET_CFLAGS = "-I${STAGING_INCDIR}/drm"
>
>  # At least one DRI rendering engine is required to build mesa.
> -PACKAGECONFIG ??= "opengl gallium ${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'x11', '', d)}"
> -PACKAGECONFIG:class-target = "opengl gallium ${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'x11', '', d)}"
> -
> +PACKAGECONFIG = "opengl gallium ${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'x11', '', d)}"

you can use bb.utils.filter here e.g.
${@bb.utils.filter('DISTRO_FEATURES', 'x11', d)}

>
> --
> 2.50.1
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#222077): https://lists.openembedded.org/g/openembedded-core/message/222077
> Mute This Topic: https://lists.openembedded.org/mt/114777987/1997914
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [raj.khem@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v5 0/9] mesa: lighten up target's libclc dependencies and fix panfrost support
  2025-08-19  8:16 [PATCH v5 0/9] mesa: lighten up target's libclc dependencies and fix panfrost support Quentin Schulz
                   ` (9 preceding siblings ...)
  2025-08-19 14:03 ` [OE-core] [PATCH v5 0/9] mesa: lighten up target's libclc dependencies and fix panfrost support Mathieu Dubois-Briand
@ 2025-08-19 18:33 ` Dmitry Baryshkov
  10 siblings, 0 replies; 13+ messages in thread
From: Dmitry Baryshkov @ 2025-08-19 18:33 UTC (permalink / raw)
  To: Quentin Schulz
  Cc: openembedded-core, Markus Volk, Trevor Woerner, Ross Burton,
	Otavio Salvador, Quentin Schulz

On Tue, Aug 19, 2025 at 10:16:00AM +0200, Quentin Schulz wrote:
> @Otavio, can I add the new mesa-tools-native recipe under your
> maintainership in meta/conf/distro/include/maintainers.inc, it is after
> all still mesa?
> 
> Panfrost support has been broken for a while already because it now
> requires libclc which isn't enforced by default. This fixes this
> oversight.
> 
> While re-adding support for panfrost, the build time for libclc were a
> bit too much to my taste and I tried to figure out if we could lighten
> up the dependencies for the target recipe and it seems to be the case.
> 
> libclc brings very expensive dependencies such as llvm and clang.
> Building clang and llvm for each target architecture is very expensive,
> but mesa allows to depend on prebuilt host binaries (mesa-clc and
> precomp-compiler). Those are built by mesa as well, but can be compiled
> in mesa-native instead of mesa, making the dependency expensive but only
> once regardless of the number of target architectures to build for.
> Ideally the mesa-clc and precomp-compiler would only be compiled in
> mesa-native if target mesa requires libclc support, however this is not
> possible as a target recipe cannot impact or depend on a native recipe's
> configuration. We thus have two choices, always build libclc in
> mesa-native with its heavy dependencies and impact every build or force
> the user to modify the mesa-native recipe in a custom layer (as a native
> recipe cannot use target's OVERRIDES). The latter is unacceptable so the
> former seems to be the only option. Another big downside is that
> mesa-native currently builds drivers (amd, nouveau, svga) which we may
> have absolutely no interest in building, increasing the build time and
> possibly dependencies list).
> 
> A third choice is to spin-off the native mesa recipe with libclc support
> into a new recipe without drivers and only what's necessary to build
> mesa-clc and precomp-compiler binaries.
> This allows to keep a "clean" mesa-native recipe for whoever needs those
> drivers built-in (e.g. for testing, for qemu-native, or whatever else)
> and only bring the libclc dependency when required by the target recipe.
> 
> Because libclc is now only built for the host, opencl support now needs
> to explicitly bring libclc and others to build as libclc won't bring it
> in the build environment anymore.
> 
> Note that this was essentially only build tested (run tested on RK3588
> with panfrost though).
> 
> I tried to enable OpenCL support but it triggers a buildpaths QA error,
> which can be worked around with the following patch:

A much easier fix would be the following. Please consider incorporating
it.

diff --git a/meta/recipes-graphics/mesa/mesa.inc b/meta/recipes-graphics/mesa/mesa.inc
index d38f96429ceb..ab1290dfbb84 100644
--- a/meta/recipes-graphics/mesa/mesa.inc
+++ b/meta/recipes-graphics/mesa/mesa.inc
@@ -127,7 +127,7 @@ PACKAGECONFIG[egl] = "-Degl=enabled, -Degl=disabled"

 # "opencl" also requires gallium-llvm to be present in PACKAGECONFIG!
 # Be sure to enable it for the target and for the native build.
-PACKAGECONFIG[opencl] = "-Dgallium-rusticl=true, -Dgallium-rusticl=false, bindgen-cli-native libclc spirv-tools spirv-llvm-translator"
+PACKAGECONFIG[opencl] = "-Dgallium-rusticl=true -Dmesa-clc-bundle-headers=enabled, -Dgallium-rusticl=false, bindgen-cli-native libclc spirv-tools spirv-llvm-translator"

 PACKAGECONFIG[broadcom] = ""
 PACKAGECONFIG[etnaviv] = ",,python3-pycparser-native"



-- 
With best wishes
Dmitry


^ permalink raw reply related	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2025-08-19 18:33 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-19  8:16 [PATCH v5 0/9] mesa: lighten up target's libclc dependencies and fix panfrost support Quentin Schulz
2025-08-19  8:16 ` [PATCH v5 1/9] mesa-gl: make mesa-gl really openGL-only Quentin Schulz
2025-08-19 17:57   ` [OE-core] " Khem Raj
2025-08-19  8:16 ` [PATCH v5 2/9] mesa: move PACKAGECONFIG defaults to recipes Quentin Schulz
2025-08-19  8:16 ` [PATCH v5 3/9] mesa: move PROVIDES out of include file Quentin Schulz
2025-08-19  8:16 ` [PATCH v5 4/9] mesa: move BBCLASSEXTEND out of the " Quentin Schulz
2025-08-19  8:16 ` [PATCH v5 5/9] mesa: assign S in " Quentin Schulz
2025-08-19  8:16 ` [PATCH v5 6/9] mesa-gl: make recipe target only Quentin Schulz
2025-08-19  8:16 ` [PATCH v5 7/9] mesa: add asahi to TOOLS when selected in PACKAGECONFIG Quentin Schulz
2025-08-19  8:16 ` [PATCH v5 8/9] mesa: use simpler mesa-tools-native recipe as dependency for libclc Quentin Schulz
2025-08-19  8:16 ` [PATCH v5 9/9] mesa: fix panfrost driver build Quentin Schulz
2025-08-19 14:03 ` [OE-core] [PATCH v5 0/9] mesa: lighten up target's libclc dependencies and fix panfrost support Mathieu Dubois-Briand
2025-08-19 18:33 ` Dmitry Baryshkov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox