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@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17638>
This commit is contained in:
Mike Blumenkrantz 2022-07-19 16:40:06 -04:00 committed by Marge Bot
parent 74aea0b840
commit 6139493ae3
1 changed files with 15 additions and 1 deletions

View File

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