Bug 1455841 - Don't update mPreviousFrameTimeStamp in the case of testing refresh mode. r=kats
authorHiroyuki Ikezoe <hikezoe@mozilla.com>
Mon, 23 Apr 2018 06:27:19 +0900
changeset 468540 8f6ffc8378e3db276bcf3f0321f3a1699b34bc26
parent 468539 ad24bc2a835edeb7fdeb55f61721143d96196859
child 468541 49884f49386918a23b65867594b59ab90e33ca91
push id9165
push userasasaki@mozilla.com
push dateThu, 26 Apr 2018 21:04:54 +0000
treeherdermozilla-beta@064c3804de2e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskats
bugs1455841
milestone61.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 1455841 - Don't update mPreviousFrameTimeStamp in the case of testing refresh mode. r=kats On the testing refresh mode, we shouldn't update mPreviousFrameTimeStamp and don't need to use it since there shouldn't have any time difference between compositor time stamp and main-thread time stamp on the testing mode. MozReview-Commit-ID: FCcyEcFhmU
gfx/layers/wr/WebRenderBridgeParent.cpp
--- a/gfx/layers/wr/WebRenderBridgeParent.cpp
+++ b/gfx/layers/wr/WebRenderBridgeParent.cpp
@@ -1160,34 +1160,42 @@ void
 WebRenderBridgeParent::ActorDestroy(ActorDestroyReason aWhy)
 {
   Destroy();
 }
 
 void
 WebRenderBridgeParent::AdvanceAnimations()
 {
-  Maybe<TimeStamp> testingTimeStamp;
   if (CompositorBridgeParent* cbp = GetRootCompositorBridgeParent()) {
-    testingTimeStamp = cbp->GetTestingTimeStamp();
+    Maybe<TimeStamp> testingTimeStamp = cbp->GetTestingTimeStamp();
+    if (testingTimeStamp) {
+      // If we are on testing refresh mode, use the testing time stamp.  And
+      // also we don't update mPreviousFrameTimeStamp since unlike normal
+      // refresh mode, on the testing mode animations on the compositor are
+      // synchronously composed, so we don't need to worry about the time gap
+      // between the main thread and compositor thread.
+      AnimationHelper::SampleAnimations(mAnimStorage, *testingTimeStamp);
+      return;
+    }
   }
 
-  TimeStamp animTime = testingTimeStamp.valueOr(
-    !mPreviousFrameTimeStamp.IsNull()
-    ? mPreviousFrameTimeStamp
-    : mCompositorScheduler->GetLastComposeTime());
-
-
-  AnimationHelper::SampleAnimations(mAnimStorage, animTime);
+  TimeStamp lastComposeTime = mCompositorScheduler->GetLastComposeTime();
+  // if we have already mPreviousTimeStamp, use it since on the compositor the
+  // time in the previous tick is more closer to the main-thread tick time.
+  AnimationHelper::SampleAnimations(mAnimStorage,
+      !mPreviousFrameTimeStamp.IsNull()
+      ? mPreviousFrameTimeStamp
+      : lastComposeTime);
 
   // Reset the previous time stamp if we don't already have any running
   // animations to avoid using the time which is far behind for newly
   // started animations.
   mPreviousFrameTimeStamp =
-    mAnimStorage->AnimatedValueCount() ? animTime : TimeStamp();
+    mAnimStorage->AnimatedValueCount() ? lastComposeTime : TimeStamp();
 }
 
 void
 WebRenderBridgeParent::SampleAnimations(nsTArray<wr::WrOpacityProperty>& aOpacityArray,
                                         nsTArray<wr::WrTransformProperty>& aTransformArray)
 {
   AdvanceAnimations();