Bug 824428 - Add Environment option which would allow to use Tiled Thebes Layers. r=bgirard

This commit is contained in:
Oleg Romashin 2013-01-14 20:21:02 -08:00
parent 319349c352
commit 9ffe6086ee
7 changed files with 18 additions and 15 deletions

View File

@ -260,6 +260,13 @@ LayerManager::GetScrollableLayers(nsTArray<Layer*>& aArray)
}
}
bool ThebesLayer::UseTiledThebes()
{
static bool useTiledThebesLayer =
Preferences::GetBool("gfx.use_tiled_thebes", false);
return useTiledThebesLayer;
}
already_AddRefed<gfxASurface>
LayerManager::CreateOptimalSurface(const gfxIntSize &aSize,
gfxASurface::gfxImageFormat aFormat)

View File

@ -1248,6 +1248,8 @@ public:
*/
gfxPoint GetResidualTranslation() const { return mResidualTranslation; }
static bool UseTiledThebes();
protected:
ThebesLayer(LayerManager* aManager, void* aImplData)
: Layer(aManager, aImplData)

View File

@ -8,11 +8,6 @@
#define TILEDLAYERBUFFER_TILE_SIZE 256
// Debug defines
#ifdef MOZ_ANDROID_OMTC
// This needs to go away as we enabled tiled
// layers everywhere.
#define FORCE_BASICTILEDTHEBESLAYER
#endif
//#define GFX_TILEDLAYER_DEBUG_OVERLAY
//#define GFX_TILEDLAYER_PREF_WARNINGS

View File

@ -1341,8 +1341,8 @@ already_AddRefed<ThebesLayer>
BasicShadowLayerManager::CreateThebesLayer()
{
NS_ASSERTION(InConstruction(), "Only allowed in construction phase");
#ifdef FORCE_BASICTILEDTHEBESLAYER
if (HasShadowManager() && GetParentBackendType() == LAYERS_OPENGL) {
if (HasShadowManager() && GetParentBackendType() == LAYERS_OPENGL &&
ThebesLayer::UseTiledThebes()) {
// BasicTiledThebesLayer doesn't support main
// thread compositing so only return this layer
// type if we have a shadow manager.
@ -1351,7 +1351,6 @@ BasicShadowLayerManager::CreateThebesLayer()
MAYBE_CREATE_SHADOW(Thebes);
return layer.forget();
} else
#endif
{
nsRefPtr<BasicShadowableThebesLayer> layer =
new BasicShadowableThebesLayer(this);

View File

@ -1553,11 +1553,9 @@ LayerManagerOGL::CreateShadowThebesLayer()
NS_WARNING("Call on destroyed layer manager");
return nullptr;
}
#ifdef FORCE_BASICTILEDTHEBESLAYER
return nsRefPtr<ShadowThebesLayer>(new TiledThebesLayerOGL(this)).forget();
#else
if (ThebesLayer::UseTiledThebes())
return nsRefPtr<ShadowThebesLayer>(new TiledThebesLayerOGL(this)).forget();
return nsRefPtr<ShadowThebesLayerOGL>(new ShadowThebesLayerOGL(this)).forget();
#endif
}
already_AddRefed<ShadowContainerLayer>

View File

@ -1027,9 +1027,8 @@ ShadowThebesLayerOGL::ShadowThebesLayerOGL(LayerManagerOGL *aManager)
: ShadowThebesLayer(aManager, nullptr)
, LayerOGL(aManager)
{
#ifdef FORCE_BASICTILEDTHEBESLAYER
NS_ABORT();
#endif
if (ThebesLayer::UseTiledThebes())
NS_ABORT();
mImplData = static_cast<LayerOGL*>(this);
}

View File

@ -671,3 +671,6 @@ pref("app.orientation.default", "");
// On memory pressure, release dirty but unused pages held by jemalloc
// back to the system.
pref("memory.free_dirty_pages", true);
// Enable tiled layers rendering by default on android
pref("gfx.use_tiled_thebes", true);