Bug 1481145 - [GLX] Remove GLX visual selection hack for ATI/fglrx, r?jgilbert draft
authorMartin Stransky <stransky@redhat.com>
Mon, 06 Aug 2018 10:53:53 +0200
changeset 826909 e74aa526c4398d7f50fbaaf2912d19b08f243d5c
parent 826307 583eac50f5f3a5d76ab87f32a2231df7c63c9108
push id118405
push userstransky@redhat.com
push dateMon, 06 Aug 2018 09:02:11 +0000
reviewersjgilbert
bugs1481145, 572939
milestone63.0a1
Bug 1481145 - [GLX] Remove GLX visual selection hack for ATI/fglrx, r?jgilbert There's a hack for ATI/fglrx drivers where a newly created glxContext uses a different glx visual than the associated X drawable due to bug at ATI/fglrx (Bug 572939). This hack may cause X11 BadMatch error when we make the created glxContext current as GLX requies identical visual at X drawable and glxContext. Also ATI/fglrx isn't used by modern gfx hardware so let's remove the hack and get glxContext directly from X drawable. MozReview-Commit-ID: LnGT0GAcDK7
gfx/gl/GLContextProviderGLX.cpp
--- a/gfx/gl/GLContextProviderGLX.cpp
+++ b/gfx/gl/GLContextProviderGLX.cpp
@@ -709,36 +709,16 @@ GLContextGLX::GLContextGLX(
       mDeleteDrawable(aDeleteDrawable),
       mDoubleBuffered(aDoubleBuffered),
       mGLX(&sGLXLibrary),
       mPixmap(aPixmap),
       mOwnsContext(true)
 {
 }
 
-static bool
-AreCompatibleVisuals(Visual* one, Visual* two)
-{
-    if (one->c_class != two->c_class) {
-        return false;
-    }
-
-    if (one->red_mask != two->red_mask ||
-        one->green_mask != two->green_mask ||
-        one->blue_mask != two->blue_mask) {
-        return false;
-    }
-
-    if (one->bits_per_rgb != two->bits_per_rgb) {
-        return false;
-    }
-
-    return true;
-}
-
 already_AddRefed<GLContext>
 GLContextProviderGLX::CreateWrappingExisting(void* aContext, void* aSurface)
 {
     if (!sGLXLibrary.EnsureInitialized()) {
         return nullptr;
     }
 
     if (aContext && aSurface) {
@@ -954,32 +934,17 @@ GLContextGLX::FindFBConfigForWindow(Disp
     const VisualID windowVisualID = XVisualIDFromVisual(windowAttrs.visual);
 #ifdef DEBUG
     printf("[GLX] window %lx has VisualID 0x%lx\n", window, windowVisualID);
 #endif
 
     for (int i = 0; i < numConfigs; i++) {
         int visid = X11None;
         sGLXLibrary.fGetFBConfigAttrib(display, cfgs[i], LOCAL_GLX_VISUAL_ID, &visid);
-        if (!visid) {
-            continue;
-        }
-        if (sGLXLibrary.IsATI()) {
-            // A workaround for ATI drivers introduced at Bug 572939.
-            // Do we still need that?
-            int depth;
-            Visual* visual;
-            FindVisualAndDepth(display, visid, &visual, &depth);
-            if (depth == windowAttrs.depth &&
-                AreCompatibleVisuals(windowAttrs.visual, visual)) {
-                *out_config = cfgs[i];
-                *out_visid = visid;
-                return true;
-            }
-        } else {
+        if (visid) {
             // WebRender compatible GLX visual is configured
             // at nsWindow::Create(), just reuse it here.
             if (windowVisualID == static_cast<VisualID>(visid)) {
                 *out_config = cfgs[i];
                 *out_visid = visid;
                 return true;
             }
         }