vulkan/wsi: avoid deadlocking dri3 when polling deleted windows for events

upcoming xserver releases will emit PresentConfigureNotify with this
flag set when a window is destroyed, ensuring drivers
don't poll infinitely and deadlock

fixes #6685

cc: mesa-stable

Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Michel Dänzer <mdaenzer@redhat.com>
Acked-by: Daniel Stone <daniels@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21339>
(cherry picked from commit 819cbf329a)
This commit is contained in:
Mike Blumenkrantz 2023-02-15 10:10:26 -05:00 committed by Dylan Baker
parent f4990da4a0
commit d515593a40
2 changed files with 7 additions and 1 deletions

View file

@ -22,7 +22,7 @@
"description": "vulkan/wsi: avoid deadlocking dri3 when polling deleted windows for events",
"nominated": true,
"nomination_type": 0,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": null
},

View file

@ -1108,6 +1108,10 @@ x11_get_wsi_image(struct wsi_swapchain *wsi_chain, uint32_t image_index)
return &chain->images[image_index].base;
}
/* XXX this belongs in presentproto */
#ifndef PresentWindowDestroyed
#define PresentWindowDestroyed (1 << 0)
#endif
/**
* Process an X11 Present event. Does not update chain->status.
*/
@ -1118,6 +1122,8 @@ x11_handle_dri3_present_event(struct x11_swapchain *chain,
switch (event->evtype) {
case XCB_PRESENT_CONFIGURE_NOTIFY: {
xcb_present_configure_notify_event_t *config = (void *) event;
if (config->pixmap_flags & PresentWindowDestroyed)
return VK_ERROR_SURFACE_LOST_KHR;
if (config->width != chain->extent.width ||
config->height != chain->extent.height)