mesa: Remove dependency on opengl or vulkan DISTRO_FEATURES
PATCH 1/1 mesa: Remove dependency on opengl or vulkan DISTRO_FEATURES
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)
--- meta/recipes-graphics/mesa/mesa.inc | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
meta/recipes-graphics/mesa/mesa.inc +1 -3
@@ -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"
Signature · 1 line
2.20.1
Em qua., 10 de fev. de 2021 às 08:12, Ray Smith <[email protected]> escreveu:
Quoted 5 lines
(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?
Signature · 3 lines
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
Quoted 4 lines · Otavio Salvador
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.
Hello Ray,
Quoted 7 lines · Ray Smith
Quoted 4 lines · Otavio Salvador
I didn't understand what you mean here. Could you elaborate this?
Quoted 6 lines
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.
Quoted 3 lines
Signature · 2 lines
Regards, Andrey.
Em qua., 10 de fev. de 2021 às 17:21, Andrey Zhizhikin <[email protected]> escreveu:
Quoted 20 lines · Ray Smith
Quoted 1 line
On Wed, Feb 10, 2021 at 1:26 PM Otavio Salvador <
Quoted 6 lines · [email protected]> wrote:
Quoted 4 lines
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:
Quoted 1 line
../mesa-20.3.2/meson.build:144:4: ERROR: Problem encountered: building
OpenGL ES without OpenGL is not supported.
Quoted 2 lines
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.
Quoted 1 line
Quoted 8 lines
Quoted 1 line
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.
Signature · 3 lines
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
Quoted 4 lines · Otavio Salvador
Em qua., 10 de fev. de 2021 às 17:21, Andrey Zhizhikin <[email protected]> escreveu:
Quoted 1 line
Quoted 9 lines
Quoted 5 lines
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:
Quoted 2 lines
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.
Quoted 19 lines · Ray Smith
Quoted 4 lines · Otavio Salvador
Em qua., 10 de fev. de 2021 às 17:21, Andrey Zhizhikin <[email protected]> escreveu:
Quoted 1 line
Quoted 9 lines
Quoted 5 lines
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:
Quoted 8 lines
Quoted 2 lines
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.
Quoted 2 lines · Martin Jansa
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.
Quoted 7 lines · 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.
Quoted 8 lines
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
Quoted 26 lines
Signed-off-by Ray Smith <[email protected]>--- meta/recipes-graphics/mesa/mesa.inc | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)meta/recipes-graphics/mesa/mesa.inc +1
-3@@ -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"
Quoted 6 lines · On Wed, Feb 10, 2021 at 3:15 PM akuster808 <[email protected]> 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.
Quoted 3 lines · Ray Smith
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