Bug 1262427. Don't try D3D11 harder. r=dvander
authorJeff Muizelaar <jmuizelaar@mozilla.com>
Fri, 29 Apr 2016 14:39:51 -0400
changeset 296106 706a4bcfad6ebc52d11e2856aafaffa587a06b2c
parent 296105 8c4cf92bea9117d656b5e2f669809aa7e02f2d3c
child 296107 ebf3313b6a4385f0817c6f643ce1e009ef3ae2c4
push id76191
push userjmuizelaar@mozilla.com
push dateWed, 04 May 2016 15:34:27 +0000
treeherdermozilla-inbound@706a4bcfad6e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdvander
bugs1262427
milestone49.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 1262427. Don't try D3D11 harder. r=dvander If we know D3D11 isn't going to work we shouldn't bother using it for ANGLE.
gfx/gl/GLLibraryEGL.cpp
gfx/thebes/gfxPlatform.cpp
gfx/thebes/gfxPlatform.h
gfx/thebes/gfxWindowsPlatform.cpp
gfx/thebes/gfxWindowsPlatform.h
--- a/gfx/gl/GLLibraryEGL.cpp
+++ b/gfx/gl/GLLibraryEGL.cpp
@@ -174,17 +174,17 @@ GetAndInitDisplayForAccelANGLE(GLLibrary
     // D3D11 ANGLE if the layer manager is prefering D3D9 (hrm, do we care?)
     if (!gfxPrefs::LayersOffMainThreadCompositionForceDisabled() &&
         !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
@@ -2169,23 +2169,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::AccelerateLayersByDefault()
 {
 #if defined(MOZ_GL_PROVIDER) || defined(MOZ_WIDGET_UIKIT)
   return true;
 #else
   return false;
 #endif
 }
--- a/gfx/thebes/gfxPlatform.h
+++ b/gfx/thebes/gfxPlatform.h
@@ -446,17 +446,17 @@ public:
 
     // Are we in safe mode?
     static bool InSafeMode();
 
     static bool OffMainThreadCompositingEnabled();
 
     static bool CanUseDirect3D9();
     virtual bool CanUseHardwareVideoDecoding();
-    static bool CanUseDirect3D11ANGLE();
+    virtual bool CanUseDirect3D11ANGLE() { return false; }
 
     // Returns a prioritized list of all available compositor backends.
     void GetCompositorBackends(bool useAcceleration, nsTArray<mozilla::layers::LayersBackend>& aBackends);
 
     /**
      * Is it possible to use buffer rotation.  Note that these
      * check the preference, but also allow for the override to
      * disable it using DisableBufferRotation.
--- a/gfx/thebes/gfxWindowsPlatform.cpp
+++ b/gfx/thebes/gfxWindowsPlatform.cpp
@@ -424,16 +424,22 @@ gfxWindowsPlatform::CanUseHardwareVideoD
 {
   if (!gfxPrefs::LayersPreferD3D9() && !mCompositorD3D11TextureSharingWorks) {
     return false;
   }
   return !IsWARP() && gfxPlatform::CanUseHardwareVideoDecoding();
 }
 
 bool
+gfxWindowsPlatform::CanUseDirect3D11ANGLE()
+{
+  return gANGLESupportsD3D11 && gfxConfig::IsEnabled(Feature::D3D11_COMPOSITING);
+}
+
+bool
 gfxWindowsPlatform::InitDWriteSupport()
 {
   MOZ_ASSERT(!mDWriteFactory && IsVistaOrLater());
 
   mozilla::ScopedGfxFeatureReporter reporter("DWrite");
   decltype(DWriteCreateFactory)* createDWriteFactory = (decltype(DWriteCreateFactory)*)
       GetProcAddress(LoadLibraryW(L"dwrite.dll"), "DWriteCreateFactory");
   if (!createDWriteFactory) {
--- a/gfx/thebes/gfxWindowsPlatform.h
+++ b/gfx/thebes/gfxWindowsPlatform.h
@@ -92,16 +92,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
     };
@@ -255,16 +257,18 @@ public:
 
     void GetDeviceInitData(mozilla::gfx::DeviceInitData* aOut) override;
 
     bool SupportsPluginDirectBitmapDrawing() override {
       return true;
     }
     bool SupportsPluginDirectDXGIDrawing();
 
+    virtual bool CanUseDirect3D11ANGLE();
+
 protected:
     bool AccelerateLayersByDefault() override {
       return true;
     }
     void GetAcceleratedCompositorBackends(nsTArray<mozilla::layers::LayersBackend>& aBackends) override;
     virtual void GetPlatformCMSOutputProfile(void* &mem, size_t &size) override;
     bool UpdateDeviceInitData() override;