Bug 1023882 - Part 5 - Move the invalid region calculation up a bit. r=Cwiiis
authorKartikaya Gupta <kgupta@mozilla.com>
Wed, 11 Jun 2014 12:42:45 -0400
changeset 208285 fa1f2e6b820b5e51ec1177d23a7b5741337b6077
parent 208284 8ed48f1320b86952bdd4a8a5ea3e95943d19d69f
child 208286 71229cd93bd6520900cd93ae40652d3915cfc37e
push id494
push userraliiev@mozilla.com
push dateMon, 25 Aug 2014 18:42:16 +0000
treeherdermozilla-release@a3cc3e46b571 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersCwiiis
bugs1023882
milestone32.0a2
Bug 1023882 - Part 5 - Move the invalid region calculation up a bit. r=Cwiiis
gfx/layers/client/ClientTiledThebesLayer.cpp
--- a/gfx/layers/client/ClientTiledThebesLayer.cpp
+++ b/gfx/layers/client/ClientTiledThebesLayer.cpp
@@ -360,42 +360,45 @@ ClientTiledThebesLayer::RenderLayer()
 
     // For more complex cases we need to calculate a bunch of metrics before we
     // can do the paint.
     BeginPaint();
     if (mPaintData.mPaintFinished) {
       return;
     }
 
-    TILING_PRLOG_OBJ(("TILING 0x%p: Valid region %s\n", this, tmpstr.get()), mValidRegion);
-    TILING_PRLOG_OBJ(("TILING 0x%p: Visible region %s\n", this, tmpstr.get()), mVisibleRegion);
-
-    // Make sure that tiles that fall outside of the visible region are
-    // discarded on the first update.
+    // Make sure that tiles that fall outside of the visible region or outside of the
+    // critical displayport are discarded on the first update. Also make sure that we
+    // only draw stuff inside the critical displayport on the first update.
     mValidRegion.And(mValidRegion, mVisibleRegion);
     if (!mPaintData.mCriticalDisplayPort.IsEmpty()) {
-      // Make sure that tiles that fall outside of the critical displayport are
-      // discarded on the first update.
       mValidRegion.And(mValidRegion, LayerIntRect::ToUntyped(mPaintData.mCriticalDisplayPort));
+      invalidRegion.And(invalidRegion, LayerIntRect::ToUntyped(mPaintData.mCriticalDisplayPort));
     }
+
+    TILING_PRLOG_OBJ(("TILING 0x%p: First-transaction valid region %s\n", this, tmpstr.get()), mValidRegion);
+    TILING_PRLOG_OBJ(("TILING 0x%p: First-transaction invalid region %s\n", this, tmpstr.get()), invalidRegion);
+  } else {
+    if (!mPaintData.mCriticalDisplayPort.IsEmpty()) {
+      invalidRegion.And(invalidRegion, LayerIntRect::ToUntyped(mPaintData.mCriticalDisplayPort));
+    }
+    TILING_PRLOG_OBJ(("TILING 0x%p: Repeat-transaction invalid region %s\n", this, tmpstr.get()), invalidRegion);
   }
 
   nsIntRegion lowPrecisionInvalidRegion;
   if (!mPaintData.mCriticalDisplayPort.IsEmpty()) {
     if (gfxPrefs::UseLowPrecisionBuffer()) {
       // Calculate the invalid region for the low precision buffer
       lowPrecisionInvalidRegion.Sub(mVisibleRegion, mLowPrecisionValidRegion);
 
       // Remove the valid region from the low precision valid region (we don't
       // validate this part of the low precision buffer).
       lowPrecisionInvalidRegion.Sub(lowPrecisionInvalidRegion, mValidRegion);
     }
 
-    // Clip the invalid region to the critical display-port
-    invalidRegion.And(invalidRegion, LayerIntRect::ToUntyped(mPaintData.mCriticalDisplayPort));
     if (invalidRegion.IsEmpty() && lowPrecisionInvalidRegion.IsEmpty()) {
       EndPaint(true);
       return;
     }
   }
 
   TILING_PRLOG_OBJ(("TILING 0x%p: Invalid region %s\n", this, tmpstr.get()), invalidRegion);