summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2015-10-02 13:44:13 -0700
committerJason Ekstrand <[email protected]>2015-10-02 13:44:53 -0700
commitc1553653a2ed4f06301a7818a1878da46f785882 (patch)
tree9c98daa0e42eff6165d2cc5f5e9fb24e47c609db
parent005c8e01062e8e88a86904b955d5422742bd32e7 (diff)
vk/wsi/x11: Send OUT_OF_DATE if the X drawable goes away
-rw-r--r--src/vulkan/anv_wsi_x11.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/vulkan/anv_wsi_x11.c b/src/vulkan/anv_wsi_x11.c
index e5d0a2572aa..03aef4cbf23 100644
--- a/src/vulkan/anv_wsi_x11.c
+++ b/src/vulkan/anv_wsi_x11.c
@@ -192,9 +192,18 @@ x11_acquire_next_image(struct anv_swap_chain *anv_chain,
struct x11_image *image = &chain->images[chain->next_image];
if (image->busy) {
+ xcb_generic_error_t *err;
xcb_get_geometry_reply_t *geom =
- xcb_get_geometry_reply(chain->conn, image->geom_cookie, NULL);
- image->busy = false;
+ xcb_get_geometry_reply(chain->conn, image->geom_cookie, &err);
+ if (!geom) {
+ if (err->error_code == XCB_DRAWABLE) {
+ /* Probably the best thing to do if our drawable goes away */
+ return vk_error(VK_ERROR_OUT_OF_DATE_WSI);
+ } else {
+ return vk_error(VK_ERROR_UNKNOWN);
+ }
+ free(err);
+ }
if (geom->width != chain->extent.width ||
geom->height != chain->extent.height) {
@@ -202,6 +211,8 @@ x11_acquire_next_image(struct anv_swap_chain *anv_chain,
return vk_error(VK_ERROR_OUT_OF_DATE_WSI);
}
free(geom);
+
+ image->busy = false;
}
*image_index = chain->next_image;