Loading services/surfaceflinger/Scheduler/VSyncPredictor.cpp +10 −6 Original line number Diff line number Diff line Loading @@ -111,16 +111,20 @@ bool VSyncPredictor::validate(nsecs_t timestamp) const { return false; } const auto isThresholdEnabled = FlagManager::getInstance().vsync_predictor_predicts_within_threshold() && mDisplayModePtr->getVrrConfig(); const auto iter = std::min_element(mTimestamps.begin(), mTimestamps.end(), [timestamp, this](nsecs_t a, nsecs_t b) { [=, this](nsecs_t a, nsecs_t b) { nsecs_t diffA = std::abs(timestamp - a); nsecs_t diffB = std::abs(timestamp - b); if (isThresholdEnabled) { bool withinThresholdA = diffA <= kPredictorThreshold; bool withinThresholdB = diffB <= kPredictorThreshold; if (withinThresholdA != withinThresholdB) { return withinThresholdA; } } return diffA < diffB; }); const auto distancePercent = std::abs(*iter - timestamp) * kMaxPercent / idealPeriod(); Loading Loading
services/surfaceflinger/Scheduler/VSyncPredictor.cpp +10 −6 Original line number Diff line number Diff line Loading @@ -111,16 +111,20 @@ bool VSyncPredictor::validate(nsecs_t timestamp) const { return false; } const auto isThresholdEnabled = FlagManager::getInstance().vsync_predictor_predicts_within_threshold() && mDisplayModePtr->getVrrConfig(); const auto iter = std::min_element(mTimestamps.begin(), mTimestamps.end(), [timestamp, this](nsecs_t a, nsecs_t b) { [=, this](nsecs_t a, nsecs_t b) { nsecs_t diffA = std::abs(timestamp - a); nsecs_t diffB = std::abs(timestamp - b); if (isThresholdEnabled) { bool withinThresholdA = diffA <= kPredictorThreshold; bool withinThresholdB = diffB <= kPredictorThreshold; if (withinThresholdA != withinThresholdB) { return withinThresholdA; } } return diffA < diffB; }); const auto distancePercent = std::abs(*iter - timestamp) * kMaxPercent / idealPeriod(); Loading