From: Quentin Schulz <[email protected]>

libclc is required for some drivers (asahi, panfrost and intel at the
very least).

libclc brings very expensive dependencies such as llvm (through its
spirv-llvm-translator dependency) 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.

This is the native mesa tool recipe from the third choice. The next
commit will make use of it in the mesa recipes.

Suggested-by: Ross Burton <[email protected]>
Signed-off-by: Quentin Schulz <[email protected]>
---
 meta/conf/distro/include/maintainers.inc        |  1 +
 meta/recipes-graphics/mesa/mesa-tools-native.bb | 19 +++++++++++++++++++
 2 files changed, 20 insertions(+)

diff --git a/meta/conf/distro/include/maintainers.inc 
b/meta/conf/distro/include/maintainers.inc
index b231daf485..40b1c45a4f 100644
--- a/meta/conf/distro/include/maintainers.inc
+++ b/meta/conf/distro/include/maintainers.inc
@@ -525,6 +525,7 @@ RECIPE_MAINTAINER:pn-menu-cache = "Ross Burton 
<[email protected]>"
 RECIPE_MAINTAINER:pn-mesa = "Unassigned <[email protected]>"
 RECIPE_MAINTAINER:pn-mesa-demos = "Unassigned <[email protected]>"
 RECIPE_MAINTAINER:pn-mesa-gl = "Unassigned <[email protected]>"
+RECIPE_MAINTAINER:pn-mesa-tools-native = "Unassigned 
<[email protected]>"
 RECIPE_MAINTAINER:pn-meson = "Trevor Gamblin <[email protected]>"
 RECIPE_MAINTAINER:pn-meta-environment-${MACHINE} = "Richard Purdie 
<[email protected]>"
 RECIPE_MAINTAINER:pn-meta-environment-extsdk-${MACHINE} = "Richard Purdie 
<[email protected]>"
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 0000000000..50d2f5cbb0
--- /dev/null
+++ b/meta/recipes-graphics/mesa/mesa-tools-native.bb
@@ -0,0 +1,19 @@
+require mesa.inc
+inherit_defer native
+
+SUMMARY += " (tools only)"
+
+PACKAGECONFIG = "tools asahi 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 \
+"

-- 
2.53.0

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#230637): 
https://lists.openembedded.org/g/openembedded-core/message/230637
Mute This Topic: https://lists.openembedded.org/mt/117675190/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to