From patchwork Fri Aug 1 11:03:16 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Quentin Schulz X-Patchwork-Id: 67871 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 188FECA0EC4 for ; Fri, 1 Aug 2025 11:04:18 +0000 (UTC) Received: from smtp-bc0d.mail.infomaniak.ch (smtp-bc0d.mail.infomaniak.ch [45.157.188.13]) by mx.groups.io with SMTP id smtpd.web11.84910.1754046256738026405 for ; Fri, 01 Aug 2025 04:04:17 -0700 Authentication-Results: mx.groups.io; dkim=none (message not signed); spf=pass (domain: 0leil.net, ip: 45.157.188.13, mailfrom: foss+yocto@0leil.net) Received: from smtp-4-0001.mail.infomaniak.ch (smtp-4-0001.mail.infomaniak.ch [10.7.10.108]) by smtp-4-3000.mail.infomaniak.ch (Postfix) with ESMTPS id 4btjkl2KZTzgSV; Fri, 1 Aug 2025 13:04:15 +0200 (CEST) Received: from unknown by smtp-4-0001.mail.infomaniak.ch (Postfix) with ESMTPA id 4btjkh5R8lzYwk; Fri, 1 Aug 2025 13:04:12 +0200 (CEST) From: Quentin Schulz Date: Fri, 01 Aug 2025 13:03:16 +0200 Subject: [PATCH RFC v4 8/9] mesa: use simpler mesa-tools-native recipe as dependency for libclc MIME-Version: 1.0 Message-Id: <20250801-mesa-libclc-panfrost-v4-8-101c6dcf564f@cherry.de> References: <20250801-mesa-libclc-panfrost-v4-0-101c6dcf564f@cherry.de> In-Reply-To: <20250801-mesa-libclc-panfrost-v4-0-101c6dcf564f@cherry.de> To: openembedded-core@lists.openembedded.org Cc: Dmitry Baryshkov , Markus Volk , Trevor Woerner , Ross Burton , Otavio Salvador , Quentin Schulz X-Mailer: b4 0.14.2 X-Infomaniak-Routing: alpha List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Fri, 01 Aug 2025 11:04:18 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/221238 From: Quentin Schulz 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 Signed-off-by: Quentin Schulz --- 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 cb78fae031fd7599894d02d4e54093d0a3e5cdfb..e0a1cde3361f39a19503f797f43cec1e4cf1d4d1 100644 --- a/meta/recipes-graphics/mesa/mesa.inc +++ b/meta/recipes-graphics/mesa/mesa.inc @@ -127,9 +127,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" @@ -168,16 +168,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"