Bug 632867 - Mesa versions up to 7.10 cause a BadLength error during the first GLX call when the server GLX version < 1.3. - r=karlt, a=hardblocker

This commit is contained in:
Benoit Jacob 2011-02-11 18:11:30 -05:00
parent bef311f4d5
commit af3ae9119a
3 changed files with 48 additions and 24 deletions

View File

@ -72,6 +72,12 @@ bool
ScopedXErrorHandler::SyncAndGetError(Display *dpy, XErrorEvent *ev)
{
XSync(dpy, False);
return GetError(ev);
}
bool
ScopedXErrorHandler::GetError(XErrorEvent *ev)
{
bool retval = mXError.mError.error_code != 0;
if (ev)
*ev = mXError.mError;
@ -79,5 +85,4 @@ ScopedXErrorHandler::SyncAndGetError(Display *dpy, XErrorEvent *ev)
return retval;
}
} // namespace mozilla

View File

@ -165,8 +165,14 @@ public:
* the first one will be returned.
*/
bool SyncAndGetError(Display *dpy, XErrorEvent *ev = nsnull);
};
/** Like SyncAndGetError, but does not sync. Faster, but only reliably catches errors in synchronous calls.
*
* \param ev this optional parameter, if set, will be filled with the XErrorEvent object. If multiple errors occurred,
* the first one will be returned.
*/
bool GetError(XErrorEvent *ev = nsnull);
};
} // namespace mozilla

View File

@ -164,20 +164,42 @@ GLXLibrary::EnsureInitialized()
Display *display = DefaultXDisplay();
int screen = DefaultScreen(display);
const char *vendor;
const char *serverVersionStr;
const char *extensionsStr;
// this scope is covered by a ScopedXErrorHandler to catch X errors in GLX calls,
// see bug 632867 comment 3: Mesa versions up to 7.10 cause a BadLength error during the first GLX call
// when the server GLX version < 1.3.
{
ScopedXErrorHandler xErrorHandler;
if (!xQueryVersion(display, &gGLXMajorVersion, &gGLXMinorVersion)) {
gGLXMajorVersion = 0;
gGLXMinorVersion = 0;
return PR_FALSE;
}
const char *vendor = xQueryServerString(display, screen, GLX_VENDOR);
const char *serverVersionStr = xQueryServerString(display, screen, GLX_VERSION);
vendor = xQueryServerString(display, screen, GLX_VENDOR);
serverVersionStr = xQueryServerString(display, screen, GLX_VERSION);
if (strcmp(vendor, "NVIDIA Corporation") &&
!PR_GetEnv("MOZ_GLX_IGNORE_BLACKLIST"))
{
printf("[GLX] your GL driver is currently blocked. If you would like to bypass this, "
"define the MOZ_GLX_IGNORE_BLACKLIST environment variable.\n");
return nsnull;
}
if (!GLXVersionCheck(1, 1))
// Not possible to query for extensions.
return PR_FALSE;
const char *extensionsStr = xQueryExtensionsString(display, screen);
extensionsStr = xQueryExtensionsString(display, screen);
if (xErrorHandler.GetError())
return PR_FALSE;
}
LibrarySymbolLoader::SymLoadStruct *sym13;
if (!GLXVersionCheck(1, 3)) {
@ -234,15 +256,6 @@ public:
PRBool deleteDrawable,
gfxXlibSurface *pixmap = nsnull)
{
const char *glxVendorString = sGLXLibrary.xQueryServerString(display, DefaultScreen(display), GLX_VENDOR);
if (strcmp(glxVendorString, "NVIDIA Corporation") &&
!PR_GetEnv("MOZ_GLX_IGNORE_BLACKLIST"))
{
printf("[GLX] your GL driver is currently blocked. If you would like to bypass this, "
"define the MOZ_GLX_IGNORE_BLACKLIST environment variable.\n");
return nsnull;
}
int db = 0, err;
err = sGLXLibrary.xGetFBConfigAttrib(display, cfg,
GLX_DOUBLEBUFFER, &db);