summaryrefslogtreecommitdiffstats
path: root/src/glx/dri2.c
diff options
context:
space:
mode:
authorKristian Høgsberg <krh@bitplanet.net>2010-03-22 21:57:26 -0400
committerKristian Høgsberg <krh@bitplanet.net>2010-03-22 22:04:23 -0400
commit094c6fbc45cee1b53d9f1d7d4123d6da6a8958a3 (patch)
treef1b9a7a2cb0701a6a89606aed51877c448606738 /src/glx/dri2.c
parent4eead425504057e0862bc214bceaa512775973f1 (diff)
downloadexternal_mesa3d-094c6fbc45cee1b53d9f1d7d4123d6da6a8958a3.zip
external_mesa3d-094c6fbc45cee1b53d9f1d7d4123d6da6a8958a3.tar.gz
external_mesa3d-094c6fbc45cee1b53d9f1d7d4123d6da6a8958a3.tar.bz2
glx: Suppress BadDrawable from DRI2CopyRegion
This can happen when an X window is destroyed behind our back. We use DRI2CopyRegion behind the scenes in many places (like flushing the fake front to the real front) so we have to ignore X errors triggered in that case. The glean test cases trigger this consistently as they don't destroy the GLX drawable nicely, they just destroy the X window.
Diffstat (limited to 'src/glx/dri2.c')
-rw-r--r--src/glx/dri2.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/glx/dri2.c b/src/glx/dri2.c
index 5de55cd..9ca9b3e 100644
--- a/src/glx/dri2.c
+++ b/src/glx/dri2.c
@@ -62,6 +62,8 @@ static Bool
DRI2WireToEvent(Display *dpy, XEvent *event, xEvent *wire);
static Status
DRI2EventToWire(Display *dpy, XEvent *event, xEvent *wire);
+static int
+DRI2Error(Display *display, xError *err, XExtCodes *codes, int *ret_code);
static /* const */ XExtensionHooks dri2ExtensionHooks = {
NULL, /* create_gc */
@@ -73,7 +75,7 @@ static /* const */ XExtensionHooks dri2ExtensionHooks = {
DRI2CloseDisplay, /* close_display */
DRI2WireToEvent, /* wire_to_event */
DRI2EventToWire, /* event_to_wire */
- NULL, /* error */
+ DRI2Error, /* error */
NULL, /* error_string */
};
@@ -160,6 +162,17 @@ DRI2EventToWire(Display *dpy, XEvent *event, xEvent *wire)
return Success;
}
+static int
+DRI2Error(Display *display, xError *err, XExtCodes *codes, int *ret_code)
+{
+ if (err->majorCode == codes->major_opcode &&
+ err->errorCode == BadDrawable &&
+ err->minorCode == X_DRI2CopyRegion)
+ return True;
+
+ return False;
+}
+
Bool
DRI2QueryExtension(Display * dpy, int *eventBase, int *errorBase)
{