vulkan/wsi/x11: lower resize events to VK_SUBOPTIMAL_KHR

Currently, a resized window results in an VK_ERROR_OUT_OF_DATE_KHR. But,
this seems to go against the spec, which suggests returning
VK_SUBOPTIMAL_KHR if the surface extent no longer matches the window
extent. (It does not *require* the WSI actually scale the contents, only
encourages doing so "if possible")

More to the point, VK_SUBOPTIMAL_KHR is the correct status to return if
the client *can* continue presenting to this swapchain, even if the
result will look wrong / "suboptimal". It's the client's decision on
when exactly to recreate the swapchain in this case, and the client may
very well end up wanting to continue presenting for a frame or two, to
prevent flooding the driver with swapchain recreations (which can result
in the window appearing visually "frozen" while resizing).

This change makes live resizing *significantly* smoother in e.g. mpv.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3196>
This commit is contained in:
Niklas Haas 2019-12-22 03:28:15 +01:00 committed by Marge Bot
parent 4a1f230e35
commit 0245b82570

View file

@ -893,7 +893,7 @@ x11_handle_dri3_present_event(struct x11_swapchain *chain,
if (config->width != chain->extent.width ||
config->height != chain->extent.height)
return VK_ERROR_OUT_OF_DATE_KHR;
return VK_SUBOPTIMAL_KHR;
break;
}