Force a repaint after DXGI device resets. (bug 1188019, r=bas)

This commit is contained in:
David Anderson 2015-12-17 11:20:08 -08:00
parent 9a6d78d24c
commit 8ced4416a5
4 changed files with 34 additions and 1 deletions

View File

@ -605,6 +605,12 @@ public:
virtual void FlushContentDrawing() {}
// If a device reset has occurred, update the necessary platform backend
// bits.
virtual bool UpdateForDeviceReset() {
return false;
}
/**
* Helper method, creates a draw target for a specific Azure backend.
* Used by CreateOffscreenDrawTarget.

View File

@ -1192,6 +1192,30 @@ gfxWindowsPlatform::DidRenderingDeviceReset(DeviceResetReason* aResetReason)
return false;
}
BOOL CALLBACK
InvalidateWindowForDeviceReset(HWND aWnd, LPARAM aMsg)
{
RedrawWindow(aWnd, nullptr, nullptr,
RDW_INVALIDATE|RDW_INTERNALPAINT|RDW_FRAME);
return TRUE;
}
bool
gfxWindowsPlatform::UpdateForDeviceReset()
{
if (!DidRenderingDeviceReset()) {
return false;
}
// Trigger an ::OnPaint for each window.
::EnumThreadWindows(GetCurrentThreadId(),
InvalidateWindowForDeviceReset,
0);
gfxCriticalNote << "Detected rendering device reset on refresh";
return true;
}
void
gfxWindowsPlatform::GetPlatformCMSOutputProfile(void* &mem, size_t &mem_size)
{

View File

@ -213,7 +213,8 @@ public:
*/
virtual bool IsFontFormatSupported(nsIURI *aFontURI, uint32_t aFormatFlags) override;
virtual bool DidRenderingDeviceReset(DeviceResetReason* aResetReason = nullptr) override;
bool DidRenderingDeviceReset(DeviceResetReason* aResetReason = nullptr) override;
bool UpdateForDeviceReset() override;
mozilla::gfx::BackendType GetContentBackendFor(mozilla::layers::LayersBackend aLayers) override;

View File

@ -1644,6 +1644,8 @@ nsRefreshDriver::Tick(int64_t aNowEpoch, TimeStamp aNowTime)
AutoRestore<TimeStamp> restoreTickStart(mTickStart);
mTickStart = TimeStamp::Now();
gfxPlatform::GetPlatform()->UpdateForDeviceReset();
/*
* The timer holds a reference to |this| while calling |Notify|.
* However, implementations of |WillRefresh| are permitted to destroy