Bug 1595027 - Disable partial present when SwapChain uses alpha draft
authorsotaro <sotaro.ikeda.g@gmail.com>
Mon, 11 Nov 2019 15:14:19 +0900
changeset 2424709 c61ba90ecef9eeae34cdbe827c6380c75d9633c7
parent 2424494 72c52c0101cfd102b207224646c3007d6872e65c
child 2424710 fd29f93a1271604dfaf2aefcf16be6dce7f825c0
push id447523
push usersikeda.birchill@mozilla.com
push dateMon, 11 Nov 2019 06:19:12 +0000
treeherdertry@fd29f93a1271 [default view] [failures only]
bugs1595027
milestone72.0a1
Bug 1595027 - Disable partial present when SwapChain uses alpha Differential Revision: https://phabricator.services.mozilla.com/D52511
gfx/webrender_bindings/RenderCompositorANGLE.cpp
--- a/gfx/webrender_bindings/RenderCompositorANGLE.cpp
+++ b/gfx/webrender_bindings/RenderCompositorANGLE.cpp
@@ -381,16 +381,17 @@ bool RenderCompositorANGLE::BeginFrame()
         mBufferSize.reset();
 
         RefPtr<IDXGISwapChain1> swapChain1 =
             CreateSwapChainForDComp(mUseTripleBuffering, useAlpha);
         if (swapChain1) {
           mSwapChain = swapChain1;
           mUseAlpha = useAlpha;
           mDCLayerTree->SetDefaultSwapChain(swapChain1);
+          mFullRender = true;
         } else {
           gfxCriticalNote << "Failed to re-create SwapChain";
           RenderThread::Get()->HandleWebRenderError(
               WebRenderError::NEW_SURFACE);
           return false;
         }
       }
     }
@@ -428,17 +429,22 @@ RenderedFrameId RenderCompositorANGLE::E
           mWidget->AsWindows()->GetFxrOutputHandler();
       if (fxrHandler->TryInitialize(mSwapChain, mDevice)) {
         fxrHandler->UpdateOutput(mCtx);
       }
     }
 
     const LayoutDeviceIntSize& bufferSize = mBufferSize.ref();
 
-    if (mUsePartialPresent) {
+    // During high contrast mode, alpha is used. In this case,
+    // IDXGISwapChain1::Present1 draws nothing with compositor window.
+    // See Bug 1595027
+    MOZ_ASSERT_IF(mUsePartialPresent && mUseAlpha, mFullRender);
+
+    if (mUsePartialPresent && !mUseAlpha) {
       // Clear full render flag.
       mFullRender = false;
       // If there is no diry rect, we skip SwapChain present.
       if (aDirtyRects.length > 0) {
         StackArray<RECT, 1> rects(aDirtyRects.length);
         for (uintptr_t i = 0; i < aDirtyRects.length; i++) {
           const DeviceIntRect& rect = aDirtyRects.data[i];
           // Clip rect to bufferSize