diff mbox series

[RFC,2/4] mesa: use native precompiled compilers instead of compiling them for the target recipe

Message ID 20250624-mesa-libclc-panfrost-v1-2-9ed8ca980e21@cherry.de
State New
Headers show
Series mesa: lighten up target's libclc dependencies and fix panfrost support | expand

Commit Message

Quentin Schulz June 24, 2025, 12:44 p.m. UTC
From: Quentin Schulz <quentin.schulz@cherry.de>

Make mesa-native build and install precompiled compilers so that mesa
can use them.

The goal is to eventually remove the heavy dependencies for libclc in
the mesa target recipe.

As far as I know, this needs libclc in mesa-native but it's already
enabled by default.

Because we would need the mesa target recipe to know whether the
mesa-native has built and installed the precompiled compilers in order
to make use of them in the target recipe and that it is not possible to
do that (as it crosses the recipe boundary), we force the building and
installing of the precompiled compilers in mesa-native.

Since asahi and panfrost both have precompiled compilers, they are now
added to the default native PACKAGECONFIG. We technically wouldn't need
to build the drivers since only the tools are required in the native
recipe but this is necessary for both to appear in TOOLS variable, so
we'll leave it at that for the moment. We also don't really need to
compile panfrost and asahi drivers, only the panfrost and asahi tools
but the latter cannot be enabled without the former with the current
state of the recipe.

Signed-off-by: Quentin Schulz <quentin.schulz@cherry.de>
---
 meta/recipes-graphics/mesa/mesa.inc | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/meta/recipes-graphics/mesa/mesa.inc b/meta/recipes-graphics/mesa/mesa.inc
index 1355c0c3ba5ee07ec24bc5e05f6adf0e17e9782a..330a04f1b098a2d3a6874f40feabe8836dd4cb37 100644
--- a/meta/recipes-graphics/mesa/mesa.inc
+++ b/meta/recipes-graphics/mesa/mesa.inc
@@ -73,7 +73,14 @@  def check_buildtype(d):
     return 'plain'
 MESON_BUILDTYPE = "${@check_buildtype(d)}"
 
+PRECOMP_COMPILER = "system"
+PRECOMP_COMPILER:class-native = "enabled"
+INSTALL_PRECOMP_COMPILER = "false"
+INSTALL_PRECOMP_COMPILER:class-native = "true"
+
 EXTRA_OEMESON = " \
+    -Dprecomp-compiler=${PRECOMP_COMPILER} \
+    -Dinstall-precomp-compiler=${INSTALL_PRECOMP_COMPILER} \
     -Dglx-read-only-text=true \
     -Dplatforms='${@",".join("${PLATFORMS}".split())}' \
 "
@@ -95,7 +102,7 @@  INHIBIT_DEFAULT_RUST_DEPS = "${@bb.utils.contains('PACKAGECONFIG', 'opencl', '',
 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"
+PACKAGECONFIG:append:class-native = " libclc gallium-llvm amd nouveau svga panfrost asahi tools"
 
 # "gbm" requires "opengl"
 PACKAGECONFIG[gbm] = "-Dgbm=enabled,-Dgbm=disabled"
@@ -205,7 +212,8 @@  PACKAGECONFIG[vdpau] = "-Dgallium-vdpau=enabled,-Dgallium-vdpau=disabled,libvdpa
 
 PACKAGECONFIG[imagination] = "-Dimagination-srv=true,-Dimagination-srv=false"
 
-PACKAGECONFIG[asahi] = ""
+# Asahi requires precompiled compilers from mesa-native
+PACKAGECONFIG[asahi] = ",,${MESA_NATIVE}"
 
 PACKAGECONFIG[intel] = ""
 GALLIUMDRIVERS:append = "${@bb.utils.contains('PACKAGECONFIG', 'intel', ',i915,crocus', '', d)}"
@@ -213,7 +221,8 @@  GALLIUMDRIVERS:append = "${@bb.utils.contains('PACKAGECONFIG', 'intel', ',i915,c
 PACKAGECONFIG[lima] = ""
 GALLIUMDRIVERS:append = "${@bb.utils.contains('PACKAGECONFIG', 'lima', ',lima', '', d)}"
 
-PACKAGECONFIG[panfrost] = ""
+# Panfrost requires precompiled compilers from mesa-native
+PACKAGECONFIG[panfrost] = ",,${MESA_NATIVE}"
 GALLIUMDRIVERS:append = "${@bb.utils.contains('PACKAGECONFIG', 'panfrost', ',panfrost', '', d)}"
 
 PACKAGECONFIG[tegra] = ""