Message ID | 20250624-mesa-libclc-panfrost-v1-3-9ed8ca980e21@cherry.de |
---|---|
State | New |
Headers | show |
Series | mesa: lighten up target's libclc dependencies and fix panfrost support | expand |
On Tue, Jun 24, 2025 at 02:44:26PM +0200, Quentin Schulz wrote: > From: Quentin Schulz <quentin.schulz@cherry.de> > > By using mesa-native mesa-clc instead of libclc, we do not actually need > most of the heavy dependencies of the libclc PACKAGECONFIG as we simply > need to use the natively compiled mesa-clc instead. We thus can simply > depend on mesa-native for the target recipe. > > libclc however is still required if opencl (rusticl) is selected. > > Because asahi drivers are only enabled when libclc is also selected, we > can now remove the explicit dependency on MESA_NATIVE. > We do the same for panfrost even though libclc isn't enforced yet for > mesa for the target. Support for panfrost has been broken for a while > already anyway (because of the possibly missing libclc) but we'll fix it > in a later commit. > > Signed-off-by: Quentin Schulz <quentin.schulz@cherry.de> > --- > meta/recipes-graphics/mesa/mesa.inc | 19 +++++++++++-------- > 1 file changed, 11 insertions(+), 8 deletions(-) > > diff --git a/meta/recipes-graphics/mesa/mesa.inc b/meta/recipes-graphics/mesa/mesa.inc > index 330a04f1b098a2d3a6874f40feabe8836dd4cb37..eafe1697c48edc661b33a54c5856d8e577608fd5 100644 > --- a/meta/recipes-graphics/mesa/mesa.inc > +++ b/meta/recipes-graphics/mesa/mesa.inc > @@ -158,7 +158,7 @@ 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" > +PACKAGECONFIG[opencl] = "-Dgallium-rusticl=true, -Dgallium-rusticl=false, bindgen-cli-native libclc spirv-tools spirv-llvm-translator" > > PACKAGECONFIG[broadcom] = "" > PACKAGECONFIG[etnaviv] = ",,python3-pycparser-native" > @@ -201,19 +201,21 @@ 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 = "" > +# Reuse libclc from mesa-native instead of bringing heavy dependencies > +LIBCLC_DEPS = "mesa-native" > +LIBCLC_DEPS:class-native = "libclc spirv-tools spirv-llvm-translator" > > 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=${MESA_CLC} -Dinstall-mesa-clc=${INSTALL_MESA_CLC} -Dmesa-clc-bundle-headers=enabled,,${LIBCLC_DEPS}" I think it might be easier to drop this completely and to move meson arguments to EXTRA_OEMESON (next to precomp-compiler options that you've added). This way native builds will always build a full configuration with mesa-clc, precomp compilers and other required drivers, while the targets builds can be really optimal and won't require 'foo libclc' hurdle. > PACKAGECONFIG[va] = "-Dgallium-va=enabled,-Dgallium-va=disabled,libva-initial" > PACKAGECONFIG[vdpau] = "-Dgallium-vdpau=enabled,-Dgallium-vdpau=disabled,libvdpau" > > PACKAGECONFIG[imagination] = "-Dimagination-srv=true,-Dimagination-srv=false" > > -# Asahi requires precompiled compilers from mesa-native > -PACKAGECONFIG[asahi] = ",,${MESA_NATIVE}" > +# Asahi requires precompiled compilers and libclc from mesa-native > +# Make sure libclc is in mesa-native AND mesa PACKAGECONFIG > +PACKAGECONFIG[asahi] = "" > > PACKAGECONFIG[intel] = "" > GALLIUMDRIVERS:append = "${@bb.utils.contains('PACKAGECONFIG', 'intel', ',i915,crocus', '', d)}" > @@ -221,8 +223,9 @@ GALLIUMDRIVERS:append = "${@bb.utils.contains('PACKAGECONFIG', 'intel', ',i915,c > PACKAGECONFIG[lima] = "" > GALLIUMDRIVERS:append = "${@bb.utils.contains('PACKAGECONFIG', 'lima', ',lima', '', d)}" > > -# Panfrost requires precompiled compilers from mesa-native > -PACKAGECONFIG[panfrost] = ",,${MESA_NATIVE}" > +# Panfrost requires precompiled compilers and libclc from mesa-native > +# Make sure libclc is in mesa-native AND mesa PACKAGECONFIG > +PACKAGECONFIG[panfrost] = "" > GALLIUMDRIVERS:append = "${@bb.utils.contains('PACKAGECONFIG', 'panfrost', ',panfrost', '', d)}" > > PACKAGECONFIG[tegra] = "" > > -- > 2.49.0 > >
Hi Dmitry, On 6/24/25 3:35 PM, Dmitry Baryshkov wrote: > On Tue, Jun 24, 2025 at 02:44:26PM +0200, Quentin Schulz wrote: >> From: Quentin Schulz <quentin.schulz@cherry.de> >> >> By using mesa-native mesa-clc instead of libclc, we do not actually need >> most of the heavy dependencies of the libclc PACKAGECONFIG as we simply >> need to use the natively compiled mesa-clc instead. We thus can simply >> depend on mesa-native for the target recipe. >> >> libclc however is still required if opencl (rusticl) is selected. >> >> Because asahi drivers are only enabled when libclc is also selected, we >> can now remove the explicit dependency on MESA_NATIVE. >> We do the same for panfrost even though libclc isn't enforced yet for >> mesa for the target. Support for panfrost has been broken for a while >> already anyway (because of the possibly missing libclc) but we'll fix it >> in a later commit. >> >> Signed-off-by: Quentin Schulz <quentin.schulz@cherry.de> >> --- >> meta/recipes-graphics/mesa/mesa.inc | 19 +++++++++++-------- >> 1 file changed, 11 insertions(+), 8 deletions(-) >> >> diff --git a/meta/recipes-graphics/mesa/mesa.inc b/meta/recipes-graphics/mesa/mesa.inc >> index 330a04f1b098a2d3a6874f40feabe8836dd4cb37..eafe1697c48edc661b33a54c5856d8e577608fd5 100644 >> --- a/meta/recipes-graphics/mesa/mesa.inc >> +++ b/meta/recipes-graphics/mesa/mesa.inc >> @@ -158,7 +158,7 @@ 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" >> +PACKAGECONFIG[opencl] = "-Dgallium-rusticl=true, -Dgallium-rusticl=false, bindgen-cli-native libclc spirv-tools spirv-llvm-translator" >> >> PACKAGECONFIG[broadcom] = "" >> PACKAGECONFIG[etnaviv] = ",,python3-pycparser-native" >> @@ -201,19 +201,21 @@ 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 = "" >> +# Reuse libclc from mesa-native instead of bringing heavy dependencies >> +LIBCLC_DEPS = "mesa-native" >> +LIBCLC_DEPS:class-native = "libclc spirv-tools spirv-llvm-translator" >> >> 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=${MESA_CLC} -Dinstall-mesa-clc=${INSTALL_MESA_CLC} -Dmesa-clc-bundle-headers=enabled,,${LIBCLC_DEPS}" > > I think it might be easier to drop this completely and to move meson > arguments to EXTRA_OEMESON (next to precomp-compiler options that you've > added). This way native builds will always build a full configuration > with mesa-clc, precomp compilers and other required drivers, while the > targets builds can be really optimal and won't require 'foo libclc' > hurdle. > We actually talked about that and I eventually decided against, and forgot to explain, sorry about that. Having libclc always on for the target mesa will require mesa-native be a dependency of mesa, which I'm not entirely sure is the best of ideas since nothing else in mesa requires mesa-native as far as I could tell? That's quite the dependency to always bring in, what do you think? Cheers, Quentin
On Tue, 24 Jun 2025 at 17:55, Quentin Schulz <quentin.schulz@cherry.de> wrote: > > Hi Dmitry, > > On 6/24/25 3:35 PM, Dmitry Baryshkov wrote: > > On Tue, Jun 24, 2025 at 02:44:26PM +0200, Quentin Schulz wrote: > >> From: Quentin Schulz <quentin.schulz@cherry.de> > >> > >> By using mesa-native mesa-clc instead of libclc, we do not actually need > >> most of the heavy dependencies of the libclc PACKAGECONFIG as we simply > >> need to use the natively compiled mesa-clc instead. We thus can simply > >> depend on mesa-native for the target recipe. > >> > >> libclc however is still required if opencl (rusticl) is selected. > >> > >> Because asahi drivers are only enabled when libclc is also selected, we > >> can now remove the explicit dependency on MESA_NATIVE. > >> We do the same for panfrost even though libclc isn't enforced yet for > >> mesa for the target. Support for panfrost has been broken for a while > >> already anyway (because of the possibly missing libclc) but we'll fix it > >> in a later commit. > >> > >> Signed-off-by: Quentin Schulz <quentin.schulz@cherry.de> > >> --- > >> meta/recipes-graphics/mesa/mesa.inc | 19 +++++++++++-------- > >> 1 file changed, 11 insertions(+), 8 deletions(-) > >> > >> diff --git a/meta/recipes-graphics/mesa/mesa.inc b/meta/recipes-graphics/mesa/mesa.inc > >> index 330a04f1b098a2d3a6874f40feabe8836dd4cb37..eafe1697c48edc661b33a54c5856d8e577608fd5 100644 > >> --- a/meta/recipes-graphics/mesa/mesa.inc > >> +++ b/meta/recipes-graphics/mesa/mesa.inc > >> @@ -158,7 +158,7 @@ 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" > >> +PACKAGECONFIG[opencl] = "-Dgallium-rusticl=true, -Dgallium-rusticl=false, bindgen-cli-native libclc spirv-tools spirv-llvm-translator" > >> > >> PACKAGECONFIG[broadcom] = "" > >> PACKAGECONFIG[etnaviv] = ",,python3-pycparser-native" > >> @@ -201,19 +201,21 @@ 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 = "" > >> +# Reuse libclc from mesa-native instead of bringing heavy dependencies > >> +LIBCLC_DEPS = "mesa-native" > >> +LIBCLC_DEPS:class-native = "libclc spirv-tools spirv-llvm-translator" > >> > >> 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=${MESA_CLC} -Dinstall-mesa-clc=${INSTALL_MESA_CLC} -Dmesa-clc-bundle-headers=enabled,,${LIBCLC_DEPS}" > > > > I think it might be easier to drop this completely and to move meson > > arguments to EXTRA_OEMESON (next to precomp-compiler options that you've > > added). This way native builds will always build a full configuration > > with mesa-clc, precomp compilers and other required drivers, while the > > targets builds can be really optimal and won't require 'foo libclc' > > hurdle. > > > > We actually talked about that and I eventually decided against, and > forgot to explain, sorry about that. > > Having libclc always on for the target mesa will require mesa-native be > a dependency of mesa, which I'm not entirely sure is the best of ideas > since nothing else in mesa requires mesa-native as far as I could tell? > That's quite the dependency to always bring in, what do you think? Okay. So we have several cases: - class-native build. It should depend on libclc & spirv in order to provide mesa-clc, asahi-clc & panfrost_compile. I don't think we ever need RustiCL support in this build - target builds for asahi / panfrost / intel / nouveau. These should depend only on mesa-native for native progs and specify -Dmesa-clc=system - target builds using RustiCL. These should depend on full libclc & spirv packages I think the easiest way to handle all these points without too many troubles is to: - Enable mesa-clc / prebuild-compilers / asahi / panfost in native builds - Drop libclc PACKAGECONFIG - Declare that asahi, panfrost, intel and nouveau PACKAGECONFIGs depend on mesa-native. Pass -Dmesa-clc=system to these drivers in a non-native build - Make opencl PACKAGECONFIG depend on libclc / spirv-tools / spirv-headers directly. WDYT? -- With best wishes Dmitry
diff --git a/meta/recipes-graphics/mesa/mesa.inc b/meta/recipes-graphics/mesa/mesa.inc index 330a04f1b098a2d3a6874f40feabe8836dd4cb37..eafe1697c48edc661b33a54c5856d8e577608fd5 100644 --- a/meta/recipes-graphics/mesa/mesa.inc +++ b/meta/recipes-graphics/mesa/mesa.inc @@ -158,7 +158,7 @@ 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" +PACKAGECONFIG[opencl] = "-Dgallium-rusticl=true, -Dgallium-rusticl=false, bindgen-cli-native libclc spirv-tools spirv-llvm-translator" PACKAGECONFIG[broadcom] = "" PACKAGECONFIG[etnaviv] = ",,python3-pycparser-native" @@ -201,19 +201,21 @@ 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 = "" +# Reuse libclc from mesa-native instead of bringing heavy dependencies +LIBCLC_DEPS = "mesa-native" +LIBCLC_DEPS:class-native = "libclc spirv-tools spirv-llvm-translator" 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=${MESA_CLC} -Dinstall-mesa-clc=${INSTALL_MESA_CLC} -Dmesa-clc-bundle-headers=enabled,,${LIBCLC_DEPS}" PACKAGECONFIG[va] = "-Dgallium-va=enabled,-Dgallium-va=disabled,libva-initial" PACKAGECONFIG[vdpau] = "-Dgallium-vdpau=enabled,-Dgallium-vdpau=disabled,libvdpau" PACKAGECONFIG[imagination] = "-Dimagination-srv=true,-Dimagination-srv=false" -# Asahi requires precompiled compilers from mesa-native -PACKAGECONFIG[asahi] = ",,${MESA_NATIVE}" +# Asahi requires precompiled compilers and libclc from mesa-native +# Make sure libclc is in mesa-native AND mesa PACKAGECONFIG +PACKAGECONFIG[asahi] = "" PACKAGECONFIG[intel] = "" GALLIUMDRIVERS:append = "${@bb.utils.contains('PACKAGECONFIG', 'intel', ',i915,crocus', '', d)}" @@ -221,8 +223,9 @@ GALLIUMDRIVERS:append = "${@bb.utils.contains('PACKAGECONFIG', 'intel', ',i915,c PACKAGECONFIG[lima] = "" GALLIUMDRIVERS:append = "${@bb.utils.contains('PACKAGECONFIG', 'lima', ',lima', '', d)}" -# Panfrost requires precompiled compilers from mesa-native -PACKAGECONFIG[panfrost] = ",,${MESA_NATIVE}" +# Panfrost requires precompiled compilers and libclc from mesa-native +# Make sure libclc is in mesa-native AND mesa PACKAGECONFIG +PACKAGECONFIG[panfrost] = "" GALLIUMDRIVERS:append = "${@bb.utils.contains('PACKAGECONFIG', 'panfrost', ',panfrost', '', d)}" PACKAGECONFIG[tegra] = ""