b=626192 blacklist ATI libGL due to seg faults on querying server info r=bjacob
authorKarl Tomlinson <karlt+@karlt.net>
Fri, 25 Mar 2011 16:38:59 +1300
changeset 63995 fa658a942728fdc1c0e104c578d6912bdadc8f4e
parent 63994 286410eeba47b4b9a8ec8e18779ee10a7b312f1e
child 63996 014fb62e09058d891a6caff670fc2f2a55481ff7
push id19298
push userktomlinson@mozilla.com
push dateMon, 28 Mar 2011 01:54:05 +0000
treeherdermozilla-central@dacd66ab4dc4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbjacob
bugs626192
milestone2.2a1pre
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
b=626192 blacklist ATI libGL due to seg faults on querying server info r=bjacob
gfx/thebes/GLContextProviderGLX.cpp
gfx/thebes/GLXLibrary.h
--- a/gfx/thebes/GLContextProviderGLX.cpp
+++ b/gfx/thebes/GLContextProviderGLX.cpp
@@ -115,16 +115,17 @@ GLXLibrary::EnsureInitialized()
         /* functions that were in GLX 1.0 */
         { (PRFuncPtr*) &xDestroyContext, { "glXDestroyContext", NULL } },
         { (PRFuncPtr*) &xMakeCurrent, { "glXMakeCurrent", NULL } },
         { (PRFuncPtr*) &xSwapBuffers, { "glXSwapBuffers", NULL } },
         { (PRFuncPtr*) &xQueryVersion, { "glXQueryVersion", NULL } },
         { (PRFuncPtr*) &xGetCurrentContext, { "glXGetCurrentContext", NULL } },
         /* functions introduced in GLX 1.1 */
         { (PRFuncPtr*) &xQueryExtensionsString, { "glXQueryExtensionsString", NULL } },
+        { (PRFuncPtr*) &xGetClientString, { "glXGetClientString", NULL } },
         { (PRFuncPtr*) &xQueryServerString, { "glXQueryServerString", NULL } },
         { NULL, { NULL } }
     };
 
     LibrarySymbolLoader::SymLoadStruct symbols13[] = {
         /* functions introduced in GLX 1.3 */
         { (PRFuncPtr*) &xChooseFBConfig, { "glXChooseFBConfig", NULL } },
         { (PRFuncPtr*) &xGetFBConfigAttrib, { "glXGetFBConfigAttrib", NULL } },
@@ -166,42 +167,57 @@ GLXLibrary::EnsureInitialized()
     };
 
     if (!LibrarySymbolLoader::LoadSymbols(mOGLLibrary, &symbols[0])) {
         NS_WARNING("Couldn't find required entry point in OpenGL shared library");
         return PR_FALSE;
     }
 
     Display *display = DefaultXDisplay();
+    PRBool ignoreBlacklist = PR_GetEnv("MOZ_GLX_IGNORE_BLACKLIST") != nsnull;
+    if (!ignoreBlacklist) {
+        // ATI's libGL (at least the one provided with 11.2 drivers) segfaults
+        // when querying server info if the server does not have the
+        // ATIFGLEXTENSION extension.
+        const char *clientVendor = xGetClientString(display, GLX_VENDOR);
+        if (clientVendor && strcmp(clientVendor, "ATI") == 0) {
+            printf("[GLX] The ATI proprietary libGL.so.1 is currently "
+                   "blacklisted to avoid crashes that happen in some "
+                   "situations. If you would like to bypass this, set the "
+                   "MOZ_GLX_IGNORE_BLACKLIST environment variable.\n");
+            return PR_FALSE;
+        }
+    }
+
     int screen = DefaultScreen(display);
-    const char *vendor;
+    const char *serverVendor;
     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.
+    // 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 that communicates with the
+    // server when the server GLX version < 1.3.
     {
         ScopedXErrorHandler xErrorHandler;
 
         if (!xQueryVersion(display, &gGLXMajorVersion, &gGLXMinorVersion)) {
             gGLXMajorVersion = 0;
             gGLXMinorVersion = 0;
             return PR_FALSE;
         }
 
-        vendor = xQueryServerString(display, screen, GLX_VENDOR);
+        serverVendor = xQueryServerString(display, screen, GLX_VENDOR);
         serverVersionStr = xQueryServerString(display, screen, GLX_VERSION);
 
-        PRBool IsDriverBlacklisted = !vendor ||   // it's been reported that a VNC X server was returning vendor=null
+        PRBool IsDriverBlacklisted = !serverVendor ||   // it's been reported that a VNC X server was returning serverVendor=null
                                      !serverVersionStr ||
-                                     strcmp(vendor, "NVIDIA Corporation");
+                                     strcmp(serverVendor, "NVIDIA Corporation");
 
-        if (IsDriverBlacklisted &&
-            !PR_GetEnv("MOZ_GLX_IGNORE_BLACKLIST"))
+        if (IsDriverBlacklisted && !ignoreBlacklist)
         {
           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 PR_FALSE;
         }
 
         if (!GLXVersionCheck(1, 1))
             // Not possible to query for extensions.
@@ -240,19 +256,21 @@ GLXLibrary::EnsureInitialized()
     } else {
         sym14 = symbols14;
     }
     if (!LibrarySymbolLoader::LoadSymbols(mOGLLibrary, sym14)) {
         NS_WARNING("Couldn't find required entry point in OpenGL shared library");
         return PR_FALSE;
     }
 
-    gIsATI = vendor && DoesVendorStringMatch(vendor, "ATI");
-    gIsChromium = (vendor && DoesVendorStringMatch(vendor, "Chromium")) ||
-        (serverVersionStr && DoesVendorStringMatch(serverVersionStr, "Chromium"));
+    gIsATI = serverVendor && DoesVendorStringMatch(serverVendor, "ATI");
+    gIsChromium = (serverVendor &&
+                   DoesVendorStringMatch(serverVendor, "Chromium")) ||
+        (serverVersionStr &&
+         DoesVendorStringMatch(serverVersionStr, "Chromium"));
 
     mInitialized = PR_TRUE;
     return PR_TRUE;
 }
 
 GLXLibrary sGLXLibrary;
 
 class GLContextGLX : public GLContext
--- a/gfx/thebes/GLXLibrary.h
+++ b/gfx/thebes/GLXLibrary.h
@@ -84,16 +84,19 @@ public:
     PFNGLXGETFBCONFIGATTRIB xGetFBConfigAttrib;
 
     typedef void (GLAPIENTRY * PFNGLXSWAPBUFFERS) (Display *,
                                                    GLXDrawable);
     PFNGLXSWAPBUFFERS xSwapBuffers;
     typedef const char * (GLAPIENTRY * PFNGLXQUERYEXTENSIONSSTRING) (Display *,
                                                                      int);
     PFNGLXQUERYEXTENSIONSSTRING xQueryExtensionsString;
+    typedef const char * (GLAPIENTRY * PFNGLXGETCLIENTSTRING) (Display *,
+                                                               int);
+    PFNGLXGETCLIENTSTRING xGetClientString;
     typedef const char * (GLAPIENTRY * PFNGLXQUERYSERVERSTRING) (Display *,
                                                                  int,
                                                                  int);
     PFNGLXQUERYSERVERSTRING xQueryServerString;
 
     typedef GLXPixmap (GLAPIENTRY * PFNGLXCREATEPIXMAP) (Display *,
                                                          GLXFBConfig,
                                                          Pixmap,