[PATCHv2,4/6] libsdl2: dont mix opengl and gles backends for wayland

Message ID 20220604053028.4682-4-f_l_k@t-online.de
State New
Headers show
Series [PATCHv2,1/6] xorg-lib-common: allow to build for wayland | expand

Commit Message

Markus Volk June 4, 2022, 5:30 a.m. UTC
This fixes "Could not initialize egl display" in libsdl2 apps for
wayland without DISTRO_FEATURE x11

Signed-off-by: Markus Volk <f_l_k@t-online.de>
---
 meta/recipes-graphics/libsdl2/libsdl2_2.0.22.bb | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

Comments

Richard Purdie June 4, 2022, 1:27 p.m. UTC | #1
On Sat, 2022-06-04 at 07:30 +0200, Markus Volk wrote:
> This fixes "Could not initialize egl display" in libsdl2 apps for
> wayland without DISTRO_FEATURE x11
> 
> Signed-off-by: Markus Volk <f_l_k@t-online.de>
> ---
>  meta/recipes-graphics/libsdl2/libsdl2_2.0.22.bb | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/meta/recipes-graphics/libsdl2/libsdl2_2.0.22.bb b/meta/recipes-graphics/libsdl2/libsdl2_2.0.22.bb
> index 8519e7f732..e057b5cbbc 100644
> --- a/meta/recipes-graphics/libsdl2/libsdl2_2.0.22.bb
> +++ b/meta/recipes-graphics/libsdl2/libsdl2_2.0.22.bb
> @@ -56,14 +56,16 @@ EXTRA_OECMAKE = "-DSDL_OSS=OFF -DSDL_ESD=OFF -DSDL_ARTS=OFF \
>  
>  # opengl packageconfig factored out to make it easy for distros
>  # and BSP layers to pick either (desktop) opengl, gles2, or no GL
> -PACKAGECONFIG_GL ?= "${@bb.utils.filter('DISTRO_FEATURES', 'opengl', d)}"
> +PACKAGECONFIG_GL ?= " \
> +    ${@bb.utils.contains('DISTRO_FEATURES', 'x11 opengl', 'opengl', '', d)} \
> +    ${@bb.utils.contains('DISTRO_FEATURES', 'wayland opengl', 'gles2', '', d)} \
> +"
>  
>  PACKAGECONFIG:class-native = "x11 ${PACKAGECONFIG_GL}"
>  PACKAGECONFIG:class-nativesdk = "${@bb.utils.filter('DISTRO_FEATURES', 'x11', d)} ${PACKAGECONFIG_GL}"
>  PACKAGECONFIG ??= " \
>      ${PACKAGECONFIG_GL} \
> -    ${@bb.utils.filter('DISTRO_FEATURES', 'alsa directfb pulseaudio x11', d)} \
> -    ${@bb.utils.contains('DISTRO_FEATURES', 'wayland', 'wayland gles2', '', d)} \
> +    ${@bb.utils.filter('DISTRO_FEATURES', 'alsa directfb pulseaudio x11 wayland', d)} \
>      ${@bb.utils.contains("TUNE_FEATURES", "neon","arm-neon","",d)} \
>  "
>  PACKAGECONFIG[alsa]       = "-DSDL_ALSA=ON,-DSDL_ALSA=OFF,alsa-lib,"

I think this is breaking mingw builds:

https://autobuilder.yoctoproject.org/typhoon/#/builders/89/builds/5320


Cheers,

Richard
Markus Volk June 4, 2022, 4:25 p.m. UTC | #2
Could it be that we need to add a wayland exception here as well, since 
xorgproto can now be built for wayland?

https://git.yoctoproject.org/meta-mingw/tree/recipes-graphics/libsdl2/libsdl2_%25.bbappend?h=master-next#n4

Am 04.06.22 um 15:27 schrieb Richard Purdie:
> On Sat, 2022-06-04 at 07:30 +0200, Markus Volk wrote:
>> This fixes "Could not initialize egl display" in libsdl2 apps for
>> wayland without DISTRO_FEATURE x11
>>
>> Signed-off-by: Markus Volk <f_l_k@t-online.de>
>> ---
>>   meta/recipes-graphics/libsdl2/libsdl2_2.0.22.bb | 8 +++++---
>>   1 file changed, 5 insertions(+), 3 deletions(-)
>>
>> diff --git a/meta/recipes-graphics/libsdl2/libsdl2_2.0.22.bb b/meta/recipes-graphics/libsdl2/libsdl2_2.0.22.bb
>> index 8519e7f732..e057b5cbbc 100644
>> --- a/meta/recipes-graphics/libsdl2/libsdl2_2.0.22.bb
>> +++ b/meta/recipes-graphics/libsdl2/libsdl2_2.0.22.bb
>> @@ -56,14 +56,16 @@ EXTRA_OECMAKE = "-DSDL_OSS=OFF -DSDL_ESD=OFF -DSDL_ARTS=OFF \
>>   
>>   # opengl packageconfig factored out to make it easy for distros
>>   # and BSP layers to pick either (desktop) opengl, gles2, or no GL
>> -PACKAGECONFIG_GL ?= "${@bb.utils.filter('DISTRO_FEATURES', 'opengl', d)}"
>> +PACKAGECONFIG_GL ?= " \
>> +    ${@bb.utils.contains('DISTRO_FEATURES', 'x11 opengl', 'opengl', '', d)} \
>> +    ${@bb.utils.contains('DISTRO_FEATURES', 'wayland opengl', 'gles2', '', d)} \
>> +"
>>   
>>   PACKAGECONFIG:class-native = "x11 ${PACKAGECONFIG_GL}"
>>   PACKAGECONFIG:class-nativesdk = "${@bb.utils.filter('DISTRO_FEATURES', 'x11', d)} ${PACKAGECONFIG_GL}"
>>   PACKAGECONFIG ??= " \
>>       ${PACKAGECONFIG_GL} \
>> -    ${@bb.utils.filter('DISTRO_FEATURES', 'alsa directfb pulseaudio x11', d)} \
>> -    ${@bb.utils.contains('DISTRO_FEATURES', 'wayland', 'wayland gles2', '', d)} \
>> +    ${@bb.utils.filter('DISTRO_FEATURES', 'alsa directfb pulseaudio x11 wayland', d)} \
>>       ${@bb.utils.contains("TUNE_FEATURES", "neon","arm-neon","",d)} \
>>   "
>>   PACKAGECONFIG[alsa]       = "-DSDL_ALSA=ON,-DSDL_ALSA=OFF,alsa-lib,"
> I think this is breaking mingw builds:
>
> https://autobuilder.yoctoproject.org/typhoon/#/builders/89/builds/5320
>
>
> Cheers,
>
> Richard
Richard Purdie June 6, 2022, 11:30 a.m. UTC | #3
On Sat, 2022-06-04 at 18:25 +0200, Markus Volk wrote:

> Am 04.06.22 um 15:27 schrieb Richard Purdie:
> > I think this is breaking mingw builds:
> > 
> > https://autobuilder.yoctoproject.org/typhoon/#/builders/89/builds/5320
> > 
> > 
> Could it be that we need to add a wayland exception here as well, since 
> xorgproto can now be built for wayland?
> 
> https://git.yoctoproject.org/meta-mingw/tree/recipes-graphics/libsdl2/libsdl2_%25.bbappend?h=master-next#n4

No, that isn't the issue.

The challenge is you've changed the configuration and dependencies of
libsdl and these new dependencies don't build on mingw. We need to
correct either the configuration of mingw buildss (wrt
DISTRO_FEATURES), or rethink the issues at hand here.

I share Ross' concern about the x11 distro feature effectively becoming
meaningless. Pure wayland shouldn't be needing these things and there
is something else not quite right here. We do need to step back, state
which problem we're trying to solve and then look at the issues in
doing that. The patches in this series say a lot about what they do but
not why.

Cheers,

Richard
Markus Volk June 6, 2022, 12:50 p.m. UTC | #4
I've read the error report for mingw build and did some tests yesterday.

Added meta-mingw to bblayers.conf and this to local.conf

SDKMACHINE="x86_64-mingw32"
DISTRO_FEATURES:remove = "x11"

and then did 'bitbake core-image-minimal -c do_populate_sdk'

This lead to the expected error message

| Checking whether type "fd_set" has member "fds_bits" : NO
| Checking whether type "fd_set" has member "__fds_bits" : NO
|
| ../xorgproto-2022.1/include/X11/meson.build:19:4: ERROR: Problem 
encountered: Your fd_set is too weird.
|
| A full log can be found at 
/home/flk/build/poky/build/tmp/work/x86_64-nativesdk-mingw32-w64-mingw32/nativesdk-xorgproto/2022.1-r0/build/meson-logs/meson-log.txt
| ERROR: meson failed

I was able to fix this by changing the libsdl2.bbappend in meta-mingw 
like this:

PACKAGECONFIG:remove:mingw32:class-nativesdk = "x11 opengl gles2"

Like this libsdl2 doesn't try to build in gl for wayland either and my 
build succeeded.

I sent a patch to openembedded-devel for this yesterday.

In general, I think it's a matter of perspective. The current state 
forces me to request x11 globally and thus prevents me from deciding 
within recipes what to do for wayland and what to do for x11 
DISTRO_FEATURE. They always have to come in pairs. I thought that from 
wayland's point of view it would be ok to include and use x11, although 
it should not be done by default. I understand your concerns about 
losing the clean line when mixing x11/Wayland, and it was just an idea. 
If you don't like it, I have no problem with it.

Am 06.06.22 um 13:30 schrieb Richard Purdie:
> that isn't the issue.
>
> The challenge is you've changed the configuration and dependencies of
> libsdl and these new dependencies don't build on mingw. We need to
> correct either the configuration of mingw buildss (wrt
> DISTRO_FEATURES), or rethink the issues at hand here.
Richard Purdie June 6, 2022, 12:58 p.m. UTC | #5
On Mon, 2022-06-06 at 14:50 +0200, Markus Volk wrote:
> I've read the error report for mingw build and did some tests yesterday.
> 
> Added meta-mingw to bblayers.conf and this to local.conf
> 
> SDKMACHINE="x86_64-mingw32"
> DISTRO_FEATURES:remove = "x11"
> 
> and then did 'bitbake core-image-minimal -c do_populate_sdk'
> 
> This lead to the expected error message
> 
> > Checking whether type "fd_set" has member "fds_bits" : NO
> > Checking whether type "fd_set" has member "__fds_bits" : NO
> > 
> > ../xorgproto-2022.1/include/X11/meson.build:19:4: ERROR: Problem 
> encountered: Your fd_set is too weird.
> > 
> > A full log can be found at 
> /home/flk/build/poky/build/tmp/work/x86_64-nativesdk-mingw32-w64-mingw32/nativesdk-xorgproto/2022.1-r0/build/meson-logs/meson-log.txt
> > ERROR: meson failed
> 
> I was able to fix this by changing the libsdl2.bbappend in meta-mingw 
> like this:
> 
> PACKAGECONFIG:remove:mingw32:class-nativesdk = "x11 opengl gles2"
> 
> Like this libsdl2 doesn't try to build in gl for wayland either and my 
> build succeeded.
> 
> I sent a patch to openembedded-devel for this yesterday.

Thanks, I've merged that so we don't run into that in future.

> In general, I think it's a matter of perspective. The current state 
> forces me to request x11 globally and thus prevents me from deciding 
> within recipes what to do for wayland and what to do for x11 
> DISTRO_FEATURE. They always have to come in pairs. I thought that from 
> wayland's point of view it would be ok to include and use x11, although 
> it should not be done by default. I understand your concerns about 
> losing the clean line when mixing x11/Wayland, and it was just an idea. 
> If you don't like it, I have no problem with it.

I think keeping the "clean" line with x11 is necessary at this point.

Cheers,

Richard

Patch

diff --git a/meta/recipes-graphics/libsdl2/libsdl2_2.0.22.bb b/meta/recipes-graphics/libsdl2/libsdl2_2.0.22.bb
index 8519e7f732..e057b5cbbc 100644
--- a/meta/recipes-graphics/libsdl2/libsdl2_2.0.22.bb
+++ b/meta/recipes-graphics/libsdl2/libsdl2_2.0.22.bb
@@ -56,14 +56,16 @@  EXTRA_OECMAKE = "-DSDL_OSS=OFF -DSDL_ESD=OFF -DSDL_ARTS=OFF \
 
 # opengl packageconfig factored out to make it easy for distros
 # and BSP layers to pick either (desktop) opengl, gles2, or no GL
-PACKAGECONFIG_GL ?= "${@bb.utils.filter('DISTRO_FEATURES', 'opengl', d)}"
+PACKAGECONFIG_GL ?= " \
+    ${@bb.utils.contains('DISTRO_FEATURES', 'x11 opengl', 'opengl', '', d)} \
+    ${@bb.utils.contains('DISTRO_FEATURES', 'wayland opengl', 'gles2', '', d)} \
+"
 
 PACKAGECONFIG:class-native = "x11 ${PACKAGECONFIG_GL}"
 PACKAGECONFIG:class-nativesdk = "${@bb.utils.filter('DISTRO_FEATURES', 'x11', d)} ${PACKAGECONFIG_GL}"
 PACKAGECONFIG ??= " \
     ${PACKAGECONFIG_GL} \
-    ${@bb.utils.filter('DISTRO_FEATURES', 'alsa directfb pulseaudio x11', d)} \
-    ${@bb.utils.contains('DISTRO_FEATURES', 'wayland', 'wayland gles2', '', d)} \
+    ${@bb.utils.filter('DISTRO_FEATURES', 'alsa directfb pulseaudio x11 wayland', d)} \
     ${@bb.utils.contains("TUNE_FEATURES", "neon","arm-neon","",d)} \
 "
 PACKAGECONFIG[alsa]       = "-DSDL_ALSA=ON,-DSDL_ALSA=OFF,alsa-lib,"