Bug 1464610 - Don't use EGL_KHR_surfaceless_context on Mali devices r=jgilbert
authorJames Willcox <snorp@snorp.net>
Thu, 28 Jun 2018 16:01:03 -0500
changeset 424751 7058dd58e731bc4b9e0842744d0a73cf7097b1aa
parent 424750 825f93a8250fed4bd8e773d1fc9208dc7c9b00e3
child 424752 22a25d0179206ea7912bc641bd4cf585b74ec431
push id34223
push useraiakab@mozilla.com
push dateTue, 03 Jul 2018 08:56:10 +0000
treeherdermozilla-central@a0e47ebc4c06 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjgilbert
bugs1464610
milestone63.0a1
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
Bug 1464610 - Don't use EGL_KHR_surfaceless_context on Mali devices r=jgilbert 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