Commit 8ea10736 authored by sotaro's avatar sotaro
Browse files

Bug 1569881 - Short term workaround for Intel GPU r=jrmuizel

When Windows version is mort than 1903 and GPU is intel GPU, it could cause flickering with DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL. See Bug 1556634. As a short term workaround, use DXGI_ALPHA_MODE_PREMULTIPLIED instead of DXGI_ALPHA_MODE_IGNORE at SwapChain.

Differential Revision: https://phabricator.services.mozilla.com/D41713

--HG--
extra : moz-landing-system : lando
parent 52d02ac5
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -44,6 +44,7 @@ class gfxVarReceiver;
  _(UseWebRenderDCompWin, bool, false)                             \
  _(UseWebRenderTripleBufferingWin, bool, false)                   \
  _(UseWebRenderProgramBinaryDisk, bool, false)                    \
  _(WorkaroundWebRenderIntelBug1556634, bool, false)               \
  _(WebRenderDebugFlags, int32_t, 0)                               \
  _(ScreenDepth, int32_t, 0)                                       \
  _(GREDirectory, nsString, nsString())                            \
+16 −0
Original line number Diff line number Diff line
@@ -3115,6 +3115,22 @@ void gfxPlatform::InitWebRenderConfig() {
      gfxVars::SetUseWebRenderTripleBufferingWin(true);
    }
  }

  // When Windows version is mort than 1903 and GPU is intel GPU, it could cause
  // flickering with DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL. See Bug 1556634.
  // As a workaround, use DXGI_ALPHA_MODE_PREMULTIPLIED instead of
  // DXGI_ALPHA_MODE_IGNORE at SwapChain.
  // XXX remove this workaround.
  if (IsWin10May2019UpdateOrLater() && UseWebRender() &&
      gfxVars::UseWebRenderDCompWin()) {
    nsAutoString adapterVendorID;
    nsCOMPtr<nsIGfxInfo> gfxInfo = services::GetGfxInfo();
    gfxInfo->GetAdapterVendorID(adapterVendorID);
    if (adapterVendorID == u"0x8086") {  // Intel
      gfxVars::SetWorkaroundWebRenderIntelBug1556634(true);
      gfxCriticalNote << "Use Premul SwapChain for Intel GPU";
    }
  }
#endif

  // Set features that affect WR's RendererOptions
+3 −1
Original line number Diff line number Diff line
@@ -317,7 +317,9 @@ void RenderCompositorANGLE::CreateSwapChainForDCompIfPossible(
  // DXGI_SCALING_NONE caused swap chain creation failure.
  desc.Scaling = DXGI_SCALING_STRETCH;
  desc.SwapEffect = DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL;
  desc.AlphaMode = DXGI_ALPHA_MODE_IGNORE;
  desc.AlphaMode = gfx::gfxVars::WorkaroundWebRenderIntelBug1556634()
                       ? DXGI_ALPHA_MODE_PREMULTIPLIED
                       : DXGI_ALPHA_MODE_IGNORE;
  desc.Flags = 0;

  hr = aDXGIFactory2->CreateSwapChainForComposition(mDevice, &desc, nullptr,