Bug 1130681. Part 2: Backout bug 1118876 for android reftest failures. r=jrmuizel
authorMason Chang <mchang@mozilla.com>
Fri, 13 Feb 2015 16:36:45 +0800
changeset 228929 a7c6bec02690ab181c1968aabe7f920aa6ceeccf
parent 228928 c81728bfda79529ea31c42a6e7467b854e9baddf
child 228930 9cf76d4021ce9ee02aade9248e0999f43f2d82a3
push id55558
push usermchang@mozilla.com
push dateFri, 13 Feb 2015 08:37:31 +0000
treeherdermozilla-inbound@9cf76d4021ce [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjrmuizel
bugs1130681, 1118876
milestone38.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 1130681. Part 2: Backout bug 1118876 for android reftest failures. r=jrmuizel
gfx/layers/TiledLayerBuffer.h
gfx/layers/client/TiledContentClient.cpp
gfx/layers/client/TiledContentClient.h
--- a/gfx/layers/TiledLayerBuffer.h
+++ b/gfx/layers/TiledLayerBuffer.h
@@ -553,25 +553,25 @@ TiledLayerBuffer<Derived, Tile>::Update(
       newRetainedTiles[index] = newTile;
 
       y += height;
     }
 
     x += width;
   }
 
-  mRetainedTiles = newRetainedTiles;
   AsDerived().PostValidate(aPaintRegion);
-  for (unsigned int i = 0; i < mRetainedTiles.Length(); ++i) {
-    AsDerived().UnlockTile(mRetainedTiles[i]);
+  for (unsigned int i = 0; i < newRetainedTiles.Length(); ++i) {
+    AsDerived().UnlockTile(newRetainedTiles[i]);
   }
 
   // At this point, oldTileCount should be zero
   MOZ_ASSERT(oldTileCount == 0, "Failed to release old tiles");
 
+  mRetainedTiles = newRetainedTiles;
   mValidRegion = newValidRegion;
   mPaintedRegion.Or(mPaintedRegion, aPaintRegion);
 }
 
 } // layers
 } // mozilla
 
 #endif // GFX_TILEDLAYERBUFFER_H
--- a/gfx/layers/client/TiledContentClient.cpp
+++ b/gfx/layers/client/TiledContentClient.cpp
@@ -512,17 +512,16 @@ TileClient::TileClient(const TileClient&
   mFrontLock = o.mFrontLock;
   mCompositableClient = o.mCompositableClient;
 #ifdef GFX_TILEDLAYER_DEBUG_OVERLAY
   mLastUpdate = o.mLastUpdate;
 #endif
   mManager = o.mManager;
   mInvalidFront = o.mInvalidFront;
   mInvalidBack = o.mInvalidBack;
-  mOrigin = o.mOrigin;
 }
 
 TileClient&
 TileClient::operator=(const TileClient& o)
 {
   if (this == &o) return *this;
   mBackBuffer.Set(this, o.mBackBuffer);
   mBackBufferOnWhite = o.mBackBufferOnWhite;
@@ -532,17 +531,16 @@ TileClient::operator=(const TileClient& 
   mFrontLock = o.mFrontLock;
   mCompositableClient = o.mCompositableClient;
 #ifdef GFX_TILEDLAYER_DEBUG_OVERLAY
   mLastUpdate = o.mLastUpdate;
 #endif
   mManager = o.mManager;
   mInvalidFront = o.mInvalidFront;
   mInvalidBack = o.mInvalidBack;
-  mOrigin = o.mOrigin;
   return *this;
 }
 
 
 void
 TileClient::Flip()
 {
 #if defined(MOZ_WIDGET_GONK) && ANDROID_VERSION >= 17
@@ -1053,41 +1051,16 @@ ClientTiledLayerBuffer::PostValidate(con
       ctx->CurrentMatrix().Scale(mResolution, mResolution).Translate(ThebesPoint(-mTilingOrigin)));
 
     mCallback(mPaintedLayer, ctx, aPaintRegion, DrawRegionClip::DRAW, nsIntRegion(), mCallbackData);
     mMoz2DTiles.clear();
     // Reset:
     mTilingOrigin = IntPoint(std::numeric_limits<int32_t>::max(),
                              std::numeric_limits<int32_t>::max());
   }
-
-  for (size_t i = 0; i < mRetainedTiles.Length(); ++i) {
-    TileClient& tile = mRetainedTiles[i];
-    if (tile.mFrontBuffer && tile.mFrontBuffer->IsLocked()) {
-      // Only worry about padding when not doing low-res because it simplifies
-      // the math and the artifacts won't be noticable
-      // Edge padding prevents sampling artifacts when compositing.
-      if (mResolution == 1) {
-        nsIntRect unscaledTile = nsIntRect(tile.mOrigin.x, tile.mOrigin.y,
-                                           GetTileSize().width, GetTileSize().height);
-        nsIntRegion tileValidRegion = GetValidRegion();
-        tileValidRegion.OrWith(aPaintRegion);
-
-        // We only need to pad out if the tile has area that's not valid
-        if (!tileValidRegion.Contains(unscaledTile)) {
-          tileValidRegion = tileValidRegion.Intersect(unscaledTile);
-          // translate the region into tile space and pad
-          tileValidRegion.MoveBy(-nsIntPoint(unscaledTile.x, unscaledTile.y));
-          RefPtr<DrawTarget> drawTarget = tile.mFrontBuffer->BorrowDrawTarget();
-          PadDrawTargetOutFromRegion(drawTarget, tileValidRegion);
-        }
-      }
-    }
-  }
-
 }
 
 void
 ClientTiledLayerBuffer::UnlockTile(TileClient aTile)
 {
   // We locked the back buffer, and flipped so we now need to unlock the front
   if (aTile.mFrontBuffer && aTile.mFrontBuffer->IsLocked()) {
     aTile.mFrontBuffer->Unlock();
@@ -1166,18 +1139,16 @@ ClientTiledLayerBuffer::ValidateTile(Til
     if (!backBufferOnWhite->Lock(OpenMode::OPEN_READ_WRITE)) {
       NS_WARNING("Failed to lock tile TextureClient for updating.");
       aTile.DiscardBackBuffer();
       aTile.DiscardFrontBuffer();
       return TileClient();
     }
   }
 
-  aTile.mOrigin = gfx::ToIntPoint(aTileOrigin);
-
   if (usingTiledDrawTarget) {
     if (createdTextureClient) {
       if (!mCompositableClient->AddTextureClient(backBuffer)) {
         NS_WARNING("Failed to add tile TextureClient.");
         aTile.DiscardFrontBuffer();
         aTile.DiscardBackBuffer();
         return aTile;
       }
@@ -1271,16 +1242,36 @@ ClientTiledLayerBuffer::ValidateTile(Til
                           drawRect.height);
     gfx::IntPoint copyTarget(NS_lroundf(drawRect.x), NS_lroundf(drawRect.y));
     drawTarget->CopySurface(source, copyRect, copyTarget);
 
     // Mark the newly updated area as invalid in the front buffer
     aTile.mInvalidFront.Or(aTile.mInvalidFront, nsIntRect(copyTarget.x, copyTarget.y, copyRect.width, copyRect.height));
   }
 
+  // only worry about padding when not doing low-res
+  // because it simplifies the math and the artifacts
+  // won't be noticable
+  if (mResolution == 1) {
+    nsIntRect unscaledTile = nsIntRect(aTileOrigin.x,
+                                       aTileOrigin.y,
+                                       GetTileSize().width,
+                                       GetTileSize().height);
+
+    nsIntRegion tileValidRegion = GetValidRegion();
+    tileValidRegion.Or(tileValidRegion, aDirtyRegion);
+    // We only need to pad out if the tile has area that's not valid
+    if (!tileValidRegion.Contains(unscaledTile)) {
+      tileValidRegion = tileValidRegion.Intersect(unscaledTile);
+      // translate the region into tile space and pad
+      tileValidRegion.MoveBy(-nsIntPoint(unscaledTile.x, unscaledTile.y));
+      PadDrawTargetOutFromRegion(drawTarget, tileValidRegion);
+    }
+  }
+
   // The new buffer is now validated, remove the dirty region from it.
   aTile.mInvalidBack.SubOut(offsetScaledDirtyRegion);
 
 #ifdef GFX_TILEDLAYER_DEBUG_OVERLAY
   DrawDebugOverlay(drawTarget, aTileOrigin.x * mResolution,
                    aTileOrigin.y * GetPresShellResolution(), GetTileLength(), GetTileLength());
 #endif
 
--- a/gfx/layers/client/TiledContentClient.h
+++ b/gfx/layers/client/TiledContentClient.h
@@ -269,18 +269,16 @@ struct TileClient
   CompositableClient* mCompositableClient;
 #ifdef GFX_TILEDLAYER_DEBUG_OVERLAY
   TimeStamp        mLastUpdate;
 #endif
   nsIntRegion mInvalidFront;
   nsIntRegion mInvalidBack;
   nsExpirationState mExpirationState;
 
-  gfx::IntPoint mOrigin;
-
 private:
   // Copies dirty pixels from the front buffer into the back buffer,
   // and records the copied region in aAddPaintedRegion.
   void ValidateBackBufferFromFront(const nsIntRegion &aDirtyRegion,
                                    nsIntRegion& aAddPaintedRegion);
 };
 
 /**