vulkan/wsi/wayland: add per-surface dma-buf feedback support
authorLeandro Ribeiro <leandro.ribeiro@collabora.com>
Thu, 13 Oct 2022 21:16:37 +0000 (18:16 -0300)
committerMarge Bot <emma+marge@anholt.net>
Fri, 21 Oct 2022 12:15:37 +0000 (12:15 +0000)
commitdf776419934bf7bd2e245a17118190b9d98df89b
treebe9afa53b9d2e777ecd548cb0d1dec38618c3fff
parentedd3c00d5d02bb6412b67aba6ae4d1eeabbe4865
vulkan/wsi/wayland: add per-surface dma-buf feedback support

Follow up of "vulkan/wsi/wayland: add default dma-buf feedback support".

The surface feedback is dynamic, differently from the default feedback.
When we receive per-surface feedback, that means that we could be using
a better DRM format/modifier pair for the chain's buffers. So the next
time that the client calls vkAcquireNextImageKHR(), we return
VK_SUBOPTIMAL_KHR instead of VK_SUCCESS. Some clients will re-create the
swapchain when receiving SUBOPTIMAL, and for those we'll re-create the
chain. An optimal DRM format/modifier pair from the per-surface feedback
will be used to create the images of this swapchain.

Note that for now we won't be able to change the DRM format, only the
modifier. That's good enough for many cases in which direct scanout
would not be possible because of the modifier. In order to be able to
switch the format, we'll need a mechanism to negotiate preferred formats
with clients. Currently we can only expose a set of supported formats
all with the same preference.

Reviewed-by: Simon Ser <contact@emersion.fr>
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12226>
src/vulkan/wsi/wsi_common_wayland.c