From 0245b8257066fe786d1999e107ac140b85365e18 Mon Sep 17 00:00:00 2001 From: Niklas Haas Date: Sun, 22 Dec 2019 03:28:15 +0100 Subject: [PATCH] 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 Part-of: --- src/vulkan/wsi/wsi_common_x11.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vulkan/wsi/wsi_common_x11.c b/src/vulkan/wsi/wsi_common_x11.c index 610270b0539..23e18aeb921 100644 --- a/src/vulkan/wsi/wsi_common_x11.c +++ b/src/vulkan/wsi/wsi_common_x11.c @@ -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; }