Bug 1458798 - Clear the previous timestamp when we skip calling SampleAnimations in CompositeToTarget(). r?kats draft
authorHiroyuki Ikezoe <hikezoe@mozilla.com>
Thu, 03 May 2018 15:57:19 +0900
changeset 790933 21c08809a891a46ee82517ebea5995fd98c97466
parent 790873 2d83e1843241d869a2fc5cf06f96d3af44c70e70
child 790934 4e57d321978bf805a9573111f886af0e87c4293f
child 790936 0776969184734a52d9c532da25e9e710d1fa8a40
push id108652
push userhikezoe@mozilla.com
push dateThu, 03 May 2018 06:57:43 +0000
reviewerskats
bugs1458798
milestone61.0a1
Bug 1458798 - Clear the previous timestamp when we skip calling SampleAnimations in CompositeToTarget(). r?kats The purpose of the previous timestamp is to reduce the time difference between the timestamps on the main-thread and the compositor. Once we skipped a frame to compose animations on the compositor, the timestamp is far behind from the timestamp on the main-thread, so we should clear it. MozReview-Commit-ID: EGiQfwejfsy
gfx/layers/wr/WebRenderBridgeParent.cpp
--- a/gfx/layers/wr/WebRenderBridgeParent.cpp
+++ b/gfx/layers/wr/WebRenderBridgeParent.cpp
@@ -1272,39 +1272,42 @@ WebRenderBridgeParent::CompositeToTarget
 
   // The two arguments are part of the CompositorVsyncSchedulerOwner API but in
   // this implementation they should never be non-null.
   MOZ_ASSERT(aTarget == nullptr);
   MOZ_ASSERT(aRect == nullptr);
 
   AUTO_PROFILER_TRACING("Paint", "CompositeToTraget");
   if (mPaused || !mReceivedDisplayList) {
+    mPreviousFrameTimeStamp = TimeStamp();
     return;
   }
 
   if (!mForceRendering &&
       wr::RenderThread::Get()->TooManyPendingFrames(mApi->GetId())) {
     // Render thread is busy, try next time.
     mCompositorScheduler->ScheduleComposition();
+    mPreviousFrameTimeStamp = TimeStamp();
     return;
   }
 
   mAsyncImageManager->SetCompositionTime(TimeStamp::Now());
   mAsyncImageManager->ApplyAsyncImages();
 
   if (!mAsyncImageManager->GetCompositeUntilTime().IsNull()) {
     // Trigger another CompositeToTarget() call because there might be another
     // frame that we want to generate after this one.
     // It will check if we actually want to generate the frame or not.
     mCompositorScheduler->ScheduleComposition();
   }
 
   if (!mAsyncImageManager->GetAndResetWillGenerateFrame() &&
       !mForceRendering) {
     // Could skip generating frame now.
+    mPreviousFrameTimeStamp = TimeStamp();
     return;
   }
 
   wr::TransactionBuilder txn;
 
   nsTArray<wr::WrOpacityProperty> opacityArray;
   nsTArray<wr::WrTransformProperty> transformArray;