From 86af4e1c9946cf816bc33efadf6492a99bec410c Mon Sep 17 00:00:00 2001 From: Chris Lord Date: Wed, 21 Nov 2012 19:16:53 +0000 Subject: [PATCH] Bug 783368 - Add a pref to control low precision tile rendering. r=bgirard Add pref 'layers.low-precision-buffer', enabled on mobile/android. --- gfx/layers/basic/BasicTiledThebesLayer.cpp | 3 ++- gfx/thebes/gfxPlatform.cpp | 16 ++++++++++++++++ gfx/thebes/gfxPlatform.h | 4 ++++ mobile/android/app/mobile.js | 1 + 4 files changed, 23 insertions(+), 1 deletion(-) diff --git a/gfx/layers/basic/BasicTiledThebesLayer.cpp b/gfx/layers/basic/BasicTiledThebesLayer.cpp index f172f7bbeedf..06177540bb2b 100644 --- a/gfx/layers/basic/BasicTiledThebesLayer.cpp +++ b/gfx/layers/basic/BasicTiledThebesLayer.cpp @@ -591,7 +591,8 @@ BasicTiledThebesLayer::PaintThebes(gfxContext* aContext, // If we have a critical display-port defined, render the full display-port // progressively in the low-precision tiled buffer. bool updatedLowPrecision = false; - if (!criticalDisplayPort.IsEmpty() && + if (gfxPlatform::UseLowPrecisionBuffer() && + !criticalDisplayPort.IsEmpty() && !nsIntRegion(layerDisplayPort).Contains(mVisibleRegion)) { nsIntRegion oldValidRegion = mLowPrecisionTiledBuffer.GetValidRegion(); oldValidRegion.And(oldValidRegion, mVisibleRegion); diff --git a/gfx/thebes/gfxPlatform.cpp b/gfx/thebes/gfxPlatform.cpp index bb4a89b51189..c9c14235b665 100644 --- a/gfx/thebes/gfxPlatform.cpp +++ b/gfx/thebes/gfxPlatform.cpp @@ -1246,6 +1246,22 @@ gfxPlatform::UseProgressiveTilePainting() return sUseProgressiveTilePainting; } +bool +gfxPlatform::UseLowPrecisionBuffer() +{ + static bool sUseLowPrecisionBuffer; + static bool sUseLowPrecisionBufferPrefCached = false; + + if (!sUseLowPrecisionBufferPrefCached) { + sUseLowPrecisionBufferPrefCached = true; + mozilla::Preferences::AddBoolVarCache(&sUseLowPrecisionBuffer, + "layers.low-precision-buffer", + false); + } + + return sUseLowPrecisionBuffer; +} + bool gfxPlatform::UseReusableTileStore() { diff --git a/gfx/thebes/gfxPlatform.h b/gfx/thebes/gfxPlatform.h index f35748b84772..a5ac4350f2a3 100644 --- a/gfx/thebes/gfxPlatform.h +++ b/gfx/thebes/gfxPlatform.h @@ -405,6 +405,10 @@ public: // Break large OMTC tiled thebes layer painting into small paints. static bool UseProgressiveTilePainting(); + // When a critical display-port is set, render the visible area outside of + // it into a buffer at a lower precision. Requires tiled buffers. + static bool UseLowPrecisionBuffer(); + // Retain some invalid tiles when the valid region of a layer changes and // excludes previously valid tiles. static bool UseReusableTileStore(); diff --git a/mobile/android/app/mobile.js b/mobile/android/app/mobile.js index 9dc64260b96c..33af782c1eea 100644 --- a/mobile/android/app/mobile.js +++ b/mobile/android/app/mobile.js @@ -523,6 +523,7 @@ pref("layers.acceleration.disabled", false); pref("layers.offmainthreadcomposition.enabled", true); pref("layers.async-video.enabled", true); pref("layers.progressive-paint", true); +pref("layers.low-precision-buffer", true); pref("notification.feature.enabled", true);