diff --git a/gfx/layers/SyncObject.h b/gfx/layers/SyncObject.h index 874b30f75445..45c7597ca709 100644 --- a/gfx/layers/SyncObject.h +++ b/gfx/layers/SyncObject.h @@ -37,7 +37,7 @@ public: virtual SyncHandle GetSyncHandle() = 0; // Return false for failed synchronization. - virtual bool Synchronize() = 0; + virtual bool Synchronize(bool aFallible = false) = 0; protected: SyncObjectHost() { } diff --git a/gfx/layers/d3d11/TextureD3D11.cpp b/gfx/layers/d3d11/TextureD3D11.cpp index 1d808f57fcef..22b28453f5f0 100644 --- a/gfx/layers/d3d11/TextureD3D11.cpp +++ b/gfx/layers/d3d11/TextureD3D11.cpp @@ -1716,22 +1716,24 @@ SyncObjectD3D11Host::GetSyncHandle() } bool -SyncObjectD3D11Host::Synchronize() +SyncObjectD3D11Host::Synchronize(bool aFallible) { HRESULT hr; AutoTextureLock lock(mKeyedMutex, hr, 10000); if (hr == WAIT_TIMEOUT) { hr = mDevice->GetDeviceRemovedReason(); - if (hr == S_OK) { + if (hr != S_OK ) { + // Since the timeout is related to the driver-removed. Return false for + // error handling. + gfxCriticalNote << "GFX: D3D11 timeout with device-removed:" << gfx::hexa(hr); + } else if (aFallible) { + gfxCriticalNote << "GFX: D3D11 timeout on the D3D11 sync lock."; + } else { // There is no driver-removed event. Crash with this timeout. MOZ_CRASH("GFX: D3D11 normal status timeout"); } - // Since the timeout is related to the driver-removed. Return false for - // error handling. - gfxCriticalNote << "GFX: D3D11 timeout with device-removed:" << gfx::hexa(hr); - return false; } if (hr == WAIT_ABANDONED) { diff --git a/gfx/layers/d3d11/TextureD3D11.h b/gfx/layers/d3d11/TextureD3D11.h index 031cd193f7ad..cccd234dbcc9 100644 --- a/gfx/layers/d3d11/TextureD3D11.h +++ b/gfx/layers/d3d11/TextureD3D11.h @@ -498,7 +498,7 @@ public: virtual SyncHandle GetSyncHandle() override; - virtual bool Synchronize() override; + virtual bool Synchronize(bool aFallible) override; IDXGIKeyedMutex* GetKeyedMutex() { return mKeyedMutex.get(); }; diff --git a/gfx/webrender_bindings/RenderCompositorANGLE.cpp b/gfx/webrender_bindings/RenderCompositorANGLE.cpp index 20d0dabd44f7..07f7b3c25f97 100644 --- a/gfx/webrender_bindings/RenderCompositorANGLE.cpp +++ b/gfx/webrender_bindings/RenderCompositorANGLE.cpp @@ -311,7 +311,7 @@ RenderCompositorANGLE::BeginFrame() } if (mSyncObject) { - if (!mSyncObject->Synchronize()) { + if (!mSyncObject->Synchronize(/* aFallible */ true)) { // It's timeout or other error. Handle the device-reset here. RenderThread::Get()->HandleDeviceReset("SyncObject", /* aNotify */ true); return false;