Bug 1605963 - Do not create SwapChain when OS compositor is used on Windows r=gw

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
sotaro 2020-01-05 19:10:12 +00:00
Родитель dd4a096660
Коммит 9226c571f4
2 изменённых файлов: 38 добавлений и 18 удалений

Просмотреть файл

@ -157,6 +157,41 @@ bool RenderCompositorANGLE::Initialize() {
return false;
}
// Create DCLayerTree when DirectComposition is used.
if (gfx::gfxVars::UseWebRenderDCompWin()) {
HWND compositorHwnd = mWidget->AsWindows()->GetCompositorHwnd();
if (compositorHwnd) {
mDCLayerTree =
DCLayerTree::Create(gl, mEGLConfig, mDevice, compositorHwnd);
} else {
gfxCriticalNote << "Compositor window was not created";
}
}
// Create SwapChain when compositor is not used
if (!UseCompositor()) {
if (!CreateSwapChain()) {
// SwapChain creation failed.
return false;
}
}
// SyncObject is used only by D3D11DXVA2Manager
mSyncObject = layers::SyncObjectHost::CreateSyncObjectHost(mDevice);
if (!mSyncObject->Init()) {
// Some errors occur. Clear the mSyncObject here.
// Then, there will be no texture synchronization.
return false;
}
InitializeUsePartialPresent();
return true;
}
bool RenderCompositorANGLE::CreateSwapChain() {
MOZ_ASSERT(!UseCompositor());
HWND hwnd = mWidget->AsWindows()->GetHwnd();
RefPtr<IDXGIDevice> dxgiDevice;
@ -252,28 +287,16 @@ bool RenderCompositorANGLE::Initialize() {
// We need this because we don't want DXGI to respond to Alt+Enter.
dxgiFactory->MakeWindowAssociation(hwnd, DXGI_MWA_NO_WINDOW_CHANGES);
// SyncObject is used only by D3D11DXVA2Manager
mSyncObject = layers::SyncObjectHost::CreateSyncObjectHost(mDevice);
if (!mSyncObject->Init()) {
// Some errors occur. Clear the mSyncObject here.
// Then, there will be no texture synchronization.
if (!ResizeBufferIfNeeded()) {
return false;
}
if (!UseCompositor()) {
if (!ResizeBufferIfNeeded()) {
return false;
}
}
InitializeUsePartialPresent();
return true;
}
void RenderCompositorANGLE::CreateSwapChainForDCompIfPossible(
IDXGIFactory2* aDXGIFactory2) {
if (!aDXGIFactory2) {
if (!aDXGIFactory2 || !mDCLayerTree) {
return;
}
@ -288,10 +311,6 @@ void RenderCompositorANGLE::CreateSwapChainForDCompIfPossible(
return;
}
mDCLayerTree = DCLayerTree::Create(gl(), mEGLConfig, mDevice, hwnd);
if (!mDCLayerTree) {
return;
}
MOZ_ASSERT(XRE_IsGPUProcess());
// When compositor is enabled, CompositionSurface is used for rendering.

Просмотреть файл

@ -100,6 +100,7 @@ class RenderCompositorANGLE : public RenderCompositor {
bool CreateEGLSurface();
void DestroyEGLSurface();
ID3D11Device* GetDeviceOfEGLDisplay();
bool CreateSwapChain();
void CreateSwapChainForDCompIfPossible(IDXGIFactory2* aDXGIFactory2);
RefPtr<IDXGISwapChain1> CreateSwapChainForDComp(bool aUseTripleBuffering,
bool aUseAlpha);