Bug 1204922: When ResizeBuffers fails, make no attempt to do subsequent paints until it succeeds again. r=milan a=ritu
authorBas Schouten <bschouten@mozilla.com>
Fri, 13 Nov 2015 13:04:44 +0100
changeset 305564 85d0f862ea1bdbfe69116cc683f6d6162bba782b
parent 305563 74501e7db97fe014260a644554e05bd5d4061912
child 305565 8c6659ea6dad9af767b0fdc2331df46ea1619b8b
push id1001
push userraliiev@mozilla.com
push dateMon, 18 Jan 2016 19:06:03 +0000
treeherdermozilla-release@8b89261f3ac4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmilan, ritu
bugs1204922
milestone44.0a2
Bug 1204922: When ResizeBuffers fails, make no attempt to do subsequent paints until it succeeds again. r=milan a=ritu
gfx/layers/d3d11/CompositorD3D11.cpp
gfx/layers/d3d11/CompositorD3D11.h
--- a/gfx/layers/d3d11/CompositorD3D11.cpp
+++ b/gfx/layers/d3d11/CompositorD3D11.cpp
@@ -144,16 +144,17 @@ private:
   bool mInitOkay;
 };
 
 CompositorD3D11::CompositorD3D11(nsIWidget* aWidget)
   : mAttachments(nullptr)
   , mWidget(aWidget)
   , mHwnd(nullptr)
   , mDisableSequenceForNextFrame(false)
+  , mVerifyBuffersFailed(false)
 {
 }
 
 CompositorD3D11::~CompositorD3D11()
 {
   if (mDevice) {
     int referenceCount = 0;
     UINT size = sizeof(referenceCount);
@@ -1214,19 +1215,20 @@ CompositorD3D11::VerifyBufferSize()
   HRESULT hr;
 
   hr = mSwapChain->GetDesc(&swapDesc);
   if (Failed(hr)) {
     gfxCriticalError() << "Failed to get the description " << hexa(hr);
     return false;
   }
 
-  if ((swapDesc.BufferDesc.Width == mSize.width &&
+  if (((swapDesc.BufferDesc.Width == mSize.width &&
        swapDesc.BufferDesc.Height == mSize.height) ||
-      mSize.width <= 0 || mSize.height <= 0) {
+       mSize.width <= 0 || mSize.height <= 0) &&
+      !mVerifyBuffersFailed) {
     return true;
   }
 
   if (mDefaultRT) {
     // Make sure the texture, which belongs to the swapchain, is destroyed
     // before resizing the swapchain.
     if (mCurrentRT == mDefaultRT) {
       mCurrentRT = nullptr;
@@ -1236,16 +1238,17 @@ CompositorD3D11::VerifyBufferSize()
   }
 
   hr = mSwapChain->ResizeBuffers(1, mSize.width, mSize.height,
                                  DXGI_FORMAT_B8G8R8A8_UNORM,
                                  0);
   if (Failed(hr)) {
     gfxCriticalNote << "D3D11 swap resize buffers failed " << hexa(hr) << " on " << mSize;
   }
+  mVerifyBuffersFailed = FAILED(hr);
 
   return Succeeded(hr);
 }
 
 bool
 CompositorD3D11::UpdateRenderTarget()
 {
   if (mDevice != gfxWindowsPlatform::GetPlatform()->GetD3D11Device()) {
--- a/gfx/layers/d3d11/CompositorD3D11.h
+++ b/gfx/layers/d3d11/CompositorD3D11.h
@@ -194,14 +194,16 @@ private:
   VertexShaderConstants mVSConstants;
   PixelShaderConstants mPSConstants;
   bool mDisableSequenceForNextFrame;
 
   gfx::IntRect mInvalidRect;
   // This is the clip rect applied to the default DrawTarget (i.e. the window)
   gfx::IntRect mCurrentClip;
   nsIntRegion mInvalidRegion;
+
+  bool mVerifyBuffersFailed;
 };
 
 }
 }
 
 #endif