Bug 1459233 - Make SyncObjectD3D11Host::Synchronize() fallible with WebRender r=mattwoodrow

This commit is contained in:
sotaro 2018-10-05 14:49:04 +09:00
parent 8bf0b5f63b
commit c4eb825654
4 changed files with 11 additions and 9 deletions

View File

@ -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() { }

View File

@ -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) {

View File

@ -498,7 +498,7 @@ public:
virtual SyncHandle GetSyncHandle() override;
virtual bool Synchronize() override;
virtual bool Synchronize(bool aFallible) override;
IDXGIKeyedMutex* GetKeyedMutex() { return mKeyedMutex.get(); };

View File

@ -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;