Bug 1567319 - Discard payloads for no-op composites. r=bas
authorMarkus Stange <mstange@themasta.com>
Thu, 15 Aug 2019 17:54:17 +0000
changeset 488367 3851e6be2a2d6c90448fb7969a1d50460b686ee5
parent 488366 4c576f23934f5995c0d82e01a0075e230dcdcb69
child 488368 9798b876061ebbc28eb23ab5d456c094855a4ce9
push id113906
push userncsoregi@mozilla.com
push dateFri, 16 Aug 2019 04:07:24 +0000
treeherdermozilla-inbound@d887276421d3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbas
bugs1567319
milestone70.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 1567319 - Discard payloads for no-op composites. r=bas Differential Revision: https://phabricator.services.mozilla.com/D40569
gfx/layers/composite/LayerManagerComposite.cpp
gfx/layers/mlgpu/LayerManagerMLGPU.cpp
--- a/gfx/layers/composite/LayerManagerComposite.cpp
+++ b/gfx/layers/composite/LayerManagerComposite.cpp
@@ -587,16 +587,22 @@ void LayerManagerComposite::UpdateAndRen
 
     invalid = mInvalidRegion;
   }
 
   if (invalid.IsEmpty() && !mWindowOverlayChanged) {
     // Composition requested, but nothing has changed. Don't do any work.
     mClonedLayerTreeProperties = LayerProperties::CloneFrom(GetRoot());
     mProfilerScreenshotGrabber.NotifyEmptyFrame();
+
+    // Discard the current payloads. These payloads did not require a composite
+    // (they caused no changes to anything visible), so we don't want to measure
+    // their latency.
+    mPayload.Clear();
+
     return;
   }
 
   // We don't want our debug overlay to cause more frames to happen
   // so we will invalidate after we've decided if something changed.
   InvalidateDebugOverlay(invalid, mRenderBounds);
 
   bool rendered = Render(invalid, opaque);
@@ -982,16 +988,22 @@ bool LayerManagerComposite::Render(const
   ScreenCoord offset = GetContentShiftForToolbar();
   ScopedCompositorRenderOffset scopedOffset(mCompositor->AsCompositorOGL(),
                                             ScreenPoint(0.0f, offset));
 #endif
 
   if (actualBounds.IsEmpty()) {
     mProfilerScreenshotGrabber.NotifyEmptyFrame();
     mCompositor->GetWidget()->PostRender(&widgetContext);
+
+    // Discard the current payloads. These payloads did not require a composite
+    // (they caused no changes to anything visible), so we don't want to measure
+    // their latency.
+    mPayload.Clear();
+
     return true;
   }
 
   // Allow widget to render a custom background.
   mCompositor->GetWidget()->DrawWindowUnderlay(
       &widgetContext, LayoutDeviceIntRect::FromUnknownRect(actualBounds));
 
   RefPtr<CompositingRenderTarget> previousTarget;
--- a/gfx/layers/mlgpu/LayerManagerMLGPU.cpp
+++ b/gfx/layers/mlgpu/LayerManagerMLGPU.cpp
@@ -308,16 +308,22 @@ void LayerManagerMLGPU::Composite() {
 
   AL_LOG("Computed invalid region: %s\n", Stringify(mInvalidRegion).c_str());
 
   // Now that we have the final invalid region, give it to the swap chain which
   // will tell us if we still need to render.
   if (!mSwapChain->ApplyNewInvalidRegion(std::move(mInvalidRegion),
                                          diagnosticRect)) {
     mProfilerScreenshotGrabber.NotifyEmptyFrame();
+
+    // Discard the current payloads. These payloads did not require a composite
+    // (they caused no changes to anything visible), so we don't want to measure
+    // their latency.
+    mPayload.Clear();
+
     return;
   }
 
   AutoUnlockAllTextures autoUnlock(mDevice);
 
   mDevice->BeginFrame();
 
   RenderLayers();