Re: eglGetDisplay(EGL_DEFAULT_DISPLAY)
Pekka Paalanen <[email protected]> Tue, 30 Apr 2024 17:39:44 +0300
| Newsgroups | gmane.comp.video.mesa3d.user |
|---|---|
| Message-ID | <20240430173944.59f6a663@eldfell> |
--Sig_/Nbu2uM8y=6YU4FnuCgCbyrD Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Tue, 30 Apr 2024 09:58:32 -0300 Thiago Milczarek Say=C3=A3o <[email protected]> wrote: > Hi, >=20 > I'm looking the docs at > https://registry.khronos.org/EGL/sdk/docs/man/html/eglGetDisplay.xhtml >=20 > But I'm still in doubt how it actually works, especially on Mesa. >=20 > Will it detect which platform it's on if I pass EGL_DEFAULT_DISPLAY ? For > example, if I want to use the same code for Wayland and X11. I think Mesa EGL will first look at environment variable EGL_PLATFORM for a hard-override of the chosen platform. Otherwise, it tries to detect a platform from the native display passed in, which EGL_DEFAULT_DISPLAY does not provide. Finally there is a build-time chosen fallback. eglGetDisplay itself is a bit problematic since it was not intended to support choosing the platform at runtime (only at EGL implementation build time). New code would be better using eglGetPlatformDisplay(EXT) if at all possible, especially when you want it to work on multiple platforms, or just to be safe that EGL does not guess wrong what kind of native display you are passing in. Guessing it wrong would cause nonsensical errors or crashes. This is also why using EGL_PLATFORM environment variable is not a good idea. FWIW, on Wayland, EGL_DEFAULT_DISPLAY will not allow you to render into a window. It would open a new Wayland connection, but your application windows are created through a connection you made yourself, so EGL would not be able to target your windows. Each wl_surface is private to the connection where it was created. Thanks, pq --Sig_/Nbu2uM8y=6YU4FnuCgCbyrD Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEJQjwWQChkWOYOIONI1/ltBGqqqcFAmYxArAACgkQI1/ltBGq qqfZzBAAq/fIjK7B59j3moeEFBvat6KL/dan4ySnCNjnzhC37TWaYBSWQIrBDZra j937jfkmnajpOedIJa/EBrCb1ulEQ0MjA0T7oS4U2WQDA4HiCsn7ehgXv1B90ZOh 3qwXXms3hCuov9XvPY17sylNiU6t7sk0IaDE39QjGEOiVmksveyXrRmoEANlRvMA H5Zu5Y8RH2TVWt8IzagaqiGeDicl8I48lwro02+EVLi+PIGdVA/n9v3lvxJTH1W6 Sc1uq3K0sFYIbXRPoI9nxGKVieh6oL8ftXwBiIsaw2saxgglSYPMBrr+YHcbiAFx DbfXaT6GAnhwN+gfNzwmvSzIE4yOHKRXuNDY7I9sjUR9eqTaFwj74o6i+8sF5ZR2 +Z2ZkmiiNdLspS5B+CSv47A+SKEatlqA+D6W5gQtUMZ430SZ16NRj7IKJGyaj0kG BQXdOcYSiVWzJLP6lhCAPkpkkv0FYq4+8PNkQU/8U+1SSXxmjYgtg2YiReUdgPJ+ Aa4F0aan6WxkIjmjrOQuDA7NwUTXC9fae7/7wt7bcADITgnmJ8ku4G2TIzqoEdfM 0EmEUJ2zLpHJOSv9RTUECxo5neDJY5SJY4gH5gcd618coHxSb07TEWHcv3QQjiq4 uVbfVhY1G62M4EAq45isVw8EygtgJDTIr0+THoKZCqe5L2nY3ZE= =5qpo -----END PGP SIGNATURE----- --Sig_/Nbu2uM8y=6YU4FnuCgCbyrD--