Bug 783368 - Disable ReusableTileStoreOGL by default. r=blassey
authorChris Lord <chrislord.net@gmail.com>
Wed, 21 Nov 2012 22:34:19 +0000
changeset 113945 13917d4b99b8367eeabca3a77b86ba6aadf08254
parent 113944 729f9f0d437f097661981e86f1e083a74d914cc5
child 113946 f74b22565be08b34b0ea93a0c14ac33fffef7763
push id18466
push userchrislord.net@gmail.com
push dateWed, 21 Nov 2012 22:34:39 +0000
treeherdermozilla-inbound@c4d013240eac [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersblassey
bugs783368
milestone20.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 783368 - Disable ReusableTileStoreOGL by default. r=blassey Add layers.reuse-invalid-tiles to control use of the reusable tile store and disable it by default.
gfx/layers/opengl/TiledThebesLayerOGL.cpp
gfx/thebes/gfxPlatform.cpp
gfx/thebes/gfxPlatform.h
--- a/gfx/layers/opengl/TiledThebesLayerOGL.cpp
+++ b/gfx/layers/opengl/TiledThebesLayerOGL.cpp
@@ -2,16 +2,17 @@
  * 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/. */
 
 #include "mozilla/layers/PLayersChild.h"
 #include "TiledThebesLayerOGL.h"
 #include "ReusableTileStoreOGL.h"
 #include "BasicTiledThebesLayer.h"
 #include "gfxImageSurface.h"
+#include "gfxPlatform.h"
 
 namespace mozilla {
 namespace layers {
 
 using mozilla::gl::GLContext;
 
 TiledLayerBufferOGL::~TiledLayerBufferOGL()
 {
@@ -154,19 +155,20 @@ TiledThebesLayerOGL::ProcessUploadQueue(
     return;
 
   // We should only be retaining old tiles if we're not fixed position.
   // Fixed position layers don't/shouldn't move on the screen, so retaining
   // tiles is not useful and often results in rendering artifacts.
   if (mReusableTileStore && mIsFixedPosition) {
     delete mReusableTileStore;
     mReusableTileStore = nullptr;
-  } else if (!mReusableTileStore && !mIsFixedPosition) {
+  } else if (gfxPlatform::UseReusableTileStore() &&
+             !mReusableTileStore && !mIsFixedPosition) {
     // XXX Add a pref for reusable tile store size
-    mReusableTileStore = new ReusableTileStoreOGL(gl(), 2);
+    mReusableTileStore = new ReusableTileStoreOGL(gl(), 1);
   }
 
   gfxSize resolution(1, 1);
   if (mReusableTileStore) {
     // Work out render resolution by multiplying the resolution of our ancestors.
     // Only container layers can have frame metrics, so we start off with a
     // resolution of 1, 1.
     // XXX For large layer trees, it would be faster to do this once from the
--- a/gfx/thebes/gfxPlatform.cpp
+++ b/gfx/thebes/gfxPlatform.cpp
@@ -1242,16 +1242,32 @@ gfxPlatform::UseProgressiveTilePainting(
                                               "layers.progressive-paint",
                                               false);
     }
 
     return sUseProgressiveTilePainting;
 }
 
 bool
+gfxPlatform::UseReusableTileStore()
+{
+    static bool sUseReusableTileStore;
+    static bool sUseReusableTileStorePrefCached = false;
+
+    if (!sUseReusableTileStorePrefCached) {
+        sUseReusableTileStorePrefCached = true;
+        mozilla::Preferences::AddBoolVarCache(&sUseReusableTileStore,
+                                              "layers.reuse-invalid-tiles",
+                                              false);
+    }
+
+    return sUseReusableTileStore;
+}
+
+bool
 gfxPlatform::OffMainThreadCompositingEnabled()
 {
   return XRE_GetProcessType() == GeckoProcessType_Default ?
     CompositorParent::CompositorLoop() != nullptr :
     CompositorChild::ChildProcessHasCompositor();
 }
 
 eCMSMode
--- a/gfx/thebes/gfxPlatform.h
+++ b/gfx/thebes/gfxPlatform.h
@@ -400,16 +400,20 @@ public:
                                         nsTArray<const char*>& /*aFontList*/)
     {
         // platform-specific override, by default do nothing
     }
 
     // Break large OMTC tiled thebes layer painting into small paints.
     static bool UseProgressiveTilePainting();
 
+    // Retain some invalid tiles when the valid region of a layer changes and
+    // excludes previously valid tiles.
+    static bool UseReusableTileStore();
+
     static bool OffMainThreadCompositingEnabled();
 
     /**
      * Are we going to try color management?
      */
     static eCMSMode GetCMSMode();
 
     /**