diff mbox series

[RFC,v2,1/6] mesa: move PACKAGECONFIG defaults to recipes

Message ID 20250721-mesa-libclc-panfrost-v2-1-f713d0858949@cherry.de
State Under Review
Headers show
Series mesa: lighten up target's libclc dependencies and fix panfrost support | expand

Commit Message

Quentin Schulz July 21, 2025, 10:33 a.m. UTC
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 useless PACKAGECONFIG ??= that is in mesa-gl
since it was entirely replaced by the one from mesa.inc (hence why it's
removed in this commit).

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

Comments

Dmitry Baryshkov July 22, 2025, 6:54 a.m. UTC | #1
On Mon, Jul 21, 2025 at 12:33:38PM +0200, Quentin Schulz wrote:
> 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 useless PACKAGECONFIG ??= that is in mesa-gl
> since it was entirely replaced by the one from mesa.inc (hence why it's
> removed in this commit).
> 
> Signed-off-by: Quentin Schulz <quentin.schulz@cherry.de>
> ---
>  meta/recipes-graphics/mesa/mesa-gl.bb | 14 ++++++++++++--
>  meta/recipes-graphics/mesa/mesa.bb    | 12 ++++++++++++
>  meta/recipes-graphics/mesa/mesa.inc   | 13 -------------
>  3 files changed, 24 insertions(+), 15 deletions(-)
> 
> diff --git a/meta/recipes-graphics/mesa/mesa-gl.bb b/meta/recipes-graphics/mesa/mesa-gl.bb
> index e2f03c81c4588c6257ffec2892fef7fcbe9f82bf..8418f13bbc8aa84c6591eb8b46e1fa96d7aad9b6 100644
> --- a/meta/recipes-graphics/mesa/mesa-gl.bb
> +++ b/meta/recipes-graphics/mesa/mesa-gl.bb
> @@ -8,7 +8,17 @@ 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 = " \
> +	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)} \

Please omit EGL and GLES here. If I remember correctly, the whole point
of the mesa-gl was to provide GL library in case there are
vendor-provided GLES libraries.

But the fact than nobody complained raises a question: do we actually
need the mesa-gl package?

> +	${@bb.utils.contains('DISTRO_FEATURES', 'vulkan', 'zink', '', d)} \
> +"
> +
>  PACKAGECONFIG:class-target = "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 47b95728e0b33c43992e1200a9e50e0f22c9bd6b..0f896887a4d956514f1fcc807de2ad31afa29f18 100644
> --- a/meta/recipes-graphics/mesa/mesa.inc
> +++ b/meta/recipes-graphics/mesa/mesa.inc
> @@ -81,22 +81,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
> 
>
Quentin Schulz July 22, 2025, 9:20 a.m. UTC | #2
Hi Dmitry,

On 7/22/25 8:54 AM, Dmitry Baryshkov wrote:
> On Mon, Jul 21, 2025 at 12:33:38PM +0200, Quentin Schulz wrote:
>> 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 useless PACKAGECONFIG ??= that is in mesa-gl
>> since it was entirely replaced by the one from mesa.inc (hence why it's
>> removed in this commit).
>>
>> Signed-off-by: Quentin Schulz <quentin.schulz@cherry.de>
>> ---
>>   meta/recipes-graphics/mesa/mesa-gl.bb | 14 ++++++++++++--
>>   meta/recipes-graphics/mesa/mesa.bb    | 12 ++++++++++++
>>   meta/recipes-graphics/mesa/mesa.inc   | 13 -------------
>>   3 files changed, 24 insertions(+), 15 deletions(-)
>>
>> diff --git a/meta/recipes-graphics/mesa/mesa-gl.bb b/meta/recipes-graphics/mesa/mesa-gl.bb
>> index e2f03c81c4588c6257ffec2892fef7fcbe9f82bf..8418f13bbc8aa84c6591eb8b46e1fa96d7aad9b6 100644
>> --- a/meta/recipes-graphics/mesa/mesa-gl.bb
>> +++ b/meta/recipes-graphics/mesa/mesa-gl.bb
>> @@ -8,7 +8,17 @@ 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 = " \
>> +	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)} \
> 
> Please omit EGL and GLES here. If I remember correctly, the whole point
> of the mesa-gl was to provide GL library in case there are
> vendor-provided GLES libraries.
> 

This seems to be hinted at by commit 015cb13a67c6 ("mesa-gl: add GL-only 
Mesa recipe") (poky).

@Ross do you have anything to add here maybe?

> But the fact than nobody complained raises a question: do we actually
> need the mesa-gl package?
> 

It actually would be just fine as I imagine most users would be using 
target mesa-gl which only has opengl and not the other ones (see the 
class-target OVERRIDES below). I'm not sure there would be a lot of 
people using mesa-gl-native anyway?

So maybe we do need mesa-gl target recipe still?

@Ross would you be aware of such users today? Maybe some ARM-based SoC's 
using some ancient (or yet unsupported) Mali only supported with 
libmali, or some Imagination GPU or whatever else? No clue what would 
make one use mesa-gl to be honest.

Cheers,
Quentin
Ross Burton July 22, 2025, 12:19 p.m. UTC | #3
On 22 Jul 2025, at 10:20, Quentin Schulz <quentin.schulz@cherry.de> wrote:
>> Please omit EGL and GLES here. If I remember correctly, the whole point
>> of the mesa-gl was to provide GL library in case there are
>> vendor-provided GLES libraries.
> 
> This seems to be hinted at by commit 015cb13a67c6 ("mesa-gl: add GL-only Mesa recipe") (poky).
> 
> @Ross do you have anything to add here maybe?

Yes, that was the intention. At the time I believe it was an Imagination-based Intel GPU that had hardware support for GLES, so mesa-gl was used to provide the big-GL APIs, albeit in software-rendering-only mode.

>> But the fact than nobody complained raises a question: do we actually
>> need the mesa-gl package?
> 
> It actually would be just fine as I imagine most users would be using target mesa-gl which only has opengl and not the other ones (see the class-target OVERRIDES below). I'm not sure there would be a lot of people using mesa-gl-native anyway?

mesa-gl-native makes little sense, this should be target only really.

> @Ross would you be aware of such users today? Maybe some ARM-based SoC's using some ancient (or yet unsupported) Mali only supported with libmali, or some Imagination GPU or whatever else? No clue what would make one use mesa-gl to be honest.

I suspect we should keep mesa-gl alive as-is, but I’m not sure if anyone is actually using it these days considering how well adopted GLES etc are.

Ross
Ross Burton July 22, 2025, 12:24 p.m. UTC | #4
On 22 Jul 2025, at 10:20, Quentin Schulz <quentin.schulz@cherry.de> wrote:
>> Please omit EGL and GLES here. If I remember correctly, the whole point
>> of the mesa-gl was to provide GL library in case there are
>> vendor-provided GLES libraries.
> 
> This seems to be hinted at by commit 015cb13a67c6 ("mesa-gl: add GL-only Mesa recipe") (poky).
> 
> @Ross do you have anything to add here maybe?

Yes, that was the intention. At the time I believe it was an Imagination-based Intel GPU that had hardware support for GLES, so mesa-gl was used to provide the big-GL APIs, albeit in software-rendering-only mode.

>> But the fact than nobody complained raises a question: do we actually
>> need the mesa-gl package?
> 
> It actually would be just fine as I imagine most users would be using target mesa-gl which only has opengl and not the other ones (see the class-target OVERRIDES below). I'm not sure there would be a lot of people using mesa-gl-native anyway?

mesa-gl-native makes little sense, this should be target only really.

> @Ross would you be aware of such users today? Maybe some ARM-based SoC's using some ancient (or yet unsupported) Mali only supported with libmali, or some Imagination GPU or whatever else? No clue what would make one use mesa-gl to be honest.

I suspect we should keep mesa-gl alive as-is, but I’m not sure if anyone is actually using it these days considering how well adopted GLES etc are.

Ross
Dmitry Baryshkov July 28, 2025, 12:28 p.m. UTC | #5
On Tue, Jul 22, 2025 at 12:24:31PM +0000, Ross Burton wrote:
> On 22 Jul 2025, at 10:20, Quentin Schulz <quentin.schulz@cherry.de> wrote:
> >> Please omit EGL and GLES here. If I remember correctly, the whole point
> >> of the mesa-gl was to provide GL library in case there are
> >> vendor-provided GLES libraries.
> > 
> > This seems to be hinted at by commit 015cb13a67c6 ("mesa-gl: add GL-only Mesa recipe") (poky).
> > 
> > @Ross do you have anything to add here maybe?
> 
> Yes, that was the intention. At the time I believe it was an
> Imagination-based Intel GPU that had hardware support for GLES, so
> mesa-gl was used to provide the big-GL APIs, albeit in
> software-rendering-only mode.
> 
> >> But the fact than nobody complained raises a question: do we actually
> >> need the mesa-gl package?
> > 
> > It actually would be just fine as I imagine most users would be
> > using target mesa-gl which only has opengl and not the other ones
> > (see the class-target OVERRIDES below). I'm not sure there would be
> > a lot of people using mesa-gl-native anyway?
> 
> mesa-gl-native makes little sense, this should be target only really.
> 
> > @Ross would you be aware of such users today? Maybe some ARM-based
> > SoC's using some ancient (or yet unsupported) Mali only supported
> > with libmali, or some Imagination GPU or whatever else? No clue what
> > would make one use mesa-gl to be honest.
> 
> I suspect we should keep mesa-gl alive as-is, but I’m not sure if
> anyone is actually using it these days considering how well adopted
> GLES etc are.

Agree. Let's keep a target-only mesa-gl.

Quentin, please drop egl/gles from the mesa-gl recipe.
diff mbox series

Patch

diff --git a/meta/recipes-graphics/mesa/mesa-gl.bb b/meta/recipes-graphics/mesa/mesa-gl.bb
index e2f03c81c4588c6257ffec2892fef7fcbe9f82bf..8418f13bbc8aa84c6591eb8b46e1fa96d7aad9b6 100644
--- a/meta/recipes-graphics/mesa/mesa-gl.bb
+++ b/meta/recipes-graphics/mesa/mesa-gl.bb
@@ -8,7 +8,17 @@  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 = " \
+	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:class-target = "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 47b95728e0b33c43992e1200a9e50e0f22c9bd6b..0f896887a4d956514f1fcc807de2ad31afa29f18 100644
--- a/meta/recipes-graphics/mesa/mesa.inc
+++ b/meta/recipes-graphics/mesa/mesa.inc
@@ -81,22 +81,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"