Mesa (master): vulkan/wsi/x11: lower resize events to VK_SUBOPTIMAL_KHR

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Apr 27 19:54:35 UTC 2021


Module: Mesa
Branch: master
Commit: 0245b8257066fe786d1999e107ac140b85365e18
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=0245b8257066fe786d1999e107ac140b85365e18

Author: Niklas Haas <git at haasn.xyz>
Date:   Sun Dec 22 03:28:15 2019 +0100

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 at redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3196>

---

 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;
    }



More information about the mesa-commit mailing list