From 87e8cfaa6ffb312dd81a57c9ef0ebfc64f9f4ec5 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Wed, 3 Feb 2016 16:23:47 +0000 Subject: [PATCH] sna/dri2: Force AttendClient after DRI2DrawableGone DRI2 may call IgnoreClient but forget to call AttendClient when the drawable is destroyed, for example if the Window is deleted by a window-manager in the middle of a swap sequence. The Client will then never wake up and appears to freeze. The bug is just: diff --git a/hw/xfree86/dri2/dri2.c b/hw/xfree86/dri2/dri2.c index 2f05c64..80a601e 100644 --- a/hw/xfree86/dri2/dri2.c +++ b/hw/xfree86/dri2/dri2.c @@ -416,6 +416,9 @@ DRI2DrawableGone(void *p, XID id) (*pDraw->pScreen->DestroyPixmap)(pPriv->redirectpixmap); } + if (pPriv->blockedClient) + AttendClient(pPriv->blockedClient); + free(pPriv); return Success; but since we cannot order our cleanup before DRI2DrawableGone (as the resources are freed before either the Window is unrealized or destroyed, and the resources are freed in a random order) we have to resort to hackery. References: https://bugs.freedesktop.org/show_bug.cgi?id=93844 Testcase: dri2-race/manager Signed-off-by: Chris Wilson --- src/sna/sna_dri2.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/sna/sna_dri2.c b/src/sna/sna_dri2.c index 045b12d..0784e02 100644 --- a/src/sna/sna_dri2.c +++ b/src/sna/sna_dri2.c @@ -1853,9 +1853,18 @@ void sna_dri2_destroy_window(WindowPtr win) kgem_bo_destroy(&sna->kgem, info->pending.bo); info->pending.bo = NULL; + info->signal = true; } - info->signal = false; + /* XXX Hack for broken DRI2DrawableGone, may falsely + * conflict with GrabServer, Record, Sleep and Sync. + */ + if (info->signal) { + assert(info->client); + if (info->client->ignoreCount) + AttendClient(info->client); + info->signal = false; + } info->draw = NULL; info->keepalive = 1; assert(!info->signal); -- 2.7.0