glutin: Proprietary Nvidia (Wayland): eglCreateWindowSurface failed

Migrated from jwilm/alacritty#1269

A segfault occurs when using glutin with the binary Nvidia driver and a Wayland compositor.

Backtrace obtained from rust-gdb from running glutin’s window example:

https://gist.github.com/aidanharris/f1fe409c463e79c575242a9edd255ea8

If I force the mesa driver to be used instead of Nvidia’s library (env LD_PRELOAD=/usr/lib64/libEGL.so cargo run --example window) no segfault occurs and the example runs fine (I assume mesa is doing software rendering but it does work so perhaps this is an issue with the Nvidia driver?).

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 3
  • Comments: 22 (7 by maintainers)

Most upvoted comments

This is fixed by https://github.com/NVIDIA/egl-wayland/commit/2eb4628d64a8297fb4c08aa796fdf33ff54a670f. I tested many examples and they worked well!

Same issue here.

(My guess is that more and more peeps will have this issue now that the Nvidia-driver supports hardware accelerated xwayland and more people make the switch to Wayland.)

Remark. eglGetError(), if called just before the subject error is raised, returns the following:

EGL_BAD_NATIVE_WINDOW 0x300B
An EGLNativeWindowType argument does not refer to a valid
native window.

native window is usually created with call to wl_compositor_create_surface followed by wl_egl_window_create. And looks like the latter returns invalid handle (or maybe this handle becomes invalid when eglCreateWindowSurface is executed)

This seems likely to be caused by NVIDIA/egl-wayland#34.

A reboot later and it seems to work fine with Nouveau. The examples run and I know I’m using Nouveau (other than lsmod telling me so) because I managed to cause the Linux kernel to hang which is sadly typical behaviour for Nouveau 😦