From 25d26875bc9bd6fd23ae1b5280f015abf1b033b7 Mon Sep 17 00:00:00 2001 From: Jeremy Huddleston Sequoia Date: Thu, 20 Sep 2012 21:49:40 -0700 Subject: [PATCH 1/2] XQuartz: Avoid a possible deadlock with DRI on OS X 10.7.5 and OS X 10.8.2 http://bugs.winehq.org/show_bug.cgi?id=31751 Signed-off-by: Jeremy Huddleston Sequoia --- hw/xquartz/xpr/dri.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/hw/xquartz/xpr/dri.c b/hw/xquartz/xpr/dri.c index 03af163f7..adba69cca 100644 --- a/hw/xquartz/xpr/dri.c +++ b/hw/xquartz/xpr/dri.c @@ -64,6 +64,7 @@ #include "mi.h" #include "mipointer.h" #include "rootless.h" +#include "rootlessCommon.h" #include "x-hash.h" #include "x-hook.h" #include "driWrap.h" @@ -380,6 +381,11 @@ DRICreateSurface(ScreenPtr pScreen, Drawable id, DRIDrawablePrivPtr pDRIDrawablePriv; if (pDrawable->type == DRAWABLE_WINDOW) { + /* + * http://bugs.winehq.org/show_bug.cgi?id=31751 + */ + RootlessStopDrawing((WindowPtr)pDrawable, FALSE); + pDRIDrawablePriv = CreateSurfaceForWindow(pScreen, (WindowPtr)pDrawable, &wid); From f54987de97720200ee94eba1c7a737d4ad8c55c8 Mon Sep 17 00:00:00 2001 From: Jeremy Huddleston Sequoia Date: Thu, 20 Sep 2012 21:11:21 -0700 Subject: [PATCH 2/2] XQuartz: Add some verbose logging to debug xp_lock_window being unbalanced Signed-off-by: Jeremy Huddleston Sequoia --- hw/xquartz/xpr/xprFrame.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/hw/xquartz/xpr/xprFrame.c b/hw/xquartz/xpr/xprFrame.c index 01f1def20..aad375b52 100644 --- a/hw/xquartz/xpr/xprFrame.c +++ b/hw/xquartz/xpr/xprFrame.c @@ -49,6 +49,10 @@ #include #endif +#ifdef DEBUG_XP_LOCK_WINDOW +#include +#endif + #define DEFINE_ATOM_HELPER(func, atom_name) \ static Atom func(void) { \ static int generation; \ @@ -376,6 +380,18 @@ xprStartDrawing(RootlessFrameID wid, char **pixelData, int *bytesPerRow) unsigned int rowbytes[2]; xp_error err; +#ifdef DEBUG_XP_LOCK_WINDOW + void* callstack[128]; + int i, frames = backtrace(callstack, 128); + char** strs = backtrace_symbols(callstack, frames); + + ErrorF("=== LOCK %d ===\n", (int)x_cvt_vptr_to_uint(wid)); + for (i = 0; i < frames; ++i) { + ErrorF(" %s\n", strs[i]); + } + free(strs); +#endif + err = xp_lock_window(x_cvt_vptr_to_uint( wid), NULL, NULL, data, rowbytes, NULL); if (err != Success) @@ -395,6 +411,18 @@ xprStopDrawing(RootlessFrameID wid, Bool flush) { xp_error err; +#ifdef DEBUG_XP_LOCK_WINDOW + void* callstack[128]; + int i, frames = backtrace(callstack, 128); + char** strs = backtrace_symbols(callstack, frames); + + ErrorF("=== UNLOCK %d ===\n", (int)x_cvt_vptr_to_uint(wid)); + for (i = 0; i < frames; ++i) { + ErrorF(" %s\n", strs[i]); + } + free(strs); +#endif + err = xp_unlock_window(x_cvt_vptr_to_uint(wid), flush); /* This should be a FatalError, but we started tripping over it. Make it a * FatalError after http://xquartz.macosforge.org/trac/ticket/482 is fixed.