From 6139493ae384cfdc8452fabd41287ebd1d539f4c Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Tue, 19 Jul 2022 16:40:06 -0400 Subject: [PATCH] vulkan/wsi: return VK_SUBOPTIMAL_KHR for sw/x11 on window resize the other codepaths all end up checking geometry in one way or another in order to validate the extents, so add a check here to do the same fixes #6893 Reviewed-by: Adam Jackson Part-of: --- src/vulkan/wsi/wsi_common_x11.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/vulkan/wsi/wsi_common_x11.c b/src/vulkan/wsi/wsi_common_x11.c index 4554dac9808..ba3f23409c6 100644 --- a/src/vulkan/wsi/wsi_common_x11.c +++ b/src/vulkan/wsi/wsi_common_x11.c @@ -1369,7 +1369,21 @@ x11_acquire_next_image(struct wsi_swapchain *anv_chain, if (!chain->images[i].busy) { *image_index = i; chain->images[i].busy = true; - return VK_SUCCESS; + xcb_generic_error_t *err; + + xcb_get_geometry_cookie_t geom_cookie = xcb_get_geometry(chain->conn, chain->window); + xcb_get_geometry_reply_t *geom = xcb_get_geometry_reply(chain->conn, geom_cookie, &err); + VkResult result = VK_SUCCESS; + if (geom) { + if (chain->extent.width != geom->width || + chain->extent.height != geom->height) + result = VK_SUBOPTIMAL_KHR; + } else { + result = VK_ERROR_SURFACE_LOST_KHR; + } + free(err); + free(geom); + return result; } } return VK_NOT_READY;