All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mesa: Remove dependency on opengl or vulkan DISTRO_FEATURES
@ 2021-02-10 11:11 Ray Smith
  2021-02-10 13:26 ` [OE-core] " Otavio Salvador
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Ray Smith @ 2021-02-10 11:11 UTC (permalink / raw)
  To: openembedded-core; +Cc: Ray Smith

Mesa doesn't _require_ either of these features of the distribution,
it (conditionally) _provides_ them.

This has a desirable side-effect of enabling a build of mesa that
supports only OpenGL ES and EGL, without having the rest of the
distribution think that full OpenGL is available.

Without this, a distribution can't support different machines with
(non-mesa) OpenGL ES/EGL-only drivers alongside mesa drivers, even
when the distribution only needs OpenGL ES/EGL.

(Note that currently mesa internally requires OpenGL support to be
built in order for OpenGL ES support to be built, but this is a
detail internal to mesa that should not be exposed to the wider
build)

Signed-off-by: Ray Smith <raymsmithuk@gmail.com>
---
 meta/recipes-graphics/mesa/mesa.inc | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/meta/recipes-graphics/mesa/mesa.inc b/meta/recipes-graphics/mesa/mesa.inc
index cb075a8b89..bdb978de95 100644
--- a/meta/recipes-graphics/mesa/mesa.inc
+++ b/meta/recipes-graphics/mesa/mesa.inc
@@ -44,12 +44,10 @@ PROVIDES = " \
     virtual/mesa \
     "
 
-inherit meson pkgconfig python3native gettext features_check
+inherit meson pkgconfig python3native gettext
 
 BBCLASSEXTEND = "native nativesdk"
 
-ANY_OF_DISTRO_FEATURES_class-target = "opengl vulkan"
-
 PLATFORMS ??= "${@bb.utils.filter('PACKAGECONFIG', 'x11 wayland', d)}"
 
 export YOCTO_ALTERNATE_EXE_PATH = "${STAGING_LIBDIR}/llvm${MESA_LLVM_RELEASE}/llvm-config"
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [OE-core] [PATCH] mesa: Remove dependency on opengl or vulkan DISTRO_FEATURES
  2021-02-10 11:11 [PATCH] mesa: Remove dependency on opengl or vulkan DISTRO_FEATURES Ray Smith
@ 2021-02-10 13:26 ` Otavio Salvador
  2021-02-10 14:41   ` Ray Smith
  2021-02-10 15:15 ` akuster
  2021-02-11 16:13 ` Ross Burton
  2 siblings, 1 reply; 11+ messages in thread
From: Otavio Salvador @ 2021-02-10 13:26 UTC (permalink / raw)
  To: Ray Smith; +Cc: Patches and discussions about the oe-core layer

[-- Attachment #1: Type: text/plain, Size: 568 bytes --]

Em qua., 10 de fev. de 2021 às 08:12, Ray Smith <raymsmithuk@gmail.com>
escreveu:

> (Note that currently mesa internally requires OpenGL support to be
> built in order for OpenGL ES support to be built, but this is a
> detail internal to mesa that should not be exposed to the wider
> build)
>

I didn't understand what you mean here. Could you elaborate this?

-- 
Otavio Salvador                             O.S. Systems
http://www.ossystems.com.br        http://code.ossystems.com.br
Mobile: +55 (53) 9 9981-7854          Mobile: +1 (347) 903-9750

[-- Attachment #2: Type: text/html, Size: 1099 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [OE-core] [PATCH] mesa: Remove dependency on opengl or vulkan DISTRO_FEATURES
  2021-02-10 13:26 ` [OE-core] " Otavio Salvador
@ 2021-02-10 14:41   ` Ray Smith
  2021-02-10 20:20     ` Andrey Zhizhikin
  0 siblings, 1 reply; 11+ messages in thread
From: Ray Smith @ 2021-02-10 14:41 UTC (permalink / raw)
  To: Otavio Salvador; +Cc: Patches and discussions about the oe-core layer

[-- Attachment #1: Type: text/plain, Size: 947 bytes --]

On Wed, Feb 10, 2021 at 1:26 PM Otavio Salvador <
otavio.salvador@ossystems.com.br> wrote:

>
> I didn't understand what you mean here. Could you elaborate this?
>
>
If you try to build mesa with PACKAGECONFIG "egl gles dri" you get an error:
../mesa-20.3.2/meson.build:144:4: ERROR: Problem encountered: building
OpenGL ES without OpenGL is not supported.

This means that in practice you can't get a GLES-only build of mesa, so
mesa always provides OpenGL (ignoring Vulkan). But for an abstract graphics
driver that's not true - many drivers provide GLES but not OpenGL. I'd
argue that this is an implementation detail (and maybe a minor bug) of
mesa. If mesa internally requires code from its OpenGL support to build
GLES, it should silently include that if it's been configured for GLES-only.

I only mention it to be clear that in general "GLES requires OpenGL" is not
true, even though mesa's build system enforces that.

[-- Attachment #2: Type: text/html, Size: 1382 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [OE-core] [PATCH] mesa: Remove dependency on opengl or vulkan DISTRO_FEATURES
  2021-02-10 11:11 [PATCH] mesa: Remove dependency on opengl or vulkan DISTRO_FEATURES Ray Smith
  2021-02-10 13:26 ` [OE-core] " Otavio Salvador
@ 2021-02-10 15:15 ` akuster
  2021-02-10 17:14   ` Ray Smith
  2021-02-11 16:13 ` Ross Burton
  2 siblings, 1 reply; 11+ messages in thread
From: akuster @ 2021-02-10 15:15 UTC (permalink / raw)
  To: Ray Smith, openembedded-core



On 2/10/21 3:11 AM, Ray Smith wrote:
> Mesa doesn't _require_ either of these features of the distribution,
> it (conditionally) _provides_ them.
>
> This has a desirable side-effect of enabling a build of mesa that
> supports only OpenGL ES and EGL, without having the rest of the
> distribution think that full OpenGL is available.
>
> Without this, a distribution can't support different machines with
> (non-mesa) OpenGL ES/EGL-only drivers alongside mesa drivers, even
> when the distribution only needs OpenGL ES/EGL.
>
> (Note that currently mesa internally requires OpenGL support to be
> built in order for OpenGL ES support to be built, but this is a
> detail internal to mesa that should not be exposed to the wider
> build)

Did you run yocto-check-layer to ensure this passes?

-armin
> Signed-off-by: Ray Smith <raymsmithuk@gmail.com>
> ---
>  meta/recipes-graphics/mesa/mesa.inc | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/meta/recipes-graphics/mesa/mesa.inc b/meta/recipes-graphics/mesa/mesa.inc
> index cb075a8b89..bdb978de95 100644
> --- a/meta/recipes-graphics/mesa/mesa.inc
> +++ b/meta/recipes-graphics/mesa/mesa.inc
> @@ -44,12 +44,10 @@ PROVIDES = " \
>      virtual/mesa \
>      "
>  
> -inherit meson pkgconfig python3native gettext features_check
> +inherit meson pkgconfig python3native gettext
>  
>  BBCLASSEXTEND = "native nativesdk"
>  
> -ANY_OF_DISTRO_FEATURES_class-target = "opengl vulkan"
> -
>  PLATFORMS ??= "${@bb.utils.filter('PACKAGECONFIG', 'x11 wayland', d)}"
>  
>  export YOCTO_ALTERNATE_EXE_PATH = "${STAGING_LIBDIR}/llvm${MESA_LLVM_RELEASE}/llvm-config"
>
> 
>


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [OE-core] [PATCH] mesa: Remove dependency on opengl or vulkan DISTRO_FEATURES
  2021-02-10 15:15 ` akuster
@ 2021-02-10 17:14   ` Ray Smith
  0 siblings, 0 replies; 11+ messages in thread
From: Ray Smith @ 2021-02-10 17:14 UTC (permalink / raw)
  To: akuster808; +Cc: Patches and discussions about the oe-core layer

[-- Attachment #1: Type: text/plain, Size: 543 bytes --]

On Wed, Feb 10, 2021 at 3:15 PM akuster808 <akuster808@gmail.com> wrote:

>
> Did you run yocto-check-layer to ensure this passes?
>
> -armin
>
>
I didn't, but I don't think it makes sense for this. At least, it fails for
fundamental-looking reasons when run on oe-core/meta without my changes
(assuming I'm running it correctly):

~/src/oe-core/build$ ../scripts/yocto-check-layer ../meta
INFO: Detected layers:
ERROR: meta: Can't be DISTRO and BSP type at the same time. Both
conf/distro and conf/machine folders were found.

[-- Attachment #2: Type: text/html, Size: 917 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [OE-core] [PATCH] mesa: Remove dependency on opengl or vulkan DISTRO_FEATURES
  2021-02-10 14:41   ` Ray Smith
@ 2021-02-10 20:20     ` Andrey Zhizhikin
  2021-02-10 21:36       ` Otavio Salvador
  0 siblings, 1 reply; 11+ messages in thread
From: Andrey Zhizhikin @ 2021-02-10 20:20 UTC (permalink / raw)
  To: Ray Smith
  Cc: Otavio Salvador, Patches and discussions about the oe-core layer

Hello Ray,

On Wed, Feb 10, 2021 at 3:41 PM Ray Smith <raymsmithuk@gmail.com> wrote:
>
> On Wed, Feb 10, 2021 at 1:26 PM Otavio Salvador <otavio.salvador@ossystems.com.br> wrote:
>>
>>
>> I didn't understand what you mean here. Could you elaborate this?
>>
>
> If you try to build mesa with PACKAGECONFIG "egl gles dri" you get an error:
> ../mesa-20.3.2/meson.build:144:4: ERROR: Problem encountered: building OpenGL ES without OpenGL is not supported.
>
> This means that in practice you can't get a GLES-only build of mesa, so mesa always provides OpenGL (ignoring Vulkan). But for an abstract graphics driver that's not true - many drivers provide GLES but not OpenGL. I'd argue that this is an implementation detail (and maybe a minor bug) of mesa. If mesa internally requires code from its OpenGL support to build GLES, it should silently include that if it's been configured for GLES-only.
>
> I only mention it to be clear that in general "GLES requires OpenGL" is not true, even though mesa's build system enforces that.

Should this be clarified with Mesa folks upfront? If you believe that
this limitation is rather "artificial", then there has to be a proper
explanation from Mesa developers why OGL is provided when OGLES-only
is built.

>
> 
>


-- 
Regards,
Andrey.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [OE-core] [PATCH] mesa: Remove dependency on opengl or vulkan DISTRO_FEATURES
  2021-02-10 20:20     ` Andrey Zhizhikin
@ 2021-02-10 21:36       ` Otavio Salvador
  2021-02-11 11:59         ` Ray Smith
  0 siblings, 1 reply; 11+ messages in thread
From: Otavio Salvador @ 2021-02-10 21:36 UTC (permalink / raw)
  To: Andrey Zhizhikin
  Cc: Ray Smith, Patches and discussions about the oe-core layer

[-- Attachment #1: Type: text/plain, Size: 1704 bytes --]

Em qua., 10 de fev. de 2021 às 17:21, Andrey Zhizhikin <andrey.z@gmail.com>
escreveu:

> On Wed, Feb 10, 2021 at 3:41 PM Ray Smith <raymsmithuk@gmail.com> wrote:
> > On Wed, Feb 10, 2021 at 1:26 PM Otavio Salvador <
> otavio.salvador@ossystems.com.br> wrote:
> >>
> >>
> >> I didn't understand what you mean here. Could you elaborate this?
> >>
> >
> > If you try to build mesa with PACKAGECONFIG "egl gles dri" you get an
> error:
> > ../mesa-20.3.2/meson.build:144:4: ERROR: Problem encountered: building
> OpenGL ES without OpenGL is not supported.
> >
> > This means that in practice you can't get a GLES-only build of mesa, so
> mesa always provides OpenGL (ignoring Vulkan). But for an abstract graphics
> driver that's not true - many drivers provide GLES but not OpenGL. I'd
> argue that this is an implementation detail (and maybe a minor bug) of
> mesa. If mesa internally requires code from its OpenGL support to build
> GLES, it should silently include that if it's been configured for GLES-only.
> >
> > I only mention it to be clear that in general "GLES requires OpenGL" is
> not true, even though mesa's build system enforces that.
>
> Should this be clarified with Mesa folks upfront? If you believe that
> this limitation is rather "artificial", then there has to be a proper
> explanation from Mesa developers why OGL is provided when OGLES-only
> is built.
>

Agreed ... I'd rather not drop the check until we hear from upstream the
reasoning behind it.

-- 
Otavio Salvador                             O.S. Systems
http://www.ossystems.com.br        http://code.ossystems.com.br
Mobile: +55 (53) 9 9981-7854          Mobile: +1 (347) 903-9750

[-- Attachment #2: Type: text/html, Size: 2473 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [OE-core] [PATCH] mesa: Remove dependency on opengl or vulkan DISTRO_FEATURES
  2021-02-10 21:36       ` Otavio Salvador
@ 2021-02-11 11:59         ` Ray Smith
  2021-02-11 12:05           ` Martin Jansa
  0 siblings, 1 reply; 11+ messages in thread
From: Ray Smith @ 2021-02-11 11:59 UTC (permalink / raw)
  To: Otavio Salvador
  Cc: Andrey Zhizhikin, Patches and discussions about the oe-core layer

[-- Attachment #1: Type: text/plain, Size: 1312 bytes --]

On Wed, Feb 10, 2021 at 9:36 PM Otavio Salvador <
otavio.salvador@ossystems.com.br> wrote:

> Em qua., 10 de fev. de 2021 às 17:21, Andrey Zhizhikin <andrey.z@gmail.com>
> escreveu:
>
>>
>> Should this be clarified with Mesa folks upfront? If you believe that
>> this limitation is rather "artificial", then there has to be a proper
>> explanation from Mesa developers why OGL is provided when OGLES-only
>> is built.
>>
>
> Agreed ... I'd rather not drop the check until we hear from upstream the
> reasoning behind it.
>

This patch is really about the first line:

> Mesa doesn't _require_ either of these features of the distribution,
> it (conditionally) _provides_ them.

Even if we had an opengles distro feature that solved the GLES vs OpenGL
issues, having a 'ANY_OF_DISTRO_FEATURES_class-target = "opengl vulkan
opengles"' line instead still wouldn't make sense (although it would solve
my problem), because mesa doesn't require any of those features. This line
is effectively saying it depends on the things it provides.

I will raise the build issue with mesa, but I think it's not related to the
core issue here. There are no responses yet, but I see
https://gitlab.freedesktop.org/mesa/mesa/-/issues/4176 was raised a couple
of weeks ago with a very similar issue.

[-- Attachment #2: Type: text/html, Size: 2109 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [OE-core] [PATCH] mesa: Remove dependency on opengl or vulkan DISTRO_FEATURES
  2021-02-11 11:59         ` Ray Smith
@ 2021-02-11 12:05           ` Martin Jansa
  2021-02-11 13:27             ` Phil Blundell
  0 siblings, 1 reply; 11+ messages in thread
From: Martin Jansa @ 2021-02-11 12:05 UTC (permalink / raw)
  To: Ray Smith
  Cc: Otavio Salvador, Andrey Zhizhikin,
	Patches and discussions about the oe-core layer

[-- Attachment #1: Type: text/plain, Size: 1466 bytes --]

On Thu, Feb 11, 2021 at 11:59:43AM +0000, Ray Smith wrote:
> On Wed, Feb 10, 2021 at 9:36 PM Otavio Salvador <
> otavio.salvador@ossystems.com.br> wrote:
> 
> > Em qua., 10 de fev. de 2021 às 17:21, Andrey Zhizhikin <andrey.z@gmail.com>
> > escreveu:
> >
> >>
> >> Should this be clarified with Mesa folks upfront? If you believe that
> >> this limitation is rather "artificial", then there has to be a proper
> >> explanation from Mesa developers why OGL is provided when OGLES-only
> >> is built.
> >>
> >
> > Agreed ... I'd rather not drop the check until we hear from upstream the
> > reasoning behind it.
> >
> 
> This patch is really about the first line:
> 
> > Mesa doesn't _require_ either of these features of the distribution,
> > it (conditionally) _provides_ them.
> 
> Even if we had an opengles distro feature that solved the GLES vs OpenGL
> issues, having a 'ANY_OF_DISTRO_FEATURES_class-target = "opengl vulkan
> opengles"' line instead still wouldn't make sense (although it would solve
> my problem), because mesa doesn't require any of those features. This line
> is effectively saying it depends on the things it provides.

Or you can read it as that it makes sense to build mesa recipe only when
DISTRO supports opengl or vulkan or opengles, which IMHO still makes
sense.

Similarly when DISTO_FEATURES are used to set PACKAGECONFIG values, it
doesn't say what it requires, but what DISTRO wants to support.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 201 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [OE-core] [PATCH] mesa: Remove dependency on opengl or vulkan DISTRO_FEATURES
  2021-02-11 12:05           ` Martin Jansa
@ 2021-02-11 13:27             ` Phil Blundell
  0 siblings, 0 replies; 11+ messages in thread
From: Phil Blundell @ 2021-02-11 13:27 UTC (permalink / raw)
  To: Martin Jansa
  Cc: Ray Smith, Otavio Salvador, Andrey Zhizhikin,
	Patches and discussions about the oe-core layer

On Thu, Feb 11, 2021 at 01:05:20PM +0100, Martin Jansa wrote:
> Or you can read it as that it makes sense to build mesa recipe only when
> DISTRO supports opengl or vulkan or opengles,

It's never been the intent of DISTRO_FEATURES to determine which recipes 
it "makes sense" to build, above and beyond those that are actually
impossible to compile in a given configuration.  If there were certain 
recipes that are fundamentally and completely incompatible with a 
particular DISTRO_FEATURE to the extent that you simply couldn't build 
them at all then it might make sense to exclude them in this way, but 
I can't honestly think of even a single case where that would be true.  
Even at a fundamental level, there's no reason that a musl-based 
DISTRO couldn't also build glibc for example.  Conversely, if a recipe
simply needs some aspect of a given DISTRO_FEATURE to work then, in
general, the solution to that is just to declare it as a dependency.
Recipes that necessarily and unavoidably need OpenGL should just have
virtual/libgl in their DEPENDS and there is no need for them to be
checking DISTRO_FEATURES to see whether OpenGL is "available" in some
abstract sense.

If a particular DISTRO wants to actively prohibit mesa or any other
recipe from being built (because it wants to ensure that certain code
never leaks into the build artifacts due to a dependency error) then
there are other mechanisms for that.

The intent of the "opengl" DISTRO_FEATURE is that it gives you a single
central place to control the configuration of packages that either have
an optional dependency on OpenGL, or are selectable between OpenGL and
Vulkan at configure time.  Even this is a tiny bit half-baked because
it doesn't really distinguish between the myriad variants of OpenGL(ES)
but in general that distinction is a matter of platform capability 
rather than DISTRO choice (i.e. if your graphics stack only supports 
OpenGL ES 1.x, no amount of oe-core configuration is going to make it 
support OpenGL 4.)  And the DISTRO_FEATURE does at least let you assert
at the whole-distribution level that you have a preference for Vulkan
over OpenGL, or vice versa.

If you add opengl to DISTRO_FEATURES then you will start getting OpenGL
support enabled in recipes like cairo.  With the way the Mesa recipe
is currently constituted, anybody who wants to build Mesa for some
ancillary purpose but doesn't want everything else to start using 
OpenGL needs to add opengl to DISTRO_FEATURES and then engage in a 
game of whack-a-mole to go round turning it back off again in all 
the individual PACKAGECONFIGs.  I don't think that's a rational state
of affairs.

p.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [OE-core] [PATCH] mesa: Remove dependency on opengl or vulkan DISTRO_FEATURES
  2021-02-10 11:11 [PATCH] mesa: Remove dependency on opengl or vulkan DISTRO_FEATURES Ray Smith
  2021-02-10 13:26 ` [OE-core] " Otavio Salvador
  2021-02-10 15:15 ` akuster
@ 2021-02-11 16:13 ` Ross Burton
  2 siblings, 0 replies; 11+ messages in thread
From: Ross Burton @ 2021-02-11 16:13 UTC (permalink / raw)
  To: Ray Smith; +Cc: OE-core

On Wed, 10 Feb 2021 at 11:12, Ray Smith <raymsmithuk@gmail.com> wrote:
> This has a desirable side-effect of enabling a build of mesa that
> supports only OpenGL ES and EGL, without having the rest of the
> distribution think that full OpenGL is available.

The 'opengl' DISTRO_FEATURE is deliberately vague and doesn't have any
implications regarding OpenGL vs OpenGL ES.

If Mesa won't build with just GLES without GL, then that's a
regression with OpenGL and should be taken up with them.

Ross

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2021-02-11 16:14 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-10 11:11 [PATCH] mesa: Remove dependency on opengl or vulkan DISTRO_FEATURES Ray Smith
2021-02-10 13:26 ` [OE-core] " Otavio Salvador
2021-02-10 14:41   ` Ray Smith
2021-02-10 20:20     ` Andrey Zhizhikin
2021-02-10 21:36       ` Otavio Salvador
2021-02-11 11:59         ` Ray Smith
2021-02-11 12:05           ` Martin Jansa
2021-02-11 13:27             ` Phil Blundell
2021-02-10 15:15 ` akuster
2021-02-10 17:14   ` Ray Smith
2021-02-11 16:13 ` Ross Burton

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.