Bug 1262427. Don't try D3D11 harder. r=dvander,a=rkothari
authorJeff Muizelaar <jmuizelaar@mozilla.com>
Mon, 25 Apr 2016 17:34:22 -0400
changeset 324436 f9c0368a28b1
parent 324435 06956bd9eb0a
child 324437 566fc1b61ead
push id6011
push userjmuizelaar@mozilla.com
push dateThu, 19 May 2016 16:38:47 +0000
treeherdermozilla-beta@f9c0368a28b1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdvander, rkothari
bugs1262427
milestone47.0
Bug 1262427. Don't try D3D11 harder. r=dvander,a=rkothari
gfx/gl/GLLibraryEGL.cpp
gfx/thebes/gfxPlatform.cpp
gfx/thebes/gfxPlatform.h
gfx/thebes/gfxWindowsPlatform.h
--- a/gfx/gl/GLLibraryEGL.cpp
+++ b/gfx/gl/GLLibraryEGL.cpp
@@ -172,17 +172,17 @@ GetAndInitDisplayForAccelANGLE(GLLibrary
     // D3D11 ANGLE if the layer manager is prefering D3D9 (hrm, do we care?)
     if (gfxPrefs::LayersOffMainThreadCompositionEnabled() &&
         !gfxPrefs::LayersPreferD3D9())
     {
         if (gfxPrefs::WebGLANGLEForceD3D11())
             return GetAndInitDisplay(egl, LOCAL_EGL_D3D11_ONLY_DISPLAY_ANGLE);
 
         if (gfxPrefs::WebGLANGLETryD3D11() &&
-            gfxPlatform::CanUseDirect3D11ANGLE())
+            gfxPlatform::GetPlatform()->CanUseDirect3D11ANGLE())
         {
             ret = GetAndInitDisplay(egl, LOCAL_EGL_D3D11_ELSE_D3D9_DISPLAY_ANGLE);
         }
     }
 
     if (!ret) {
         ret = GetAndInitDisplay(egl, EGL_DEFAULT_DISPLAY);
     }
--- a/gfx/thebes/gfxPlatform.cpp
+++ b/gfx/thebes/gfxPlatform.cpp
@@ -2072,23 +2072,16 @@ gfxPlatform::CanUseHardwareVideoDecoding
 {
   // this function is called from the compositor thread, so it is not
   // safe to init the prefs etc. from here.
   MOZ_ASSERT(sLayersAccelerationPrefsInitialized);
   return sLayersSupportsHardwareVideoDecoding && !sLayersHardwareVideoDecodingFailed;
 }
 
 bool
-gfxPlatform::CanUseDirect3D11ANGLE()
-{
-  MOZ_ASSERT(sLayersAccelerationPrefsInitialized);
-  return gANGLESupportsD3D11;
-}
-
-bool
 gfxPlatform::ShouldUseLayersAcceleration()
 {
   const char *acceleratedEnv = PR_GetEnv("MOZ_ACCELERATED");
   if (gfxPrefs::LayersAccelerationDisabled() ||
       InSafeMode() ||
       (acceleratedEnv && *acceleratedEnv == '0'))
   {
     return false;
--- a/gfx/thebes/gfxPlatform.h
+++ b/gfx/thebes/gfxPlatform.h
@@ -441,17 +441,17 @@ public:
     // Are we in safe mode?
     static bool InSafeMode();
 
     static bool OffMainThreadCompositingEnabled();
 
     static bool CanUseDirect3D9();
     static bool CanUseDirect3D11();
     virtual bool CanUseHardwareVideoDecoding();
-    static bool CanUseDirect3D11ANGLE();
+    virtual bool CanUseDirect3D11ANGLE() { return false; }
 
     // Returns whether or not layers acceleration should be used. This should
     // only be called on the parent process.
     bool ShouldUseLayersAcceleration();
 
     // Returns a prioritized list of all available compositor backends.
     void GetCompositorBackends(bool useAcceleration, nsTArray<mozilla::layers::LayersBackend>& aBackends);
 
--- a/gfx/thebes/gfxWindowsPlatform.h
+++ b/gfx/thebes/gfxWindowsPlatform.h
@@ -90,16 +90,18 @@ struct ClearTypeParameterInfo {
 
     nsString    displayName;  // typically just 'DISPLAY1'
     int32_t     gamma;
     int32_t     pixelStructure;
     int32_t     clearTypeLevel;
     int32_t     enhancedContrast;
 };
 
+extern bool gANGLESupportsD3D11;
+
 class gfxWindowsPlatform : public gfxPlatform {
 public:
     enum TextRenderingMode {
         TEXT_RENDERING_NO_CLEARTYPE,
         TEXT_RENDERING_NORMAL,
         TEXT_RENDERING_GDI_CLASSIC,
         TEXT_RENDERING_COUNT
     };
@@ -285,16 +287,19 @@ public:
 
     void GetDeviceInitData(mozilla::gfx::DeviceInitData* aOut) override;
 
     bool SupportsPluginDirectBitmapDrawing() override {
       return true;
     }
     bool SupportsPluginDirectDXGIDrawing();
 
+    virtual bool CanUseDirect3D11ANGLE() {
+      return gANGLESupportsD3D11 && GetD3D11Status() == mozilla::gfx::FeatureStatus::Available;
+    }
 protected:
     bool AccelerateLayersByDefault() override {
       return true;
     }
     void GetAcceleratedCompositorBackends(nsTArray<mozilla::layers::LayersBackend>& aBackends) override;
     virtual void GetPlatformCMSOutputProfile(void* &mem, size_t &size) override;
     void SetDeviceInitData(mozilla::gfx::DeviceInitData& aData) override;