Bug 1382132 - Improving throttling GenerateFrame() r=nical
authorsotaro <sotaro.ikeda.g@gmail.com>
Mon, 24 Jul 2017 09:22:20 +0900
changeset 370512 7e74d958657e48ebb889e6db2d121cd4e32c3c8b
parent 370511 24df0c0bf28d041bc1b72b401c56f429dccd0f72
child 370513 cf5603f8b18147961f32c75a9d344bad54f6924d
push id32223
push usercbook@mozilla.com
push dateMon, 24 Jul 2017 11:01:58 +0000
treeherdermozilla-central@60a5308fa987 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnical
bugs1382132
milestone56.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 1382132 - Improving throttling GenerateFrame() r=nical
gfx/layers/wr/WebRenderBridgeParent.cpp
gfx/webrender_bindings/RenderThread.cpp
--- a/gfx/layers/wr/WebRenderBridgeParent.cpp
+++ b/gfx/layers/wr/WebRenderBridgeParent.cpp
@@ -1090,20 +1090,20 @@ WebRenderBridgeParent::SampleAnimations(
 void
 WebRenderBridgeParent::CompositeToTarget(gfx::DrawTarget* aTarget, const gfx::IntRect* aRect)
 {
   AutoProfilerTracing tracing("Paint", "CompositeToTraget");
   if (mPaused) {
     return;
   }
 
-  const uint32_t maxPendingFrameCount = 2;
+  const uint32_t maxPendingFrameCount = 1;
 
   if (!mForceRendering &&
-      wr::RenderThread::Get()->GetPendingFrameCount(mApi->GetId()) > maxPendingFrameCount) {
+      wr::RenderThread::Get()->GetPendingFrameCount(mApi->GetId()) >= maxPendingFrameCount) {
     // Render thread is busy, try next time.
     ScheduleComposition();
     return;
   }
 
   bool scheduleComposite = false;
   nsTArray<wr::WrOpacityProperty> opacityArray;
   nsTArray<wr::WrTransformProperty> transformArray;
@@ -1118,16 +1118,18 @@ WebRenderBridgeParent::CompositeToTarget
       scheduleComposite = true;
     }
   }
 
   if (PushAPZStateToWR(transformArray)) {
     scheduleComposite = true;
   }
 
+  wr::RenderThread::Get()->IncPendingFrameCount(mApi->GetId());
+
   if (!transformArray.IsEmpty() || !opacityArray.IsEmpty()) {
     mApi->GenerateFrame(opacityArray, transformArray);
   } else {
     mApi->GenerateFrame();
   }
 
   if (!mCompositableHolder->GetCompositeUntilTime().IsNull()) {
     scheduleComposite = true;
--- a/gfx/webrender_bindings/RenderThread.cpp
+++ b/gfx/webrender_bindings/RenderThread.cpp
@@ -373,17 +373,16 @@ WebRenderThreadPool::~WebRenderThreadPoo
 
 } // namespace wr
 } // namespace mozilla
 
 extern "C" {
 
 void wr_notifier_new_frame_ready(mozilla::wr::WrWindowId aWindowId)
 {
-  mozilla::wr::RenderThread::Get()->IncPendingFrameCount(aWindowId);
   mozilla::wr::RenderThread::Get()->NewFrameReady(mozilla::wr::WindowId(aWindowId));
 }
 
 void wr_notifier_new_scroll_frame_ready(mozilla::wr::WrWindowId aWindowId, bool aCompositeNeeded)
 {
   // It is not necessary to update rendering with new_scroll_frame_ready.
   // WebRenderBridgeParent::CompositeToTarget() is implemented to call
   // WebRenderAPI::GenerateFrame() if it is necessary to trigger UpdateAndRender().