From: Jason Ekstrand Date: Tue, 13 Oct 2015 22:00:35 +0000 (-0700) Subject: anv/x11: Do something sensible if get_geometry fails in GetSurfaceProperties X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=fd2ec1c8ada5df8899c59847c6711303119ae56c;p=mesa.git anv/x11: Do something sensible if get_geometry fails in GetSurfaceProperties --- diff --git a/src/vulkan/anv_wsi_x11.c b/src/vulkan/anv_wsi_x11.c index 54e40918489..8834230f9cd 100644 --- a/src/vulkan/anv_wsi_x11.c +++ b/src/vulkan/anv_wsi_x11.c @@ -61,19 +61,25 @@ x11_get_surface_properties(struct anv_wsi_implementation *impl, xcb_generic_error_t *err; xcb_get_geometry_reply_t *geom = xcb_get_geometry_reply(conn, cookie, &err); - if (!geom) { + if (geom) { free(err); - return vk_error(VK_ERROR_OUT_OF_DATE_KHR); + VkExtent2D extent = { geom->width, geom->height }; + props->currentExtent = extent; + props->minImageExtent = extent; + props->maxImageExtent = extent; + } else { + /* This can happen if the client didn't wait for the configure event + * to come back from the compositor. In that case, we don't know the + * size of the window so we just return valid "I don't know" stuff. + */ + free(geom); + props->currentExtent = (VkExtent2D) { -1, -1 }; + props->minImageExtent = (VkExtent2D) { 1, 1 }; + props->maxImageExtent = (VkExtent2D) { INT16_MAX, INT16_MAX }; } - VkExtent2D extent = { geom->width, geom->height }; - free(geom); - props->minImageCount = 2; props->maxImageCount = 4; - props->currentExtent = extent; - props->minImageExtent = extent; - props->maxImageExtent = extent; props->supportedTransforms = VK_SURFACE_TRANSFORM_NONE_BIT_KHR; props->currentTransform = VK_SURFACE_TRANSFORM_NONE_KHR; props->maxImageArraySize = 1;