Bug 1438551 - When resizing single tile buffers be sure we don't mark the copied region as invalidated. r?nical draft
authorRyan Hunt <rhunt@eqrion.net>
Mon, 26 Mar 2018 18:15:30 -0500
changeset 780516 53424d957f8e77a2b7576aec1823e9b3012a4bcb
parent 779856 0a2dae2d8cf9f628c55668514c54a23da446d5de
child 780517 b4efd068ee04720b4188a8c4634a9364572ec623
child 781354 ef75615080ea4aa0bf248e4cbe8f9a1a0906f667
push id106023
push userbmo:rhunt@eqrion.net
push dateWed, 11 Apr 2018 14:59:43 +0000
reviewersnical
bugs1438551
milestone61.0a1
Bug 1438551 - When resizing single tile buffers be sure we don't mark the copied region as invalidated. r?nical We discard and copy over data from the old tile when we resize a single tiled content client. For some reason we were not removing that region we successfully copied from the invalid region we would then set on the tile. This would cause us to do more work on following frames. For some other reason we were removing that region from the region we'd clear for non-opaque tiles. This commit changes it so we remove it from both. MozReview-Commit-ID: DIu1Y3jzV7Z
gfx/layers/client/SingleTiledContentClient.cpp
--- a/gfx/layers/client/SingleTiledContentClient.cpp
+++ b/gfx/layers/client/SingleTiledContentClient.cpp
@@ -183,20 +183,18 @@ ClientSingleTiledLayerBuffer::PaintThebe
   RefPtr<gfx::DrawTarget> dt = backBuffer->BorrowDrawTarget();
   RefPtr<gfx::DrawTarget> dtOnWhite;
   if (backBufferOnWhite) {
     dtOnWhite = backBufferOnWhite->BorrowDrawTarget();
   }
 
   // If the old frontbuffer was discarded then attempt to copy what we
   // can from it to the new backbuffer.
-  bool copiedFromDiscarded = false;
-  nsIntRegion copyableRegion;
-
   if (discardedFrontBuffer) {
+    nsIntRegion copyableRegion;
     copyableRegion.And(aNewValidRegion, discardedValidRegion);
     copyableRegion.SubOut(aDirtyRegion);
 
     if (!copyableRegion.IsEmpty()) {
       OpenMode asyncFlags = asyncPaint ? OpenMode::OPEN_ASYNC
                                        : OpenMode::OPEN_NONE;
 
       TextureClientAutoLock frontLock(discardedFrontBuffer,
@@ -249,32 +247,27 @@ ClientSingleTiledLayerBuffer::PaintThebe
         } else {
           gfxWarning() << "[Tiling:Client] Failed to aquire the discarded front buffer's draw target";
         }
 
         TILING_LOG("TILING %p: Region copied from discarded frontbuffer %s\n", &mPaintedLayer, Stringify(copyableRegion).c_str());
 
         // We don't need to repaint valid content that was just copied.
         paintRegion.SubOut(copyableRegion);
-        copiedFromDiscarded = true;
+        copyableRegion.MoveBy(-mTilingOrigin);
+        tileDirtyRegion.SubOut(copyableRegion);
       }
     }
   }
 
   if (mode != SurfaceMode::SURFACE_OPAQUE) {
-    nsIntRegion regionToClear = tileDirtyRegion;
-    if (copiedFromDiscarded) {
-      copyableRegion.MoveBy(-mTilingOrigin);
-      regionToClear.SubOut(copyableRegion);
-    }
-
     auto clear = CapturedTiledPaintState::Clear{
       dt,
       dtOnWhite,
-      regionToClear,
+      tileDirtyRegion,
     };
 
     if (asyncPaint) {
       paintClears.push_back(clear);
     } else {
       clear.ClearBuffer();
     }
   }