EGL not returning correct EGLDisplay under Wayland

Hi

We’ve run across a odd issue with a recent change to Firefox (currently in nightly) on Wayland.

At some point FF calls eglGetDisplay(EGL_DEFAULT_DISPLAY), and gets back a swrast display, rather than the expected NVIDIA one.

There is a debug output we catch that seems to suggest that the NVIDIA driver isn’t handling this situation correctly:

eglGetDisplay: X screen is not using the NVIDIA driver.

It seems that when the above eglGetDisplay call is made under Wayland, with XWayland running (and the DISPLAY env var set), the NVIDIA driver gets confused and thinks it’s running under X. It tries to init but fails and gives up. If you unset DISPLAY or set EGL_PLATFORM=wayland, everything works correctly.

I’m not really sure where this issue lies, Firefox, glvnd, or the NVIDIA driver itself. I think it’s a little of Firefox and the drivers fault, Firefox should be providing the platform, and the driver should handle the case where the X screen isn’t using the NVIDIA driver and check if there’s a Wayland display.

Regards
elFarto