XWayland unable to obtain EGL display for OpenGL rendering

Try as I might, I am as yet unable to succesfully run apps under XWayland while targeting an GTX 970 device

From a hardware perspective, I have two use cases

  • Running a dual discrete GPU machine with only the nvidia proprietary drivers loaded
  • Running a dual discrete GPU machine with both nvidia + amdgpu drivers and attempting to target the GTX 970 directly for OpenGL rendering

I’ve documented part of my experience here

When running in a dual-gpu arrangement, the default execution environment sees the nVidia driver fallback to Mesa and I end up with a swrast based rendering. The reason for the fallback is not clear.

Attempts to target the GTX 970 directly with the use of (various combinations) of the following, result in being unable to obtain an EGL display:

__EGL_VENDOR_LIBRARY_FILENAMES=/usr/share/glvnd/egl_vendor.d/10_nvidia.json
__GLX_VENDOR_LIBRARY_NAME=nvidia
EGL_LOG_LEVEL=debug
EGL_PLATFORM=x11
XDG_SESSION_TYPE=x11

Note that I encounter the same behaviour when booting with only the nvidia drivers (all others blacklisted).

In all such cases, the output remains:

EGLUT: failed to initialize EGL display

In my own application code, I’m finding that eglGetPlatformDisplayEXT() returns EGL_NO_DISPLAY and of course a subsequent eglInitialize() fails (as you might expect).

I’ve tried falling back to eglGetDisplay rather than eglGetPlatformDisplay to no avail.

For the sake of clarity, I’m requesting an EGL_EXT_platform_x11 display when calling eglGetPlatformDisplay. I am aware that XCB is not currently supported for XWayland.

For the benefit of doubt, using the documentation for guidance… I have confirmed the requirements

  • DRM KMS enabled
  • libxcb 1.16 > 1.13
  • egl-wayland 1.1.13 > 1.1.7

I’ve also tried with kms-modifiers explicitly enabled (gnome).

I’m running the latest feature branch drivers v545.29.06

Lastly, this issue occurs in both gnome(mutter) and plasma(kwin), across both Arch Linux and Fedora 39

I’ve attached an nvidia bug report as follows
This report is with only the nVidia drivers loaded (amdgpu/nouveau blacklisted)

nvidia-bug-report.log.gz (899.6 KB)

My next step is to send this to linux-bugs@nvidia.com, presuming I’ve not missed something egregiously obvious.

I don’t think this is nvidia driver related, anything egl seems to use Zink and crashes.

Zink is just a fallback that is triggerred after GLVND bails out.
Further, the Zink issue is resolved in Mesa 24 (or main). It was also patched out for Fedora with Mesa 23.3.2 (See here)

My usage of __EGL_VENDOR_LIBRARY_FILENAMES is intended to bypass Mesa to focus the attention directly on the nVidia driver. That seems to be doing as I expected.

Stepping through with a debugger clearly shows GLVND returning EGL_NO_DISPLAY

I don’t know if this is related but I made a quick test with glmark2 under wayland session on my laptop (Intel UHD + RTX 3060 in offload mode) and it seems that GLES XWayland apps can not use offloading for some reason, use Intel UHD instead.
glmark2, glmark2-wayland and glmark2-es2-wayland successfully run on nvidia gpu, but glmark2-es2 runs on Intel GPU even if prime render offloading is enabled.

nvidia-bug-report.log.gz (1.4 MB)