Bug 1511797 - Allow catch up compositing to continue when we complete frame building. r=sotaro
authorMatt Woodrow <mwoodrow@mozilla.com>
Thu, 06 Dec 2018 22:19:03 +0000
changeset 449559 a58e3e8aab98d849e30e42cd9f70b34695e87e61
parent 449558 3347058499c706d9651ad1cfa3aaae3c1d45bbe7
child 449560 c9ff07bf8ef3e76000e14e51ffbcd65dbafcd441
push id35171
push userrmaries@mozilla.com
push dateFri, 07 Dec 2018 09:27:28 +0000
treeherdermozilla-central@6725a7f43bae [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssotaro
bugs1511797
milestone65.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 1511797 - Allow catch up compositing to continue when we complete frame building. r=sotaro Differential Revision: https://phabricator.services.mozilla.com/D13953
gfx/webrender_bindings/RenderThread.cpp
--- a/gfx/webrender_bindings/RenderThread.cpp
+++ b/gfx/webrender_bindings/RenderThread.cpp
@@ -322,16 +322,24 @@ static void NotifyDidRender(layers::Comp
                                     aRenderStart, aEnd, &aStats);
   }
 
   if (aBridge->GetWrBridge()) {
     aBridge->GetWrBridge()->CompositeIfNeeded();
   }
 }
 
+static void NotifyDidStartRender(layers::CompositorBridgeParent* aBridge) {
+  // Starting a render will change increment mRenderingCount, and potentially
+  // change whether we can allow the bridge to intiate another frame.
+  if (aBridge->GetWrBridge()) {
+    aBridge->GetWrBridge()->CompositeIfNeeded();
+  }
+}
+
 void RenderThread::UpdateAndRender(wr::WindowId aWindowId,
                                    const TimeStamp& aStartTime, bool aRender,
                                    const Maybe<gfx::IntSize>& aReadbackSize,
                                    const Maybe<Range<uint8_t>>& aReadbackBuffer,
                                    bool aHadSlowFrame) {
   AUTO_PROFILER_TRACING("Paint", "Composite");
   MOZ_ASSERT(IsInRenderThread());
   MOZ_ASSERT(aRender || aReadbackBuffer.isNothing());
@@ -340,16 +348,21 @@ void RenderThread::UpdateAndRender(wr::W
   MOZ_ASSERT(it != mRenderers.end());
   if (it == mRenderers.end()) {
     return;
   }
 
   TimeStamp start = TimeStamp::Now();
 
   auto& renderer = it->second;
+
+  layers::CompositorThreadHolder::Loop()->PostTask(
+      NewRunnableFunction("NotifyDidStartRenderRunnable", &NotifyDidStartRender,
+                          renderer->GetCompositorBridge()));
+
   bool rendered = false;
   RendererStats stats = {0};
   if (aRender) {
     rendered = renderer->UpdateAndRender(aReadbackSize, aReadbackBuffer,
                                          aHadSlowFrame, &stats);
   } else {
     renderer->Update();
   }