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
--- 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;
}
}