Bug 1288746 - Handle missing EGL failure IDs. r=jmuizel
authorBenoit Girard <b56girard@gmail.com>
Tue, 13 Sep 2016 14:17:29 -0400
changeset 313784 484087507430a3008fdc0d54685e3c3d4b82f948
parent 313783 908976ec552609d50bf14f5cace757808a51864f
child 313785 de96dcebba86cf25c6184fc6a0815a225ae737e9
child 313879 aa3b9f12a72103ee659bb5ef16cf93245a0eb0e1
push id30697
push usercbook@mozilla.com
push dateWed, 14 Sep 2016 10:04:12 +0000
treeherdermozilla-central@de96dcebba86 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjmuizel
bugs1288746
milestone51.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 1288746 - Handle missing EGL failure IDs. r=jmuizel MozReview-Commit-ID: Kk5vFNMdhjV
dom/canvas/WebGLContext.cpp
gfx/gl/GLLibraryEGL.cpp
--- a/dom/canvas/WebGLContext.cpp
+++ b/dom/canvas/WebGLContext.cpp
@@ -681,18 +681,21 @@ WebGLContext::CreateAndInitGLWith(FnCrea
     while (!fallbackCaps.empty()) {
         const gl::SurfaceCaps& caps = fallbackCaps.front();
         potentialGL = fnCreateGL(caps, flags, this, out_failReasons);
         if (potentialGL)
             break;
 
         fallbackCaps.pop();
     }
-    if (!potentialGL)
+    if (!potentialGL) {
+        out_failReasons->push_back(FailureReason("FEATURE_FAILURE_WEBGL_EXHAUSTED_CAPS",
+                                                 "Exhausted GL driver caps."));
         return false;
+    }
 
     FailureReason reason;
 
     mGL_OnlyClearInDestroyResourcesAndContext = potentialGL;
     MOZ_RELEASE_ASSERT(gl);
     if (!InitAndValidateGL(&reason)) {
         DestroyResourcesAndContext();
         MOZ_RELEASE_ASSERT(!gl);
--- a/gfx/gl/GLLibraryEGL.cpp
+++ b/gfx/gl/GLLibraryEGL.cpp
@@ -341,18 +341,20 @@ GLLibraryEGL::EnsureInitialized(bool for
 
             MOZ_ASSERT(false, "d3dcompiler DLL loading failed.");
         } while (false);
 
         LoadLibraryForEGLOnWindows(NS_LITERAL_STRING("libGLESv2.dll"));
 
         mEGLLibrary = LoadLibraryForEGLOnWindows(NS_LITERAL_STRING("libEGL.dll"));
 
-        if (!mEGLLibrary)
+        if (!mEGLLibrary) {
+            *out_failureId = NS_LITERAL_CSTRING("FEATURE_FAILURE_EGL_LOAD");
             return false;
+        }
     }
 
 #else // !Windows
 
     // On non-Windows (Android) we use system copies of libEGL. We look for
     // the APITrace lib, libEGL.so, and libEGL.so.1 in that order.
 
 #if defined(ANDROID)
@@ -367,16 +369,17 @@ GLLibraryEGL::EnsureInitialized(bool for
 #if defined(XP_UNIX)
     if (!mEGLLibrary) {
         mEGLLibrary = PR_LoadLibrary("libEGL.so.1");
     }
 #endif
 
     if (!mEGLLibrary) {
         NS_WARNING("Couldn't load EGL LIB.");
+        *out_failureId = NS_LITERAL_CSTRING("FEATURE_FAILURE_EGL_LOAD_2");
         return false;
     }
 
 #endif // !Windows
 
 #define SYMBOL(name) \
 { (PRFuncPtr*) &mSymbols.f##name, { "egl" #name, nullptr } }
 
@@ -407,16 +410,17 @@ GLLibraryEGL::EnsureInitialized(bool for
         SYMBOL(BindTexImage),
         SYMBOL(ReleaseTexImage),
         SYMBOL(QuerySurface),
         { nullptr, { nullptr } }
     };
 
     if (!GLLibraryLoader::LoadSymbols(mEGLLibrary, &earlySymbols[0])) {
         NS_WARNING("Couldn't find required entry points in EGL library (early init)");
+        *out_failureId = NS_LITERAL_CSTRING("FEATURE_FAILURE_EGL_SYM");
         return false;
     }
 
     GLLibraryLoader::SymLoadStruct optionalSymbols[] = {
         // On Android 4.3 and up, certain features like ANDROID_native_fence_sync
         // can only be queried by using a special eglQueryString.
         { (PRFuncPtr*) &mSymbols.fQueryStringImplementationANDROID,
           { "_Z35eglQueryStringImplementationANDROIDPvi", nullptr } },