Bug 963952 - [e10s] Don't use basic compositor when using D3D11 compositor (r=mattwoodrow)

This commit is contained in:
Bill McCloskey 2014-02-13 08:53:50 -08:00
parent f9670827d3
commit 785a0402ee
8 changed files with 38 additions and 6 deletions

View File

@ -25,6 +25,15 @@ Compositor::GetBackend()
return sBackend;
}
/* static */ void
Compositor::SetBackend(LayersBackend backend)
{
if (sBackend != LayersBackend::LAYERS_NONE && sBackend != backend) {
MOZ_CRASH("Trying to use more than one OMTC compositor.");
}
sBackend = backend;
}
/* static */ void
Compositor::AssertOnCompositorThread()
{

View File

@ -465,8 +465,12 @@ protected:
bool ShouldDrawDiagnostics(DiagnosticFlags);
/**
* Set the global Compositor backend, checking that one isn't already set.
*/
static void SetBackend(LayersBackend backend);
uint32_t mCompositorID;
static LayersBackend sBackend;
DiagnosticTypes mDiagnosticTypes;
PCompositorParent* mParent;
@ -477,6 +481,10 @@ protected:
*/
size_t mPixelsPerFrame;
size_t mPixelsFilled;
private:
static LayersBackend sBackend;
};
} // namespace layers

View File

@ -227,7 +227,7 @@ BasicCompositor::BasicCompositor(nsIWidget *aWidget)
: mWidget(aWidget)
{
MOZ_COUNT_CTOR(BasicCompositor);
sBackend = LayersBackend::LAYERS_BASIC;
SetBackend(LayersBackend::LAYERS_BASIC);
}
BasicCompositor::~BasicCompositor()

View File

@ -65,7 +65,7 @@ CompositorD3D11::CompositorD3D11(nsIWidget* aWidget)
, mHwnd(nullptr)
, mDisableSequenceForNextFrame(false)
{
sBackend = LayersBackend::LAYERS_D3D11;
SetBackend(LayersBackend::LAYERS_D3D11);
}
CompositorD3D11::~CompositorD3D11()

View File

@ -1,4 +1,4 @@
/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*-
/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
@ -26,7 +26,7 @@ CompositorD3D9::CompositorD3D9(PCompositorParent* aParent, nsIWidget *aWidget)
, mWidget(aWidget)
, mDeviceResetCount(0)
{
sBackend = LayersBackend::LAYERS_D3D9;
Compositor::SetBackend(LayersBackend::LAYERS_D3D9);
}
CompositorD3D9::~CompositorD3D9()

View File

@ -146,7 +146,7 @@ CompositorOGL::CompositorOGL(nsIWidget *aWidget, int aSurfaceWidth,
, mHeight(0)
{
MOZ_COUNT_CTOR(CompositorOGL);
sBackend = LayersBackend::LAYERS_OPENGL;
SetBackend(LayersBackend::LAYERS_OPENGL);
}
CompositorOGL::~CompositorOGL()

View File

@ -6509,6 +6509,19 @@ nsWindow::StartAllowingD3D9(bool aReinitialize)
}
}
bool
nsWindow::ShouldUseOffMainThreadCompositing()
{
// We don't currently support using an accelerated layer manager with
// transparent windows so don't even try. I'm also not sure if we even
// want to support this case. See bug 593471
if (mTransparencyMode == eTransparencyTransparent) {
return false;
}
return nsBaseWidget::ShouldUseOffMainThreadCompositing();
}
void
nsWindow::GetPreferredCompositorBackends(nsTArray<LayersBackend>& aHints)
{

View File

@ -287,6 +287,8 @@ public:
virtual void GetPreferredCompositorBackends(nsTArray<mozilla::layers::LayersBackend>& aHints);
virtual bool ShouldUseOffMainThreadCompositing();
protected:
virtual void WindowUsesOMTC() MOZ_OVERRIDE;