Don't reuse a back buffer after a swap if the content or surface changed (bug 1399692 part 9, r=bas)
☠☠ backed out by ee367696744a ☠ ☠
authorRyan Hunt <rhunt@eqrion.net>
Sun, 05 Nov 2017 10:38:47 -0500
changeset 444283 7d9324e2ab34946539be9f17d74f639aae5ba7e5
parent 444282 76bf99decf0906f0a6a4ad99539fd40f97c4539f
child 444284 e47ee65540ba07f65f194908157834edd41a2272
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 reuse a back buffer after a swap if the content or surface changed (bug 1399692 part 9, r=bas) MozReview-Commit-ID: HGAxkeyESbc
gfx/layers/client/ContentClient.cpp
--- a/gfx/layers/client/ContentClient.cpp
+++ b/gfx/layers/client/ContentClient.cpp
@@ -497,20 +497,29 @@ ContentClient::CalculateBufferForPaint(P
       // We need to validate the entire buffer, to make sure that only valid
       // pixels are sampled.
       neededRegion = destBufferRect;
     }
 
     // If we have an existing buffer, but the content type has changed or we
     // have transitioned into/out of component alpha, then we need to recreate it.
     bool needsComponentAlpha = (mode == SurfaceMode::SURFACE_COMPONENT_ALPHA);
-    bool changedSurfaceOrContent = frontBuffer &&
-                                   (contentType != frontBuffer->GetContentType() ||
-                                    needsComponentAlpha != frontBuffer->HaveBufferOnWhite());
-    if (canKeepBufferContents && changedSurfaceOrContent) {
+    bool backBufferChangedSurface = mBuffer &&
+                                    (contentType != mBuffer->GetContentType() ||
+                                     needsComponentAlpha != mBuffer->HaveBufferOnWhite());
+    if (canKeepBufferContents && backBufferChangedSurface) {
+      // We cannot reuse the back buffer if the surface type or content type
+      // changed. We may have to also invalidate, but only if the front buffer
+      // also changed.
+      canReuseBuffer = false;
+    }
+    bool frontBufferChangedSurface = frontBuffer &&
+                                     (contentType != frontBuffer->GetContentType() ||
+                                      needsComponentAlpha != frontBuffer->HaveBufferOnWhite());
+    if (canKeepBufferContents && frontBufferChangedSurface) {
       // Restart the decision process; we won't re-enter since we guard on
       // being able to keep the buffer contents.
       canReuseBuffer = false;
       canKeepBufferContents = false;
       validRegion.SetEmpty();
       continue;
     }