Bug 1380979 - Enable DXGITextureHostD3D11 usage with WebRender r=nical
authorsotaro <sotaro.ikeda.g@gmail.com>
Wed, 09 Aug 2017 14:28:15 +0900
changeset 373571 1f3ae725ac9d7044612941b0e469c2b4fe548ad5
parent 373570 81fbe7dc05a694e4e531d163b925e2830dd143d1
child 373572 07241c0f20c10733574d4b71b67d2aa2d643d581
push id32304
push usercbook@mozilla.com
push dateWed, 09 Aug 2017 09:37:21 +0000
treeherdermozilla-central@4c5fbf493763 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnical
bugs1380979
milestone57.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 1380979 - Enable DXGITextureHostD3D11 usage with WebRender r=nical
gfx/layers/client/TextureClient.cpp
gfx/layers/wr/WebRenderLayerManager.cpp
gfx/thebes/gfxWindowsPlatform.cpp
--- a/gfx/layers/client/TextureClient.cpp
+++ b/gfx/layers/client/TextureClient.cpp
@@ -1070,17 +1070,18 @@ TextureClient::CreateForDrawing(TextureF
 
   if (!gfx::Factory::AllowedSurfaceSize(aSize)) {
     return nullptr;
   }
 
   TextureData* data = nullptr;
 
 #ifdef XP_WIN
-  if (aLayersBackend == LayersBackend::LAYERS_D3D11 &&
+  if ((aLayersBackend == LayersBackend::LAYERS_D3D11 ||
+       aLayersBackend == LayersBackend::LAYERS_WR) &&
       (moz2DBackend == gfx::BackendType::DIRECT2D ||
        moz2DBackend == gfx::BackendType::DIRECT2D1_1 ||
        (!!(aAllocFlags & ALLOC_FOR_OUT_OF_BAND_CONTENT) &&
         DeviceManagerDx::Get()->GetContentDevice())) &&
       aSize.width <= aMaxTextureSize &&
       aSize.height <= aMaxTextureSize &&
       !(aAllocFlags & ALLOC_UPDATE_FROM_SURFACE))
   {
--- a/gfx/layers/wr/WebRenderLayerManager.cpp
+++ b/gfx/layers/wr/WebRenderLayerManager.cpp
@@ -668,16 +668,24 @@ WebRenderLayerManager::EndTransactionInt
       mIsFirstPaint = false;
     }
     mScrollData.SetPaintSequenceNumber(mPaintSequenceNumber);
   }
 
   bool sync = mTarget != nullptr;
   mLatestTransactionId = mTransactionIdAllocator->GetTransactionId(/*aThrottle*/ true);
 
+  // Skip the synchronization for buffer since we also skip the painting during
+  // device-reset status.
+  if (!gfxPlatform::GetPlatform()->DidRenderingDeviceReset()) {
+    if (WrBridge()->GetSyncObject() &&
+        WrBridge()->GetSyncObject()->IsSyncObjectValid()) {
+      WrBridge()->GetSyncObject()->Synchronize();
+    }
+  }
   {
     AutoProfilerTracing
       tracing("Paint", sync ? "ForwardDPTransactionSync":"ForwardDPTransaction");
     WrBridge()->DPEnd(builder, size.ToUnknownSize(), sync, mLatestTransactionId, mScrollData);
   }
 
   MakeSnapshotIfRequired(size);
   mNeedsComposite = false;
--- a/gfx/thebes/gfxWindowsPlatform.cpp
+++ b/gfx/thebes/gfxWindowsPlatform.cpp
@@ -52,16 +52,17 @@
 #include "nsWindowsHelpers.h"
 #include "gfx2DGlue.h"
 
 #include <string>
 
 #include <d3d10_1.h>
 
 #include "mozilla/gfx/2D.h"
+#include "mozilla/gfx/gfxVars.h"
 
 #include "nsMemory.h"
 
 #include <dwmapi.h>
 #include <d3d11.h>
 #include <d2d1_1.h>
 
 #include "nsIMemoryReporter.h"
@@ -473,16 +474,20 @@ gfxWindowsPlatform::UpdateRenderMode()
 mozilla::gfx::BackendType
 gfxWindowsPlatform::GetContentBackendFor(mozilla::layers::LayersBackend aLayers)
 {
   mozilla::gfx::BackendType defaultBackend = gfxPlatform::GetDefaultContentBackend();
   if (aLayers == LayersBackend::LAYERS_D3D11) {
     return defaultBackend;
   }
 
+  if (aLayers == LayersBackend::LAYERS_WR && gfx::gfxVars::UseWebRenderANGLE()) {
+    return defaultBackend;
+  }
+
   if (defaultBackend == BackendType::DIRECT2D1_1) {
     // We can't have D2D without D3D11 layers, so fallback to Skia.
     return BackendType::SKIA;
   }
 
   // Otherwise we have some non-accelerated backend and that's ok.
   return defaultBackend;
 }