Commit 65a8b8cb by apatrick@chromium.org

When CheckDeviceState returns S_PRESENT_OCCLUDED, Present a dummy frame and try again.

This is to avoid a hang in glFinish in the event that the GPU hangs while the screen is locked. To repro, modify this sample so that it waits a few seconds before hanging the GPU. https://www.khronos.org/registry/webgl/conformance-suites/1.0.0/extra/lots-of-polys-example.html After initiating the GPU hang, quickly lock the screen. The GPU will reset but ANGLE only ever sees S_PRESENT_OCCLUDED followed by D3DERR_NOERROR. It never sees the device lost error. Calling Present while the screen is locked seems to make CheckDeviceState return the device lost. Doing the extra Present in testDeviceLost every time did not work well because it is very slow, perhaps because D3D delays presents to hidden windows to throttle the app. Review URL: https://codereview.appspot.com/7911044 git-svn-id: https://angleproject.googlecode.com/svn/trunk@2001 736b8ea6-26fd-11df-bfd4-992fa37f6226
parent d64134c3
#define MAJOR_VERSION 1 #define MAJOR_VERSION 1
#define MINOR_VERSION 0 #define MINOR_VERSION 0
#define BUILD_VERSION 0 #define BUILD_VERSION 0
#define BUILD_REVISION 2000 #define BUILD_REVISION 2001
#define STRINGIFY(x) #x #define STRINGIFY(x) #x
#define MACRO_STRINGIFY(x) STRINGIFY(x) #define MACRO_STRINGIFY(x) STRINGIFY(x)
......
...@@ -936,6 +936,13 @@ bool Display::testDeviceLost() ...@@ -936,6 +936,13 @@ bool Display::testDeviceLost()
// Retest the device status to see if the mode change really indicated a lost device. // Retest the device status to see if the mode change really indicated a lost device.
hr = mDeviceEx->CheckDeviceState(NULL); hr = mDeviceEx->CheckDeviceState(NULL);
} }
else if (hr == S_PRESENT_OCCLUDED)
{
// CheckDeviceLost continuously returns S_PRESENT_OCCLUDED while the screen is locked. Calling Present
// unmasks the device lost error.
mDeviceEx->Present(NULL, NULL, NULL, NULL);
hr = mDeviceEx->CheckDeviceState(NULL);
}
isLost = FAILED(hr); isLost = FAILED(hr);
} }
else if (mDevice) else if (mDevice)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment