Add device FD to zwp_linux_dmabuf_v1
zwp_linux_dmabuf_v1 for the compositor to advertise supported DRM formats and modifiers, and for clients to subsequently then create new
wl_buffers from a set of dmabufs & metadata (format, modifier, dimensions, strides/offsets).
Mesa (any EGL or Vulkan driver which supports modifiers) and GStreamer (
waylandsink with upstreams supporting dmabuf) both use this protocol to allocate their client buffers. GStreamer has no alternate way to support zerocopy buffer passing, but Mesa falls back to
wl_drm (a private interface added by calling
eglBindWaylandDisplayWL on the server) if the dmabuf protocol is not available.
However, Mesa also depends on
wl_drm being exposed even if
zwp_linux_dmabuf_v1 is being used.
wl_drm also provides a
device event, passing a DRM FD from compositor to client, so the client can infer additional placement parameters. For instance, if Mesa is rendering on a different GPU than the compositor is using for its rendering, then it must make sure the memory is accessible between devices, e.g. being placed in GTT space rather than hidden dedicated VRAM.
It would be good to have a similar event in
zwp_linux_dmabuf_v1, so the client can know more details about how to allocate its buffers (e.g. placement), or even to take a hint as to a 'preferred' GPU, e.g. to implement
Forked from XWayland bug #108038