Bug 1571838 - Backed out changeset 3259bd848059 (bug 1443181). r=jbonisteel, a=RyanVM
authorRyan VanderMeulen <ryanvm@gmail.com>
Thu, 22 Aug 2019 11:21:39 -0400
changeset 542051 f804b4a4668ffc3ddea9a46bb481ea6f7a029107
parent 542050 abdcc86f4fddc02117e644c91974bd5767beb97a
child 542052 db9bda005eff3dcb428ffa7e44a1956490784c19
push id11832
push userryanvm@gmail.com
push dateThu, 22 Aug 2019 15:23:47 +0000
treeherdermozilla-beta@f804b4a4668f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjbonisteel, RyanVM
bugs1571838, 1443181
milestone69.0
Bug 1571838 - Backed out changeset 3259bd848059 (bug 1443181). r=jbonisteel, a=RyanVM
gfx/gl/GLLibraryEGL.cpp
--- a/gfx/gl/GLLibraryEGL.cpp
+++ b/gfx/gl/GLLibraryEGL.cpp
@@ -274,16 +274,18 @@ class AngleErrorReporting {
  private:
   nsACString* mFailureId;
 };
 
 AngleErrorReporting gAngleErrorReporter;
 
 static EGLDisplay GetAndInitDisplayForAccelANGLE(
     GLLibraryEGL& egl, nsACString* const out_failureId) {
+  EGLDisplay ret = 0;
+
   if (wr::RenderThread::IsInRenderThread()) {
     return GetAndInitDisplayForWebRender(egl, EGL_DEFAULT_DISPLAY);
   }
 
   FeatureState& d3d11ANGLE = gfxConfig::GetFeature(Feature::D3D11_HW_ANGLE);
 
   if (!StaticPrefs::webgl_angle_try_d3d11()) {
     d3d11ANGLE.UserDisable("User disabled D3D11 ANGLE by pref",
@@ -297,31 +299,26 @@ static EGLDisplay GetAndInitDisplayForAc
 
   auto guardShutdown = mozilla::MakeScopeExit([&] {
     gAngleErrorReporter.SetFailureId(nullptr);
     // NOTE: Ideally we should be calling ANGLEPlatformShutdown after the
     //       ANGLE display is destroyed. However gAngleErrorReporter
     //       will live longer than the ANGLE display so we're fine.
   });
 
-  EGLDisplay ret = nullptr;
-  if (d3d11ANGLE.IsEnabled()) {
-    ret = egl.fGetDisplay(
-        EGL_DEFAULT_DISPLAY);  // This will try d3d11, then d3d9.
-  } else {
-    // D3D9-only.
-    const EGLint attribs[] = {LOCAL_EGL_PLATFORM_ANGLE_TYPE_ANGLE,
-                              LOCAL_EGL_PLATFORM_ANGLE_TYPE_D3D9_ANGLE,
-                              LOCAL_EGL_NONE};
-    ret = egl.fGetPlatformDisplayEXT(LOCAL_EGL_PLATFORM_ANGLE_ANGLE,
-                                     EGL_DEFAULT_DISPLAY, attribs);
+  if (gfxConfig::IsForcedOnByUser(Feature::D3D11_HW_ANGLE)) {
+    return GetAndInitDisplay(egl, LOCAL_EGL_D3D11_ONLY_DISPLAY_ANGLE);
   }
 
-  if (ret && !egl.fInitialize(ret, nullptr, nullptr)) {
-    ret = nullptr;
+  if (d3d11ANGLE.IsEnabled()) {
+    ret = GetAndInitDisplay(egl, LOCAL_EGL_D3D11_ELSE_D3D9_DISPLAY_ANGLE);
+  }
+
+  if (!ret) {
+    ret = GetAndInitDisplay(egl, EGL_DEFAULT_DISPLAY);
   }
 
   if (!ret && out_failureId->IsEmpty()) {
     *out_failureId = NS_LITERAL_CSTRING("FEATURE_FAILURE_ACCL_ANGLE_NO_DISP");
   }
 
   return ret;
 }