diff options
author | Gwenole Beauchesne <gwenole.beauchesne@intel.com> | 2011-07-20 17:44:29 +0200 |
---|---|---|
committer | Austin Yuan <shengquan.yuan@gmail.com> | 2011-07-26 14:07:43 +0800 |
commit | c3e7bd874243e45e788f32bbf5d2c0edefb4464c (patch) | |
tree | e4f7ddf46665809505970e1b8f8e7ce77b3f9fe4 | |
parent | 0d25dbe4a30be512e9ca665b07fe5c7ce71f4127 (diff) | |
download | libva-c3e7bd874243e45e788f32bbf5d2c0edefb4464c.tar.gz |
dri2: ignore BadDrawable errors.
Hi,
This patch fixes the following error.
X Error of failed request: BadDrawable (invalid Pixmap or Window parameter)
Major opcode of failed request: 137 (DRI2)
Minor opcode of failed request: 4 (DRI2DestroyDrawable)
Resource id in failed request: 0x4800001
Serial number of failed request: 30
Current serial number in output stream: 32
The X drawable can die before we notice it in free_drawable_hashtable(),
called through vaTerminate(). This patch is ported from Mesa (GLX/DRI2).
Regards,
Gwenole.
-rw-r--r-- | va/x11/va_dri2.c | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/va/x11/va_dri2.c b/va/x11/va_dri2.c index 4915651..1c91bca 100644 --- a/va/x11/va_dri2.c +++ b/va/x11/va_dri2.c @@ -44,6 +44,9 @@ #define DRI2DriverDRI 0 #endif +static int +VA_DRI2Error(Display *dpy, xError *err, XExtCodes *codes, int *ret_code); + static char va_dri2ExtensionName[] = DRI2_NAME; static XExtensionInfo _va_dri2_info_data; static XExtensionInfo *va_dri2Info = &_va_dri2_info_data; @@ -58,7 +61,7 @@ static /* const */ XExtensionHooks va_dri2ExtensionHooks = { VA_DRI2CloseDisplay, /* close_display */ NULL, /* wire_to_event */ NULL, /* event_to_wire */ - NULL, /* error */ + VA_DRI2Error, /* error */ NULL, /* error_string */ }; @@ -67,6 +70,22 @@ static XEXT_GENERATE_FIND_DISPLAY (DRI2FindDisplay, va_dri2Info, &va_dri2ExtensionHooks, 0, NULL) +static int +VA_DRI2Error(Display *dpy, xError *err, XExtCodes *codes, int *ret_code) +{ + /* + * If the X drawable was destroyed before the VA drawable, the DRI2 drawable + * will be gone by the time we call VA_DRI2DestroyDrawable(). So, simply + * ignore BadDrawable errors in that case. + */ + if (err->majorCode == codes->major_opcode && + err->errorCode == BadDrawable && + err->minorCode == X_DRI2DestroyDrawable) + return True; + + return False; +} + Bool VA_DRI2QueryExtension(Display *dpy, int *eventBase, int *errorBase) { XExtDisplayInfo *info = DRI2FindDisplay(dpy); |