Don't copy over regions that will be painted in this frame (bug 1399692 part 8, r=bas)
☠☠ backed out by ee367696744a ☠ ☠
authorRyan Hunt <rhunt@eqrion.net>
Sat, 04 Nov 2017 14:52:31 -0400
changeset 444282 76bf99decf0906f0a6a4ad99539fd40f97c4539f
parent 444281 0fc2414f146d8f5d08c97e5b7eedb25c5632ab2d
child 444283 7d9324e2ab34946539be9f17d74f639aae5ba7e5
push id1618
push userCallek@gmail.com
push dateThu, 11 Jan 2018 17:45:48 +0000
treeherdermozilla-release@882ca853e05a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbas
bugs1399692
milestone58.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
Don't copy over regions that will be painted in this frame (bug 1399692 part 8, r=bas) We do the same in FinalizeFrame, so we should do it here. MozReview-Commit-ID: JTKDj8yrtI2
gfx/layers/client/ContentClient.cpp
--- a/gfx/layers/client/ContentClient.cpp
+++ b/gfx/layers/client/ContentClient.cpp
@@ -248,33 +248,38 @@ ContentClient::BeginPaint(PaintedLayer* 
 
     if (!newBuffer->Lock(lockMode)) {
       gfxCriticalNote << "Failed to lock new back buffer.";
       return result;
     }
 
     // If we have an existing front buffer, copy it into the new back buffer
     if (RefPtr<RotatedBuffer> frontBuffer = GetFrontBuffer()) {
-      RefPtr<CapturedBufferState> bufferState = new CapturedBufferState();
+      nsIntRegion updateRegion = newBuffer->BufferRect();
+      updateRegion.Sub(updateRegion, result.mRegionToDraw);
 
-      bufferState->mBufferCopy = Some(CapturedBufferState::Copy {
-        frontBuffer->ShallowCopy(),
-        newBuffer->ShallowCopy(),
-        newBuffer->BufferRect(),
-      });
+      if (!updateRegion.IsEmpty()) {
+        RefPtr<CapturedBufferState> bufferState = new CapturedBufferState();
 
-      // If we're async painting then return the buffer state to
-      // be dispatched to the paint thread, otherwise do it now
-      if (asyncPaint) {
-        MOZ_ASSERT(!result.mBufferState);
-        result.mBufferState = bufferState;
-      } else {
-        if (!bufferState->PrepareBuffer()) {
-          gfxCriticalNote << "Failed to copy front buffer to back buffer.";
-          return result;
+        bufferState->mBufferCopy = Some(CapturedBufferState::Copy {
+          frontBuffer->ShallowCopy(),
+          newBuffer->ShallowCopy(),
+          updateRegion.GetBounds(),
+        });
+
+        // If we're async painting then return the buffer state to
+        // be dispatched to the paint thread, otherwise do it now
+        if (asyncPaint) {
+          MOZ_ASSERT(!result.mBufferState);
+          result.mBufferState = bufferState;
+        } else {
+          if (!bufferState->PrepareBuffer()) {
+            gfxCriticalNote << "Failed to copy front buffer to back buffer.";
+            return result;
+          }
         }
       }
 
       if (dest.mMustRemoveFrontBuffer) {
         Clear();
       }
     }