present: Send a PresentConfigureNotify event for destroyed windows

This enables fixing a deadlock case on the client side, where the client
ends up blocked waiting for a Present event that will never come because
the window was destroyed. The new PresentWindowDestroyed flag allows the
client to avoid blocking indefinitely.

Signed-off-by: Adam Jackson <ajax@redhat.com>
See-also: https://gitlab.freedesktop.org/mesa/mesa/-/issues/116
See-also: https://gitlab.freedesktop.org/mesa/mesa/-/issues/6685
Reviewed-by: Michel Dänzer <mdaenzer@redhat.com>
(cherry picked from commit 462b06033e)
This commit is contained in:
Adam Jackson 2023-02-02 12:26:27 -05:00 committed by Olivier Fourdan
parent 7c791b1550
commit b98fc07d34
3 changed files with 19 additions and 4 deletions

View File

@ -102,7 +102,8 @@ present_event_swap(xGenericEvent *from, xGenericEvent *to)
}
void
present_send_config_notify(WindowPtr window, int x, int y, int w, int h, int bw, WindowPtr sibling)
present_send_config_notify(WindowPtr window, int x, int y, int w, int h,
int bw, WindowPtr sibling, CARD32 flags)
{
present_window_priv_ptr window_priv = present_window_priv(window);
@ -122,7 +123,7 @@ present_send_config_notify(WindowPtr window, int x, int y, int w, int h, int bw,
.off_y = 0,
.pixmap_width = w,
.pixmap_height = h,
.pixmap_flags = 0
.pixmap_flags = flags
};
present_event_ptr event;

View File

@ -43,6 +43,11 @@
#define DebugPresent(x)
#endif
/* XXX this belongs in presentproto */
#ifndef PresentWindowDestroyed
#define PresentWindowDestroyed (1 << 0)
#endif
extern int present_request;
extern DevPrivateKeyRec present_screen_private_key;
@ -307,7 +312,7 @@ void
present_free_events(WindowPtr window);
void
present_send_config_notify(WindowPtr window, int x, int y, int w, int h, int bw, WindowPtr sibling);
present_send_config_notify(WindowPtr window, int x, int y, int w, int h, int bw, WindowPtr sibling, CARD32 flags);
void
present_send_complete_notify(WindowPtr window, CARD8 kind, CARD8 mode, CARD32 serial, uint64_t ust, uint64_t msc);

View File

@ -93,6 +93,15 @@ present_destroy_window(WindowPtr window)
present_screen_priv_ptr screen_priv = present_screen_priv(screen);
present_window_priv_ptr window_priv = present_window_priv(window);
present_send_config_notify(window,
window->drawable.x,
window->drawable.y,
window->drawable.width,
window->drawable.height,
window->borderWidth,
window->nextSib,
PresentWindowDestroyed);
if (window_priv) {
present_clear_window_notifies(window);
present_free_events(window);
@ -123,7 +132,7 @@ present_config_notify(WindowPtr window,
ScreenPtr screen = window->drawable.pScreen;
present_screen_priv_ptr screen_priv = present_screen_priv(screen);
present_send_config_notify(window, x, y, w, h, bw, sibling);
present_send_config_notify(window, x, y, w, h, bw, sibling, 0);
unwrap(screen_priv, screen, ConfigNotify);
if (screen->ConfigNotify)