Bug 1292273 - Skip CompositorD3D11::EndFrame when device-removed happened and add some logs for tracking the behavior. r=dvander
authorGuanWen-Chen <kechen@mozilla.com>
Sat, 22 Oct 2016 20:27:00 -0400
changeset 319076 34fd4c7639ec76c97674be80df48fd75c0a2c8ca
parent 319075 711791502f6c48165772d3ccb3e3ad0c9435d06e
child 319077 0c0b78fc1a6dea85cf16fbfc98c14f72be4d6fa5
push id30860
push userryanvm@gmail.com
push dateMon, 24 Oct 2016 00:04:58 +0000
treeherdermozilla-central@215f96861176 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdvander
bugs1292273
milestone52.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 1292273 - Skip CompositorD3D11::EndFrame when device-removed happened and add some logs for tracking the behavior. r=dvander
gfx/layers/d3d11/CompositorD3D11.cpp
--- a/gfx/layers/d3d11/CompositorD3D11.cpp
+++ b/gfx/layers/d3d11/CompositorD3D11.cpp
@@ -974,24 +974,31 @@ CompositorD3D11::BeginFrame(const nsIntR
                             const nsIntRegion& aOpaqueRegion,
                             IntRect* aClipRectOut,
                             IntRect* aRenderBoundsOut)
 {
   // Don't composite if we are minimised. Other than for the sake of efficency,
   // this is important because resizing our buffers when mimised will fail and
   // cause a crash when we're restored.
   NS_ASSERTION(mHwnd, "Couldn't find an HWND when initialising?");
-  if (::IsIconic(mHwnd) || mDevice->GetDeviceRemovedReason() != S_OK) {
+  if (::IsIconic(mHwnd)) {
     // We are not going to render, and not going to call EndFrame so we have to
     // read-unlock our textures to prevent them from accumulating.
     ReadUnlockTextures();
     *aRenderBoundsOut = IntRect();
     return;
   }
 
+  if (mDevice->GetDeviceRemovedReason() != S_OK) {
+    gfxCriticalNote << "GFX: D3D11 skip BeginFrame with device-removed.";
+    ReadUnlockTextures();
+    *aRenderBoundsOut = IntRect();
+    return;
+  }
+
   LayoutDeviceIntSize oldSize = mSize;
 
   // Failed to create a render target or the view.
   if (!UpdateRenderTarget() || !mDefaultRT || !mDefaultRT->mRTView ||
       mSize.width <= 0 || mSize.height <= 0) {
     ReadUnlockTextures();
     *aRenderBoundsOut = IntRect();
     return;
@@ -1074,16 +1081,23 @@ CompositorD3D11::BeginFrame(const nsIntR
 void
 CompositorD3D11::EndFrame()
 {
   if (!mDefaultRT) {
     Compositor::EndFrame();
     return;
   }
 
+  if (mDevice->GetDeviceRemovedReason() != S_OK) {
+    gfxCriticalNote << "GFX: D3D11 skip EndFrame with device-removed.";
+    Compositor::EndFrame();
+    mCurrentRT = nullptr;
+    return;
+  }
+
   LayoutDeviceIntSize oldSize = mSize;
   EnsureSize();
   if (mSize.width <= 0 || mSize.height <= 0) {
     Compositor::EndFrame();
     return;
   }
 
   RefPtr<ID3D11Query> query;