Loading services/surfaceflinger/Scheduler/VSyncPredictor.cpp +6 −2 Original line number Diff line number Diff line Loading @@ -77,8 +77,12 @@ bool VSyncPredictor::addVsyncTimestamp(nsecs_t timestamp) { if (!validate(timestamp)) { // VSR could elect to ignore the incongruent timestamp or resetModel(). If ts is ignored, // don't insert this ts into mTimestamps ringbuffer. if (!mTimestamps.empty()) { // don't insert this ts into mTimestamps ringbuffer. If we are still // in the learning phase we should just clear all timestamps and start // over. if (mTimestamps.size() < kMinimumSamplesForPrediction) { clearTimestamps(); } else if (!mTimestamps.empty()) { mKnownTimestamp = std::max(timestamp, *std::max_element(mTimestamps.begin(), mTimestamps.end())); } else { Loading services/surfaceflinger/tests/unittests/VSyncPredictorTest.cpp +14 −0 Original line number Diff line number Diff line Loading @@ -475,6 +475,20 @@ TEST_F(VSyncPredictorTest, isVSyncInPhase) { } } TEST_F(VSyncPredictorTest, InconsistentVsyncValueIsFlushedEventually) { EXPECT_TRUE(tracker.addVsyncTimestamp(600)); EXPECT_TRUE(tracker.needsMoreSamples()); EXPECT_FALSE(tracker.addVsyncTimestamp(mNow += mPeriod)); for (auto i = 0u; i < kMinimumSamplesForPrediction; i++) { EXPECT_TRUE(tracker.needsMoreSamples()); EXPECT_TRUE(tracker.addVsyncTimestamp(mNow += mPeriod)); } EXPECT_FALSE(tracker.needsMoreSamples()); } } // namespace android::scheduler // TODO(b/129481165): remove the #pragma below and fix conversion issues Loading Loading
services/surfaceflinger/Scheduler/VSyncPredictor.cpp +6 −2 Original line number Diff line number Diff line Loading @@ -77,8 +77,12 @@ bool VSyncPredictor::addVsyncTimestamp(nsecs_t timestamp) { if (!validate(timestamp)) { // VSR could elect to ignore the incongruent timestamp or resetModel(). If ts is ignored, // don't insert this ts into mTimestamps ringbuffer. if (!mTimestamps.empty()) { // don't insert this ts into mTimestamps ringbuffer. If we are still // in the learning phase we should just clear all timestamps and start // over. if (mTimestamps.size() < kMinimumSamplesForPrediction) { clearTimestamps(); } else if (!mTimestamps.empty()) { mKnownTimestamp = std::max(timestamp, *std::max_element(mTimestamps.begin(), mTimestamps.end())); } else { Loading
services/surfaceflinger/tests/unittests/VSyncPredictorTest.cpp +14 −0 Original line number Diff line number Diff line Loading @@ -475,6 +475,20 @@ TEST_F(VSyncPredictorTest, isVSyncInPhase) { } } TEST_F(VSyncPredictorTest, InconsistentVsyncValueIsFlushedEventually) { EXPECT_TRUE(tracker.addVsyncTimestamp(600)); EXPECT_TRUE(tracker.needsMoreSamples()); EXPECT_FALSE(tracker.addVsyncTimestamp(mNow += mPeriod)); for (auto i = 0u; i < kMinimumSamplesForPrediction; i++) { EXPECT_TRUE(tracker.needsMoreSamples()); EXPECT_TRUE(tracker.addVsyncTimestamp(mNow += mPeriod)); } EXPECT_FALSE(tracker.needsMoreSamples()); } } // namespace android::scheduler // TODO(b/129481165): remove the #pragma below and fix conversion issues Loading