aboutsummaryrefslogtreecommitdiffstats
path: root/src/vulkan/anv_wsi_x11.c
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2015-10-13 15:00:35 -0700
committerJason Ekstrand <[email protected]>2015-10-13 15:10:40 -0700
commitfd2ec1c8ada5df8899c59847c6711303119ae56c (patch)
tree7a0e509ac102391be8532be1e7af0e0f2f9ef8ea /src/vulkan/anv_wsi_x11.c
parentc31f926726c64239b1fce3c685f37954e0d8984b (diff)
anv/x11: Do something sensible if get_geometry fails in GetSurfaceProperties
Diffstat (limited to 'src/vulkan/anv_wsi_x11.c')
-rw-r--r--src/vulkan/anv_wsi_x11.c22
1 files changed, 14 insertions, 8 deletions
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;