SurfaceFlinger: use intended wake up time when calculating next present time
If SurfaceFlinger wakes up too late (due to the main thread being busy)
it may calculate a wrong presentation time as it is based on the wake up time.
Instead, cache the intended wake up time and use it as the base time.
Change-Id: I84c37bd5f164fbdef3151c0898d3cea624cea515
Bug: 154199567
Test: collect systrace for launcher scrolling
diff --git a/services/surfaceflinger/tests/unittests/CompositionTest.cpp b/services/surfaceflinger/tests/unittests/CompositionTest.cpp
index 2dcaf63..4b70707 100644
--- a/services/surfaceflinger/tests/unittests/CompositionTest.cpp
+++ b/services/surfaceflinger/tests/unittests/CompositionTest.cpp
@@ -141,10 +141,10 @@
auto primaryDispSync = std::make_unique<mock::DispSync>();
- EXPECT_CALL(*primaryDispSync, computeNextRefresh(0)).WillRepeatedly(Return(0));
+ EXPECT_CALL(*primaryDispSync, computeNextRefresh(0, _)).WillRepeatedly(Return(0));
EXPECT_CALL(*primaryDispSync, getPeriod())
.WillRepeatedly(Return(FakeHwcDisplayInjector::DEFAULT_REFRESH_RATE));
- EXPECT_CALL(*primaryDispSync, expectedPresentTime()).WillRepeatedly(Return(0));
+ EXPECT_CALL(*primaryDispSync, expectedPresentTime(_)).WillRepeatedly(Return(0));
mFlinger.setupScheduler(std::move(primaryDispSync),
std::make_unique<mock::EventControlThread>(),