diff mbox series

[v3,09/11] mesa: sort out PROVIDES for the glvnd case

Message ID 20250522171334.3040820-9-dmitry.baryshkov@oss.qualcomm.com
State Accepted, archived
Commit 9d3b4c9bc40392ba87f110ec5db0dedf381b8c4a
Headers show
Series [v3,01/11] mesa: remove OSMesa support | expand

Commit Message

Dmitry Baryshkov May 22, 2025, 5:13 p.m. UTC
If mesa is built with GLVND enabled, it doesn't provide GL / GL ES / EGL
libraries directly. Instead it provides two ICD libraries: libEGL_mesa.0
and libGLX_mesa.so.0. Remove virtual provides from the glvnd case
(dropping incorrect virtual/libglx provider while we are at it) and
replace those with runtime providers (to be used by libglvnd in order to
pull corresponding ICDs).

Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
---
 meta/conf/distro/include/default-providers.inc |  3 ++-
 meta/recipes-graphics/mesa/mesa.inc            | 12 +++++++++---
 2 files changed, 11 insertions(+), 4 deletions(-)

Comments

Peter Kjellerstedt June 9, 2025, 9:28 a.m. UTC | #1
> -----Original Message-----
> From: openembedded-core@lists.openembedded.org <openembedded-core@lists.openembedded.org> On Behalf Of Dmitry Baryshkov via lists.openembedded.org
> Sent: den 22 maj 2025 19:14
> To: openembedded-core@lists.openembedded.org
> Subject: [OE-core] [PATCH v3 09/11] mesa: sort out PROVIDES for the glvnd case
> 
> If mesa is built with GLVND enabled, it doesn't provide GL / GL ES / EGL
> libraries directly. Instead it provides two ICD libraries: libEGL_mesa.0
> and libGLX_mesa.so.0. Remove virtual provides from the glvnd case
> (dropping incorrect virtual/libglx provider while we are at it) and
> replace those with runtime providers (to be used by libglvnd in order to
> pull corresponding ICDs).
> 
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
> ---
>  meta/conf/distro/include/default-providers.inc |  3 ++-
>  meta/recipes-graphics/mesa/mesa.inc            | 12 +++++++++---
>  2 files changed, 11 insertions(+), 4 deletions(-)
> 
> diff --git a/meta/conf/distro/include/default-providers.inc b/meta/conf/distro/include/default-providers.inc
> index ee91af87968f..4f094163546c 100644
> --- a/meta/conf/distro/include/default-providers.inc
> +++ b/meta/conf/distro/include/default-providers.inc
> @@ -7,8 +7,9 @@ PREFERRED_PROVIDER_virtual/xserver-xf86 ?= "xserver-xorg"
>  PREFERRED_PROVIDER_virtual/libsdl2 ?= "libsdl2"
>  PREFERRED_PROVIDER_virtual/libsdl2-native ?= "libsdl2-native"
>  PREFERRED_PROVIDER_virtual/egl ?= "mesa"
> +PREFERRED_PROVIDER_virtual/libegl-icd ?= "mesa"
>  PREFERRED_PROVIDER_virtual/libgl ?= "mesa"
> -PREFERRED_PROVIDER_virtual/libglx ?= "mesa"
> +PREFERRED_PROVIDER_virtual/libglx-icd ?= "mesa"
>  PREFERRED_PROVIDER_virtual/libgl-native ?= "mesa-native"
>  PREFERRED_PROVIDER_virtual/nativesdk-libgl ?= "nativesdk-mesa"
>  PREFERRED_PROVIDER_virtual/libgles1 ?= "mesa"

What was the point of adding preferred providers for virtual/libegl-icd and 
virtual/libglx-icd? AFAICT, there are no providers for them and no recipes 
that depend on them, neither in OE-Core nor in meta-openembedded.

There _are_ runtime dependencies on libegl-icd and libglx-icd in libglvnd, 
which are provided by mesa. Should they have been virtual-libegl-icd and 
virtual-libglx-icd instead? Comparing to opencl-icd, I would have expected 
mesa to RPROVIDES virtual-libegl-icd and virtual-libglx-icd, and for 
default-providers.inc to set PREFERRED_RPROVIDERs for them.

> diff --git a/meta/recipes-graphics/mesa/mesa.inc b/meta/recipes-
> graphics/mesa/mesa.inc
> index 4c61447031e3..ab8c22681fe8 100644
> --- a/meta/recipes-graphics/mesa/mesa.inc
> +++ b/meta/recipes-graphics/mesa/mesa.inc
> @@ -37,11 +37,13 @@ do_install:append() {
> 
>  DEPENDS = "expat makedepend-native flex-native bison-native libxml2-native zlib chrpath-replacement-native python3-mako-native gettext-native python3-pyyaml-native"
>  EXTRANATIVEPATH += "chrpath-native"
> -PROVIDES = " \
> +GLPROVIDES = " \
>      ${@bb.utils.contains('PACKAGECONFIG', 'opengl', 'virtual/libgl', '', d)} \
> -    ${@bb.utils.contains('PACKAGECONFIG', 'glvnd', 'virtual/libglx', '', d)} \
>      ${@bb.utils.contains('PACKAGECONFIG', 'gles', 'virtual/libgles1 virtual/libgles2 virtual/libgles3', '', d)} \
>      ${@bb.utils.contains('PACKAGECONFIG', 'egl', 'virtual/egl', '', d)} \
> +"
> +PROVIDES = " \
> +    ${@bb.utils.contains('PACKAGECONFIG', 'glvnd', '', d.getVar('GLPROVIDES'), d)} \
>      ${@bb.utils.contains('PACKAGECONFIG', 'gbm', 'virtual/libgbm', '', d)} \
>      virtual/mesa \
>      "
> @@ -275,7 +277,11 @@ python __anonymous() {
> 
>      d.setVar("DEBIAN_NOAUTONAME:%slibopencl-mesa%s" % (mlprefix, suffix), "1")
> 
> -    if 'glvnd' not in pkgconfig:
> +    if 'glvnd' in pkgconfig:
> +        for p in ("libegl", "libglx"):
> +            fullp = mlprefix + p + "-mesa" + suffix
> +            d.appendVar("RPROVIDES:" + fullp, '%s-icd' % p)
> +    else:
>          for p in (("egl", "libegl", "libegl1"),
>                    ("opengl", "libgl", "libgl1"),
>                    ("gles", "libgles1", "libglesv1-cm1"),
> --
> 2.39.5

//Peter
Dmitry Baryshkov June 9, 2025, 4:17 p.m. UTC | #2
On Mon, 9 Jun 2025 at 12:28, Peter Kjellerstedt
<peter.kjellerstedt@axis.com> wrote:
>
> > -----Original Message-----
> > From: openembedded-core@lists.openembedded.org <openembedded-core@lists.openembedded.org> On Behalf Of Dmitry Baryshkov via lists.openembedded.org
> > Sent: den 22 maj 2025 19:14
> > To: openembedded-core@lists.openembedded.org
> > Subject: [OE-core] [PATCH v3 09/11] mesa: sort out PROVIDES for the glvnd case
> >
> > If mesa is built with GLVND enabled, it doesn't provide GL / GL ES / EGL
> > libraries directly. Instead it provides two ICD libraries: libEGL_mesa.0
> > and libGLX_mesa.so.0. Remove virtual provides from the glvnd case
> > (dropping incorrect virtual/libglx provider while we are at it) and
> > replace those with runtime providers (to be used by libglvnd in order to
> > pull corresponding ICDs).
> >
> > Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
> > ---
> >  meta/conf/distro/include/default-providers.inc |  3 ++-
> >  meta/recipes-graphics/mesa/mesa.inc            | 12 +++++++++---
> >  2 files changed, 11 insertions(+), 4 deletions(-)
> >
> > diff --git a/meta/conf/distro/include/default-providers.inc b/meta/conf/distro/include/default-providers.inc
> > index ee91af87968f..4f094163546c 100644
> > --- a/meta/conf/distro/include/default-providers.inc
> > +++ b/meta/conf/distro/include/default-providers.inc
> > @@ -7,8 +7,9 @@ PREFERRED_PROVIDER_virtual/xserver-xf86 ?= "xserver-xorg"
> >  PREFERRED_PROVIDER_virtual/libsdl2 ?= "libsdl2"
> >  PREFERRED_PROVIDER_virtual/libsdl2-native ?= "libsdl2-native"
> >  PREFERRED_PROVIDER_virtual/egl ?= "mesa"
> > +PREFERRED_PROVIDER_virtual/libegl-icd ?= "mesa"
> >  PREFERRED_PROVIDER_virtual/libgl ?= "mesa"
> > -PREFERRED_PROVIDER_virtual/libglx ?= "mesa"
> > +PREFERRED_PROVIDER_virtual/libglx-icd ?= "mesa"
> >  PREFERRED_PROVIDER_virtual/libgl-native ?= "mesa-native"
> >  PREFERRED_PROVIDER_virtual/nativesdk-libgl ?= "nativesdk-mesa"
> >  PREFERRED_PROVIDER_virtual/libgles1 ?= "mesa"
>
> What was the point of adding preferred providers for virtual/libegl-icd and
> virtual/libglx-icd? AFAICT, there are no providers for them and no recipes
> that depend on them, neither in OE-Core nor in meta-openembedded.
>
> There _are_ runtime dependencies on libegl-icd and libglx-icd in libglvnd,
> which are provided by mesa. Should they have been virtual-libegl-icd and
> virtual-libglx-icd instead? Comparing to opencl-icd, I would have expected
> mesa to RPROVIDES virtual-libegl-icd and virtual-libglx-icd, and for
> default-providers.inc to set PREFERRED_RPROVIDERs for them.

Yes and yes. I was thinking about RPROVIDERS and then forgot about it.
I'll send a fix together with the next libglvnd iteration.

>
> > diff --git a/meta/recipes-graphics/mesa/mesa.inc b/meta/recipes-
> > graphics/mesa/mesa.inc
> > index 4c61447031e3..ab8c22681fe8 100644
> > --- a/meta/recipes-graphics/mesa/mesa.inc
> > +++ b/meta/recipes-graphics/mesa/mesa.inc
> > @@ -37,11 +37,13 @@ do_install:append() {
> >
> >  DEPENDS = "expat makedepend-native flex-native bison-native libxml2-native zlib chrpath-replacement-native python3-mako-native gettext-native python3-pyyaml-native"
> >  EXTRANATIVEPATH += "chrpath-native"
> > -PROVIDES = " \
> > +GLPROVIDES = " \
> >      ${@bb.utils.contains('PACKAGECONFIG', 'opengl', 'virtual/libgl', '', d)} \
> > -    ${@bb.utils.contains('PACKAGECONFIG', 'glvnd', 'virtual/libglx', '', d)} \
> >      ${@bb.utils.contains('PACKAGECONFIG', 'gles', 'virtual/libgles1 virtual/libgles2 virtual/libgles3', '', d)} \
> >      ${@bb.utils.contains('PACKAGECONFIG', 'egl', 'virtual/egl', '', d)} \
> > +"
> > +PROVIDES = " \
> > +    ${@bb.utils.contains('PACKAGECONFIG', 'glvnd', '', d.getVar('GLPROVIDES'), d)} \
> >      ${@bb.utils.contains('PACKAGECONFIG', 'gbm', 'virtual/libgbm', '', d)} \
> >      virtual/mesa \
> >      "
> > @@ -275,7 +277,11 @@ python __anonymous() {
> >
> >      d.setVar("DEBIAN_NOAUTONAME:%slibopencl-mesa%s" % (mlprefix, suffix), "1")
> >
> > -    if 'glvnd' not in pkgconfig:
> > +    if 'glvnd' in pkgconfig:
> > +        for p in ("libegl", "libglx"):
> > +            fullp = mlprefix + p + "-mesa" + suffix
> > +            d.appendVar("RPROVIDES:" + fullp, '%s-icd' % p)
> > +    else:
> >          for p in (("egl", "libegl", "libegl1"),
> >                    ("opengl", "libgl", "libgl1"),
> >                    ("gles", "libgles1", "libglesv1-cm1"),
> > --
> > 2.39.5
>
> //Peter
>
diff mbox series

Patch

diff --git a/meta/conf/distro/include/default-providers.inc b/meta/conf/distro/include/default-providers.inc
index ee91af87968f..4f094163546c 100644
--- a/meta/conf/distro/include/default-providers.inc
+++ b/meta/conf/distro/include/default-providers.inc
@@ -7,8 +7,9 @@  PREFERRED_PROVIDER_virtual/xserver-xf86 ?= "xserver-xorg"
 PREFERRED_PROVIDER_virtual/libsdl2 ?= "libsdl2"
 PREFERRED_PROVIDER_virtual/libsdl2-native ?= "libsdl2-native"
 PREFERRED_PROVIDER_virtual/egl ?= "mesa"
+PREFERRED_PROVIDER_virtual/libegl-icd ?= "mesa"
 PREFERRED_PROVIDER_virtual/libgl ?= "mesa"
-PREFERRED_PROVIDER_virtual/libglx ?= "mesa"
+PREFERRED_PROVIDER_virtual/libglx-icd ?= "mesa"
 PREFERRED_PROVIDER_virtual/libgl-native ?= "mesa-native"
 PREFERRED_PROVIDER_virtual/nativesdk-libgl ?= "nativesdk-mesa"
 PREFERRED_PROVIDER_virtual/libgles1 ?= "mesa"
diff --git a/meta/recipes-graphics/mesa/mesa.inc b/meta/recipes-graphics/mesa/mesa.inc
index 4c61447031e3..ab8c22681fe8 100644
--- a/meta/recipes-graphics/mesa/mesa.inc
+++ b/meta/recipes-graphics/mesa/mesa.inc
@@ -37,11 +37,13 @@  do_install:append() {
 
 DEPENDS = "expat makedepend-native flex-native bison-native libxml2-native zlib chrpath-replacement-native python3-mako-native gettext-native python3-pyyaml-native"
 EXTRANATIVEPATH += "chrpath-native"
-PROVIDES = " \
+GLPROVIDES = " \
     ${@bb.utils.contains('PACKAGECONFIG', 'opengl', 'virtual/libgl', '', d)} \
-    ${@bb.utils.contains('PACKAGECONFIG', 'glvnd', 'virtual/libglx', '', d)} \
     ${@bb.utils.contains('PACKAGECONFIG', 'gles', 'virtual/libgles1 virtual/libgles2 virtual/libgles3', '', d)} \
     ${@bb.utils.contains('PACKAGECONFIG', 'egl', 'virtual/egl', '', d)} \
+"
+PROVIDES = " \
+    ${@bb.utils.contains('PACKAGECONFIG', 'glvnd', '', d.getVar('GLPROVIDES'), d)} \
     ${@bb.utils.contains('PACKAGECONFIG', 'gbm', 'virtual/libgbm', '', d)} \
     virtual/mesa \
     "
@@ -275,7 +277,11 @@  python __anonymous() {
 
     d.setVar("DEBIAN_NOAUTONAME:%slibopencl-mesa%s" % (mlprefix, suffix), "1")
 
-    if 'glvnd' not in pkgconfig:
+    if 'glvnd' in pkgconfig:
+        for p in ("libegl", "libglx"):
+            fullp = mlprefix + p + "-mesa" + suffix
+            d.appendVar("RPROVIDES:" + fullp, '%s-icd' % p)
+    else:
         for p in (("egl", "libegl", "libegl1"),
                   ("opengl", "libgl", "libgl1"),
                   ("gles", "libgles1", "libglesv1-cm1"),