Bug 1464610 - Don't use EGL_KHR_surfaceless_context on Mali devices r=jgilbert a=lizzard
authorJames Willcox <snorp@snorp.net>
Thu, 28 Jun 2018 16:01:03 -0500
changeset 477830 3a7a791ef4ff5f7c04c7eb2713e4a9104810e8d0
parent 477829 0915e733540199880a1529f7c0cb0b9a4fef09ae
child 477831 f76813bfbe458280c6aceb10dd126f8ea0c8c314
push id9441
push userarchaeopteryx@coole-files.de
push dateFri, 06 Jul 2018 15:09:28 +0000
treeherdermozilla-beta@3a7a791ef4ff [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjgilbert, lizzard
bugs1464610
milestone62.0
Bug 1464610 - Don't use EGL_KHR_surfaceless_context on Mali devices r=jgilbert a=lizzard MozReview-Commit-ID: 2YlTVo86u0c
gfx/gl/GLContextProviderEGL.cpp
gfx/gl/GLLibraryEGL.cpp
--- a/gfx/gl/GLContextProviderEGL.cpp
+++ b/gfx/gl/GLContextProviderEGL.cpp
@@ -171,16 +171,22 @@ DestroySurface(EGLSurface oldSurface) {
         DeleteWaylandGLSurface(oldSurface);
 #endif
     }
 }
 
 static EGLSurface
 CreateFallbackSurface(const EGLConfig& config)
 {
+    nsCString discardFailureId;
+    if (!GLLibraryEGL::EnsureInitialized(false, &discardFailureId)) {
+        gfxCriticalNote << "Failed to load EGL library 3!";
+        return EGL_NO_SURFACE;
+    }
+
     auto* egl = gl::GLLibraryEGL::Get();
 
     if (egl->IsExtensionSupported(GLLibraryEGL::KHR_surfaceless_context)) {
         // We don't need a PBuffer surface in this case
         return EGL_NO_SURFACE;
     }
 
     std::vector<EGLint> pbattrs;
--- a/gfx/gl/GLLibraryEGL.cpp
+++ b/gfx/gl/GLLibraryEGL.cpp
@@ -673,16 +673,29 @@ GLLibraryEGL::DoEnsureInitialized(bool f
             END_OF_SYMBOLS
         };
         if (!fnLoadSymbols(nvStreamSymbols)) {
             NS_ERROR("EGL supports ANGLE_stream_producer_d3d_texture without exposing its functions!");
             MarkExtensionUnsupported(ANGLE_stream_producer_d3d_texture);
         }
     }
 
+    if (IsExtensionSupported(KHR_surfaceless_context)) {
+        const auto vendor = fQueryString(mEGLDisplay, LOCAL_EGL_VENDOR);
+
+        // Bug 1464610: Mali T720 (Amazon Fire 8 HD) claims to support this extension,
+        // but if you actually eglMakeCurrent() with EGL_NO_SURFACE, it fails to
+        // render anything when a real surface is provided later on. We only have the
+        // EGL vendor available here, so just avoid using this extension on all
+        // Mali devices.
+        if (strcmp((const char*)vendor, "ARM") == 0) {
+            MarkExtensionUnsupported(KHR_surfaceless_context);
+        }
+    }
+
     mInitialized = true;
     reporter.SetSuccessful();
     return true;
 }
 
 #undef SYMBOL
 #undef END_OF_SYMBOLS