From 2a4132a521e2caa826e67425a9390f4d5c3636ad Mon Sep 17 00:00:00 2001 From: Andrew Osmond Date: Thu, 29 Jul 2021 22:45:41 +0000 Subject: [PATCH] Bug 1718329 - Gracefully handle device reset when mapping tiles with SW-WR + D3D11 compositing. r=jrmuizel If we encounter a device reset in RenderCompositorD3D11SWGL::TileD3D11::Map, we should fail the call, and rely upon the device reset checks at the end of a render pass to recreate our compositor sessions. Differential Revision: https://phabricator.services.mozilla.com/D121251 --- gfx/webrender_bindings/RenderCompositorD3D11SWGL.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/gfx/webrender_bindings/RenderCompositorD3D11SWGL.cpp b/gfx/webrender_bindings/RenderCompositorD3D11SWGL.cpp index 474522631b0a..2b79eaf60500 100644 --- a/gfx/webrender_bindings/RenderCompositorD3D11SWGL.cpp +++ b/gfx/webrender_bindings/RenderCompositorD3D11SWGL.cpp @@ -297,13 +297,15 @@ bool RenderCompositorD3D11SWGL::TileD3D11::Map(wr::DeviceIntRect aDirtyRect, } hr = context->Map(mRenderCompositor->mCurrentStagingTexture, 0, D3D11_MAP_READ_WRITE, 0, &mappedSubresource); - MOZ_RELEASE_ASSERT(SUCCEEDED(hr)); } } if (!SUCCEEDED(hr)) { gfxCriticalError() << "Failed to map tile: " << gfx::hexa(hr); + // This is only expected to fail if we hit a device reset. + MOZ_RELEASE_ASSERT( + mRenderCompositor->GetDevice()->GetDeviceRemovedReason() != S_OK); + return false; } - MOZ_RELEASE_ASSERT(SUCCEEDED(hr)); // aData is expected to contain a pointer to the first pixel within the valid // rect, so take the mapped resource's data (which covers the full tile size)