SF: Use default minimal refresh rate between frames
When calculating duplicate frames make sure the minimal period
is at least Fps(120).toPeriodNsecs(). It's not okay to use
min period equal to the max refresh rate at layer creation,
because the supported refresh rates can change. E.g. initially
it can be 24hz and later (bacause another display is plugged)
it can be 60hz, which will cause a lot of frames to be considered
as duplicates.
Bug: 159590486
Test: presubmit
Change-Id: I4424c05012925273ed6ea8254fb975bf8fe7d058
diff --git a/services/surfaceflinger/Scheduler/LayerInfo.cpp b/services/surfaceflinger/Scheduler/LayerInfo.cpp
index 1c0065c..4b2862e 100644
--- a/services/surfaceflinger/Scheduler/LayerInfo.cpp
+++ b/services/surfaceflinger/Scheduler/LayerInfo.cpp
@@ -33,10 +33,8 @@
const RefreshRateConfigs* LayerInfo::sRefreshRateConfigs = nullptr;
bool LayerInfo::sTraceEnabled = false;
-LayerInfo::LayerInfo(const std::string& name, nsecs_t highRefreshRatePeriod,
- LayerHistory::LayerVoteType defaultVote)
+LayerInfo::LayerInfo(const std::string& name, LayerHistory::LayerVoteType defaultVote)
: mName(name),
- mHighRefreshRatePeriod(highRefreshRatePeriod),
mDefaultVote(defaultVote),
mLayerVote({defaultVote, Fps(0.0f)}),
mRefreshRateHistory(name) {}
@@ -133,7 +131,7 @@
}
totalQueueTimeDeltas +=
- std::max(((it + 1)->queueTime - it->queueTime), mHighRefreshRatePeriod);
+ std::max(((it + 1)->queueTime - it->queueTime), kMinPeriodBetweenFrames);
numFrames++;
if (!missingPresentTime && (it->presetTime == 0 || (it + 1)->presetTime == 0)) {
@@ -147,7 +145,7 @@
}
totalPresentTimeDeltas +=
- std::max(((it + 1)->presetTime - it->presetTime), mHighRefreshRatePeriod);
+ std::max(((it + 1)->presetTime - it->presetTime), kMinPeriodBetweenFrames);
}
// Calculate the average frame time based on presentation timestamps. If those