From 0feeadb17fbda615b6d50c31f79ae11bfbfcf7fe Mon Sep 17 00:00:00 2001 From: Bas Schouten Date: Wed, 29 Apr 2015 09:19:00 -0400 Subject: [PATCH] Bug 1116812 - Consider DXGI_ERROR_INVALID_CALL a recoverable error for IDXGISwapChain::GetBuffer. r=jrmuizel, a=sledru --- gfx/layers/d3d11/CompositorD3D11.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/gfx/layers/d3d11/CompositorD3D11.cpp b/gfx/layers/d3d11/CompositorD3D11.cpp index 52d9898850d4..5e227852f203 100644 --- a/gfx/layers/d3d11/CompositorD3D11.cpp +++ b/gfx/layers/d3d11/CompositorD3D11.cpp @@ -1049,7 +1049,7 @@ CompositorD3D11::BeginFrame(const nsIntRegion& aInvalidRegion, // 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) || gfxPlatform::GetPlatform()->DidRenderingDeviceReset()) { + if (::IsIconic(mHwnd) || mDevice->GetDeviceRemovedReason() != S_OK) { *aRenderBoundsOut = Rect(); return; } @@ -1122,6 +1122,10 @@ CompositorD3D11::BeginFrame(const nsIntRegion& aInvalidRegion, void CompositorD3D11::EndFrame() { + if (!mDefaultRT) { + return; + } + mContext->Flush(); nsIntSize oldSize = mSize; @@ -1262,6 +1266,13 @@ CompositorD3D11::UpdateRenderTarget() nsRefPtr backBuf; hr = mSwapChain->GetBuffer(0, __uuidof(ID3D11Texture2D), (void**)backBuf.StartAssignment()); + if (hr == DXGI_ERROR_INVALID_CALL) { + // This happens on some GPUs/drivers when there's a TDR. + if (mDevice->GetDeviceRemovedReason() != S_OK) { + gfxCriticalError() << "GetBuffer returned invalid call!"; + return; + } + } if (Failed(hr)) { return; }