Mesa (main): vulkan/wsi: return VK_SUBOPTIMAL_KHR for sw/x11 on window resize
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Wed Jul 20 22:04:24 UTC 2022
Module: Mesa
Branch: main
Commit: 6139493ae384cfdc8452fabd41287ebd1d539f4c
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=6139493ae384cfdc8452fabd41287ebd1d539f4c
Author: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Date: Tue Jul 19 16:40:06 2022 -0400
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 <ajax at redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17638>
---
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;
More information about the mesa-commit
mailing list