Bug 1687889 - Add more error handling of FLIP_SEQUENTIAL r=nical

When CompositorHwnd does not exist, FLIP_SEQUENTIAL could not be used, since it could cause a problem like Bug 1435995. For example, CompositorHwnd creation could be failed on Win7.

Differential Revision: https://phabricator.services.mozilla.com/D102531
This commit is contained in:
sotaro 2021-01-25 22:11:51 +00:00
parent c9f0d77260
commit 726fe3fae9

View File

@ -276,7 +276,13 @@ bool RenderCompositorANGLE::CreateSwapChain(nsACString& aError) {
desc.SampleDesc.Quality = 0;
desc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
if (gfx::gfxVars::UseWebRenderFlipSequentialWin()) {
bool useFlipSequential = gfx::gfxVars::UseWebRenderFlipSequentialWin();
if (useFlipSequential && !mWidget->AsWindows()->GetCompositorHwnd()) {
useFlipSequential = false;
gfxCriticalNoteOnce << "FLIP_SEQUENTIAL needs CompositorHwnd. Fallback";
}
if (useFlipSequential) {
useTripleBuffering = gfx::gfxVars::UseWebRenderTripleBufferingWin();
if (useTripleBuffering) {
desc.BufferCount = 3;
@ -299,7 +305,7 @@ bool RenderCompositorANGLE::CreateSwapChain(nsACString& aError) {
mSwapChain = swapChain1;
mSwapChain1 = swapChain1;
mUseTripleBuffering = useTripleBuffering;
} else if (gfx::gfxVars::UseWebRenderFlipSequentialWin()) {
} else if (useFlipSequential) {
gfxCriticalNoteOnce << "FLIP_SEQUENTIAL is not supported. Fallback";
if (mWidget->AsWindows()->GetCompositorHwnd()) {