Bug 1421818 - Disable D2D backend if WebRender is enabled. r=jrmuizel
authorAndrew Osmond <aosmond@mozilla.com>
Fri, 02 Mar 2018 13:16:26 -0500
changeset 461411 9922610d010eb3c579c7f893f67c6f186affc2a8
parent 461410 00fc5ded3b48de4beba1597465d6d9a59e733556
child 461412 2a775fb2d85e9794364569b1bff761459b270c61
push id1683
push usersfraser@mozilla.com
push dateThu, 26 Apr 2018 16:43:40 +0000
treeherdermozilla-release@5af6cb21869d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjrmuizel
bugs1421818
milestone60.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 1421818 - Disable D2D backend if WebRender is enabled. r=jrmuizel
gfx/thebes/gfxPlatform.h
gfx/thebes/gfxWindowsPlatform.cpp
gfx/thebes/gfxWindowsPlatform.h
--- a/gfx/thebes/gfxPlatform.h
+++ b/gfx/thebes/gfxPlatform.h
@@ -717,16 +717,17 @@ public:
     // you probably want to use gfxVars::UseWebRender() instead of this
     static bool WebRenderEnvvarEnabled();
 
 protected:
     gfxPlatform();
     virtual ~gfxPlatform();
 
     virtual void InitAcceleration();
+    virtual void InitWebRenderConfig();
 
     /**
      * Called immediately before deleting the gfxPlatform object.
      */
     virtual void WillShutdown();
 
     /**
      * Initialized hardware vsync based on each platform.
@@ -834,17 +835,16 @@ private:
 
     /**
      * This uses nsIScreenManager to determine the screen size and color depth
      */
     void PopulateScreenInfo();
 
     void InitCompositorAccelerationPrefs();
     void InitGPUProcessPrefs();
-    void InitWebRenderConfig();
     void InitOMTPConfig();
 
     static bool IsDXInterop2Blocked();
 
     RefPtr<gfxASurface> mScreenReferenceSurface;
     nsCOMPtr<nsIObserver> mSRGBOverrideObserver;
     nsCOMPtr<nsIObserver> mFontPrefsObserver;
     nsCOMPtr<nsIObserver> mMemoryPressureObserver;
--- a/gfx/thebes/gfxWindowsPlatform.cpp
+++ b/gfx/thebes/gfxWindowsPlatform.cpp
@@ -365,16 +365,26 @@ gfxWindowsPlatform::InitAcceleration()
     InitDWriteSupport();
   }
 
   // CanUseHardwareVideoDecoding depends on DeviceManagerDx state,
   // so update the cached value now.
   UpdateCanUseHardwareVideoDecoding();
 }
 
+void
+gfxWindowsPlatform::InitWebRenderConfig()
+{
+  gfxPlatform::InitWebRenderConfig();
+
+  if (gfxVars::UseWebRender()) {
+    UpdateBackendPrefs();
+  }
+}
+
 bool
 gfxWindowsPlatform::CanUseHardwareVideoDecoding()
 {
   DeviceManagerDx* dm = DeviceManagerDx::Get();
   if (!dm) {
     return false;
   }
   if (!dm->TextureSharingWorks()) {
@@ -431,17 +441,18 @@ gfxWindowsPlatform::HandleDeviceReset()
 void
 gfxWindowsPlatform::UpdateBackendPrefs()
 {
   uint32_t canvasMask = BackendTypeBit(BackendType::CAIRO) |
                         BackendTypeBit(BackendType::SKIA);
   uint32_t contentMask = BackendTypeBit(BackendType::CAIRO) |
                          BackendTypeBit(BackendType::SKIA);
   BackendType defaultBackend = BackendType::SKIA;
-  if (gfxConfig::IsEnabled(Feature::DIRECT2D) && Factory::HasD2D1Device()) {
+  if (gfxConfig::IsEnabled(Feature::DIRECT2D) &&
+      Factory::HasD2D1Device() && !gfxVars::UseWebRender()) {
     contentMask |= BackendTypeBit(BackendType::DIRECT2D1_1);
     canvasMask |= BackendTypeBit(BackendType::DIRECT2D1_1);
     defaultBackend = BackendType::DIRECT2D1_1;
   }
   InitBackendPrefs(canvasMask, defaultBackend, contentMask, defaultBackend);
 }
 
 bool
--- a/gfx/thebes/gfxWindowsPlatform.h
+++ b/gfx/thebes/gfxWindowsPlatform.h
@@ -232,16 +232,17 @@ protected:
     void BuildContentDeviceData(mozilla::gfx::ContentDeviceData* aOut) override;
 
 protected:
     RenderMode mRenderMode;
 
 private:
     void Init();
     void InitAcceleration() override;
+    void InitWebRenderConfig() override;
 
     void InitializeDevices();
     void InitializeD3D11();
     void InitializeD2D();
     bool InitDWriteSupport();
     bool InitGPUProcessSupport();
 
     void DisableD2D(mozilla::gfx::FeatureStatus aStatus, const char* aMessage,