Bug 1407748 - Force enable alpha channel to make sure ANGLE use correct framebuffer formart r=jgilbert
authorsotaro <sotaro.ikeda.g@gmail.com>
Sat, 14 Oct 2017 07:33:58 +0900
changeset 386261 5278d6756359cf47803ed3039839e98a8bed7741
parent 386260 62e4765b2d97638804ca84aa75b18e60cdb9c01b
child 386262 ec879327cd7c9ae4be6b8a1d609fa915366d740d
push id53313
push userarchaeopteryx@coole-files.de
push dateSat, 14 Oct 2017 10:39:31 +0000
treeherderautoland@169bde8f9f3c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjgilbert
bugs1407748
milestone58.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 1407748 - Force enable alpha channel to make sure ANGLE use correct framebuffer formart r=jgilbert
gfx/gl/GLContextProviderEGL.cpp
--- a/gfx/gl/GLContextProviderEGL.cpp
+++ b/gfx/gl/GLContextProviderEGL.cpp
@@ -79,16 +79,19 @@ using namespace mozilla::widget;
 
 #define ADD_ATTR_1(_array, _k) do {             \
     (_array).AppendElement(_k);                 \
 } while (0)
 
 static bool
 CreateConfig(EGLConfig* aConfig, bool aEnableDepthBuffer);
 
+static bool
+CreateConfig(EGLConfig* aConfig, int32_t depth, bool aEnableDepthBuffer);
+
 // append three zeros at the end of attribs list to work around
 // EGL implementation bugs that iterate until they find 0, instead of
 // EGL_NONE. See bug 948406.
 #define EGL_ATTRIBS_LIST_SAFE_TERMINATION_WORKING_AROUND_BUGS \
      LOCAL_EGL_NONE, 0, 0, 0
 
 static EGLint kTerminationAttribs[] = {
     EGL_ATTRIBS_LIST_SAFE_TERMINATION_WORKING_AROUND_BUGS
@@ -172,19 +175,29 @@ GLContextEGLFactory::Create(EGLNativeWin
     if (!sEGLLibrary.EnsureInitialized(false, &discardFailureId)) {
         gfxCriticalNote << "Failed to load EGL library 3!";
         return nullptr;
     }
 
     bool doubleBuffered = true;
 
     EGLConfig config;
-    if (!CreateConfig(&config, aWebRender)) {
-        gfxCriticalNote << "Failed to create EGLConfig!";
-        return nullptr;
+    if (aWebRender && sEGLLibrary.IsANGLE()) {
+        // Force enable alpha channel to make sure ANGLE use correct framebuffer formart
+        const int bpp = 32;
+        const bool withDepth = true;
+        if (!CreateConfig(&config, bpp, withDepth)) {
+            gfxCriticalNote << "Failed to create EGLConfig for WebRender ANGLE!";
+            return nullptr;
+        }
+    } else {
+        if (!CreateConfig(&config, aWebRender)) {
+            gfxCriticalNote << "Failed to create EGLConfig!";
+            return nullptr;
+        }
     }
 
     EGLSurface surface = mozilla::gl::CreateSurfaceFromNativeWindow(aWindow, config);
 
     if (!surface) {
         gfxCriticalNote << "Failed to create EGLSurface!";
         return nullptr;
     }