The new-ish code to listen for destroy on surfaces on the wlserver side
installs a dynamic listener. We need to remove it from the list before
freeing it, or wayland will try to do it when the signal gets destroyed,
which involves updating the link member in the freed memory.
Some xcb protocol allocations would often get allocated there in that
short time window and get scribbled on.
https://github.com/Plagman/gamescope/issues/7
Ironic. 064d132c could save others from use-after-free, but not itself.
wlr_texture_to_dmabuf involves issuing EGL commands to get a DMA-BUF out
of an EGLImage.
When the client submits a DMA-BUF via the linux-dmabuf protocol, there's
no need to go through EGL. We can directly import the client's DMA-BUF
into Vulkan.
The old code is still retained as a fallback in case the client uses
wl_drm (old Xwayland) or wl_shm. Removing it would involve creating a
Vulkan-based wlr_renderer.
References: https://github.com/Plagman/gamescope/issues/16
wlroots headers can mostly be included with extern "C" blocks. Two
exceptions are the use of `static` for array args and `class` as a
struct field. These can be #define'ed to avoid C++ build errors.
This allows the whole project to be built as a single C++ codebase,
without having to maintain hybrid header files.