Bug 1595027 - Disable partial present when SwapChain uses alpha r=nical
authorsotaro <sotaro.ikeda.g@gmail.com>
Tue, 12 Nov 2019 22:13:41 +0000
changeset 501684 94d03e2199a4ff97f6677baa95df7fff7a286d5d
parent 501683 35fb1e29016b0085ff06603a6ee1c54b023e6b86
child 501685 6965500520e780708c1f1ccae7df92aee5d7d5ef
push id114172
push userdluca@mozilla.com
push dateTue, 19 Nov 2019 11:31:10 +0000
treeherdermozilla-inbound@b5c5ba07d3db [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnical
bugs1595027
milestone72.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1595027 - Disable partial present when SwapChain uses alpha r=nical During high contrast mode, alpha is used by SwapChain. In this case, IDXGISwapChain1::Present1() shows nothing with compositor window. To address the problem, we disable the Present1() usage when alpha is used. 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,21 @@ bool RenderCompositorANGLE::BeginFrame()
         mBufferSize.reset();
 
         RefPtr<IDXGISwapChain1> swapChain1 =
             CreateSwapChainForDComp(mUseTripleBuffering, useAlpha);
         if (swapChain1) {
           mSwapChain = swapChain1;
           mUseAlpha = useAlpha;
           mDCLayerTree->SetDefaultSwapChain(swapChain1);
+          // When alpha is used, we want to disable partial present.
+          // See Bug 1595027.
+          if (useAlpha) {
+            mFullRender = true;
+          }
         } else {
           gfxCriticalNote << "Failed to re-create SwapChain";
           RenderThread::Get()->HandleWebRenderError(
               WebRenderError::NEW_SURFACE);
           return false;
         }
       }
     }
@@ -428,17 +433,23 @@ 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 shows nothing with compositor window.
+    // In this case, we want to disable partial present by full render.
+    // 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