Apparently NVIDIA drivers dont handle this well. Sigh.
Go back to calling wl_egl_window_resize() before resizing the
framebuffer instead of before swapping in the resized framebuffer.
Logically, these should be equivalent, but...
Wayland is such an ongoing disaster.
Fixes#7493 (I hope).
Call wl_egl_window_resize just buffer swapping buffers at which point
the context is already correct.
Also might workaround bugs in the NVIDIA driver: https://github.com/NVIDIA/egl-wayland/issues/52
Only call wl_surface_commit() after a resize when the correct size buffer is
attached to the surface. This is ensured by setting a flag on the window that prevents
all surface commits till it is cleared. The flag is cleared at next
eglSwapBuffers().
I dont actually understand if this guarantees that the
buffer size is always correct. For example, if the back buffer is
latched when wl_egl_resize_window() is called, the backbuffer will be
correct only after two swaps (I think). Or maybe the old back buffer is
discarded, I cant find any documentation about it.
All I can say is that doing it this way seems to fix the issue.
Thanks to @jadahl for his help with tracking down the root cause.
Fixes#4802
glfw should not be swapping buffers behind the clients back. Since we
control the client, we can ensure that the OpenGL VRAM is cleared before
the window is shown.
Also fixes the issue with the glfw wayland backend where the buffer was
being created before the surface was configured