glx: add a workaround to glXDestroyWindow for Viewperf2020/Sw
This fixes: X Error of failed request: GLXBadWindow Major opcode of failed request: 152 (GLX) Minor opcode of failed request: 32 (X_GLXDestroyWindow) Serial number of failed request: 9667 Current serial number in output stream: 9674 Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13611>
This commit is contained in:
parent
0388783a03
commit
83278b5661
|
@ -46,6 +46,7 @@ DRI_CONF_SECTION_DEBUG
|
|||
DRI_CONF_DISABLE_PROTECTED_CONTENT_CHECK(false)
|
||||
DRI_CONF_IGNORE_MAP_UNSYNCHRONIZED(false)
|
||||
DRI_CONF_FORCE_DIRECT_GLX_CONTEXT(false)
|
||||
DRI_CONF_ALLOW_INVALID_GLX_DESTROY_WINDOW(false)
|
||||
DRI_CONF_SECTION_END
|
||||
|
||||
DRI_CONF_SECTION_MISCELLANEOUS
|
||||
|
|
|
@ -1286,6 +1286,13 @@ dri2CreateScreen(int screen, struct glx_display * priv)
|
|||
&force) == 0) {
|
||||
psc->base.force_direct_context = force;
|
||||
}
|
||||
|
||||
uint8_t invalid_glx_destroy_window = false;
|
||||
if (psc->config->configQueryb(psc->driScreen,
|
||||
"allow_invalid_glx_destroy_window",
|
||||
&invalid_glx_destroy_window) == 0) {
|
||||
psc->base.allow_invalid_glx_destroy_window = invalid_glx_destroy_window;
|
||||
}
|
||||
}
|
||||
|
||||
/* DRI2 supports SubBuffer through DRI2CopyRegion, so it's always
|
||||
|
|
|
@ -1020,6 +1020,13 @@ dri3_create_screen(int screen, struct glx_display * priv)
|
|||
&force) == 0) {
|
||||
psc->base.force_direct_context = force;
|
||||
}
|
||||
|
||||
uint8_t invalid_glx_destroy_window = false;
|
||||
if (psc->config->configQueryb(psc->driScreen,
|
||||
"allow_invalid_glx_destroy_window",
|
||||
&invalid_glx_destroy_window) == 0) {
|
||||
psc->base.allow_invalid_glx_destroy_window = invalid_glx_destroy_window;
|
||||
}
|
||||
}
|
||||
|
||||
free(driverName);
|
||||
|
|
|
@ -394,6 +394,12 @@ __glXGetDrawableAttribute(Display * dpy, GLXDrawable drawable,
|
|||
return found;
|
||||
}
|
||||
|
||||
static int dummyErrorHandler(Display *display, xError *err, XExtCodes *codes,
|
||||
int *ret_code)
|
||||
{
|
||||
return 1; /* do nothing */
|
||||
}
|
||||
|
||||
static void
|
||||
protocolDestroyDrawable(Display *dpy, GLXDrawable drawable, CARD32 glxCode)
|
||||
{
|
||||
|
@ -413,6 +419,19 @@ protocolDestroyDrawable(Display *dpy, GLXDrawable drawable, CARD32 glxCode)
|
|||
|
||||
UnlockDisplay(dpy);
|
||||
SyncHandle();
|
||||
|
||||
/* Viewperf2020/Sw calls XDestroyWindow(win) and then glXDestroyWindow(win),
|
||||
* causing an X error and abort. This is the workaround.
|
||||
*/
|
||||
struct glx_display *priv = __glXInitialize(dpy);
|
||||
|
||||
if (priv->screens[0] &&
|
||||
priv->screens[0]->allow_invalid_glx_destroy_window) {
|
||||
void *old = XESetError(priv->dpy, priv->codes.extension,
|
||||
dummyErrorHandler);
|
||||
XSync(dpy, false);
|
||||
XESetError(priv->dpy, priv->codes.extension, old);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -522,6 +522,7 @@ struct glx_screen
|
|||
Display *dpy;
|
||||
int scr;
|
||||
bool force_direct_context;
|
||||
bool allow_invalid_glx_destroy_window;
|
||||
|
||||
#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
|
||||
/**
|
||||
|
|
|
@ -35,6 +35,7 @@ public:
|
|||
this->visuals = 0;
|
||||
this->configs = 0;
|
||||
this->force_direct_context = false;
|
||||
this->allow_invalid_glx_destroy_window = false;
|
||||
|
||||
this->display = glx_dpy;
|
||||
this->dpy = (glx_dpy != NULL) ? glx_dpy->dpy : NULL;
|
||||
|
|
|
@ -313,6 +313,7 @@ TODO: document the other workarounds.
|
|||
<option name="mesa_no_error" value="true" />
|
||||
<!-- Creating 10-bit pbuffers fails in the X server and returns BadAlloc. -->
|
||||
<option name="allow_rgb10_configs" value="false" />
|
||||
<option name="allow_invalid_glx_destroy_window" value="true" />
|
||||
</application>
|
||||
|
||||
<!-- Workaround for unsynchronized VBO updates on Dead Cells android
|
||||
|
|
|
@ -238,6 +238,10 @@
|
|||
DRI_CONF_OPT_B(force_direct_glx_context, def, \
|
||||
"Force direct GLX context (even if indirect is requested)")
|
||||
|
||||
#define DRI_CONF_ALLOW_INVALID_GLX_DESTROY_WINDOW(def) \
|
||||
DRI_CONF_OPT_B(allow_invalid_glx_destroy_window, def, \
|
||||
"Allow passing an invalid window into glXDestroyWindow")
|
||||
|
||||
#define DRI_CONF_OVERRIDE_VRAM_SIZE() \
|
||||
DRI_CONF_OPT_I(override_vram_size, -1, -1, 2147483647, \
|
||||
"Override the VRAM size advertised to the application in MiB (-1 = default)")
|
||||
|
|
Loading…
Reference in New Issue