Bug 934860 - Part 6: Add a pref to disable single rect painting and disable it for now for causing TART regressions. r=jrmuziel, a=lsblakk
authorMatt Woodrow <mwoodrow@mozilla.com>
Thu, 14 Nov 2013 13:46:19 +1300
changeset 166523 de17c895d5b814485c42e4dc22cb91f2c2e17ba5
parent 166522 42014e10777759da2f58c9092dad094912cc9962
child 166524 acae7cb1cb621bf525d0491ebacecdade3a8f2d5
push id3066
push userakeybl@mozilla.com
push dateMon, 09 Dec 2013 19:58:46 +0000
treeherdermozilla-beta@a31a0dce83aa [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjrmuziel, lsblakk
bugs934860
milestone27.0a2
Bug 934860 - Part 6: Add a pref to disable single rect painting and disable it for now for causing TART regressions. r=jrmuziel, a=lsblakk
layout/base/FrameLayerBuilder.cpp
--- a/layout/base/FrameLayerBuilder.cpp
+++ b/layout/base/FrameLayerBuilder.cpp
@@ -19,16 +19,17 @@
 #include "nsPrintfCString.h"
 #include "LayerTreeInvalidation.h"
 #include "nsSVGIntegrationUtils.h"
 #include "ImageContainer.h"
 
 #include "GeckoProfiler.h"
 #include "mozilla/gfx/Tools.h"
 #include "mozilla/gfx/2D.h"
+#include "mozilla/Preferences.h"
 
 #include <algorithm>
 
 using namespace mozilla::layers;
 using namespace mozilla::gfx;
 
 namespace mozilla {
 
@@ -3248,19 +3249,29 @@ FrameLayerBuilder::PaintItems(nsTArray<C
 
 /**
  * Returns true if it is preferred to draw the list of display
  * items separately for each rect in the visible region rather
  * than clipping to a complex region.
  */
 static bool ShouldDrawRectsSeparately(gfxContext* aContext, DrawRegionClip aClip)
 {
-  if (aContext->IsCairo() || aClip == CLIP_NONE) {
+  static bool sPaintRectsSeparately;
+  static bool sPaintRectsSeparatelyPrefCached = false;
+  if (!sPaintRectsSeparatelyPrefCached) {
+    mozilla::Preferences::AddBoolVarCache(&sPaintRectsSeparately, "layout.paint_rects_separately", false);
+    sPaintRectsSeparatelyPrefCached = true;
+  }
+
+  if (!sPaintRectsSeparately ||
+      aContext->IsCairo() ||
+      aClip == CLIP_NONE) {
     return false;
   }
+
   DrawTarget *dt = aContext->GetDrawTarget();
   return dt->GetType() == BACKEND_DIRECT2D;
 }
 
 static void DrawForcedBackgroundColor(gfxContext* aContext, Layer* aLayer, nscolor aBackgroundColor)
 {
   if (NS_GET_A(aBackgroundColor) > 0) {
     nsIntRect r = aLayer->GetVisibleRegion().GetBounds();