Skip to content

Commit 3856ed1

Browse files
author
ramindani
committed
[SF] VSync predictor recovery only for the ARR
Test: atest VSyncPredictorTest BUG: 399209142 BUG: 385059265 Flag: com.android.graphics.surfaceflinger.flags.vsync_predictor_recovery Change-Id: I6090cf90cecdac3ed42c9eeb872e0dbcb0cb68c9
1 parent e1679f7 commit 3856ed1

2 files changed

Lines changed: 2 additions & 33 deletions

File tree

services/surfaceflinger/Scheduler/VSyncPredictor.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,8 @@ bool VSyncPredictor::addVsyncTimestamp(nsecs_t timestamp) {
208208
auto it = mRateMap.find(idealPeriod());
209209
// Calculated slope over the period of time can become outdated as the new timestamps are
210210
// stored. Using idealPeriod instead provides a rate which is valid at all the times.
211-
auto const currentPeriod = FlagManager::getInstance().vsync_predictor_recovery()
211+
auto const currentPeriod =
212+
mDisplayModePtr->getVrrConfig() && FlagManager::getInstance().vsync_predictor_recovery()
212213
? idealPeriod()
213214
: it->second.slope;
214215

services/surfaceflinger/tests/unittests/VSyncPredictorTest.cpp

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -444,40 +444,8 @@ TEST_F(VSyncPredictorTest, idealModelPredictionsBeforeRegressionModelIsBuilt) {
444444
}
445445
}
446446

447-
TEST_F(VSyncPredictorTest, doesNotPredictBeforeTimePointWithHigherIntercept_withPredictorRecovery) {
448-
SET_FLAG_FOR_TEST(flags::vsync_predictor_recovery, true);
449-
std::vector<nsecs_t> const simulatedVsyncs{
450-
158929578733000,
451-
158929306806205, // oldest TS in ringbuffer
452-
158929650879052,
453-
158929661969209,
454-
158929684198847,
455-
158929695268171,
456-
158929706370359,
457-
};
458-
auto const idealPeriod = 11111111;
459-
auto const expectedPeriod = 11079563;
460-
auto const expectedIntercept = 1335662;
461-
462-
tracker.setDisplayModePtr(displayMode(idealPeriod));
463-
for (auto const& timestamp : simulatedVsyncs) {
464-
tracker.addVsyncTimestamp(timestamp);
465-
}
466-
467-
auto [slope, intercept] = tracker.getVSyncPredictionModel();
468-
EXPECT_THAT(slope, IsCloseTo(expectedPeriod, mMaxRoundingError));
469-
EXPECT_THAT(intercept, IsCloseTo(expectedIntercept, mMaxRoundingError));
470-
471-
// (timePoint - oldestTS) % expectedPeriod works out to be: 894272
472-
// (timePoint - oldestTS) / expectedPeriod works out to be: 38.08
473-
auto const timePoint = 158929728723871;
474-
auto const prediction = tracker.nextAnticipatedVSyncTimeFrom(timePoint);
475-
EXPECT_THAT(prediction, Ge(timePoint));
476-
}
477-
478447
// See b/145667109, and comment in prod code under test.
479448
TEST_F(VSyncPredictorTest, doesNotPredictBeforeTimePointWithHigherIntercept) {
480-
SET_FLAG_FOR_TEST(flags::vsync_predictor_recovery, false);
481449
std::vector<nsecs_t> const simulatedVsyncs{
482450
158929578733000,
483451
158929306806205, // oldest TS in ringbuffer

0 commit comments

Comments
 (0)