Revert "SurfaceFlinger: tune infrequent detection logic more"
This reverts commit 39db2c9b075964d28818f187ba417dc13698b680.
Reason for revert: Causing regression with b/157096772
Change-Id: I058d6f8efa637cb36371276761281f51b7aa3dd3
Test: Play 24fps video in YouTube PIP mode and rotate the device - no jank
Test: Chrome playing video - no refresh rate switching
Test: Hide/Show keyboard when inputting text
Test: Running Hay Day and observing refresh rate
Bug: 157096772
diff --git a/services/surfaceflinger/Scheduler/LayerInfoV2.cpp b/services/surfaceflinger/Scheduler/LayerInfoV2.cpp
index 78f4433..c16387a 100644
--- a/services/surfaceflinger/Scheduler/LayerInfoV2.cpp
+++ b/services/surfaceflinger/Scheduler/LayerInfoV2.cpp
@@ -50,28 +50,23 @@
}
}
-bool LayerInfoV2::isFrequent(nsecs_t now) {
- mLastReportedIsFrequent = [&] {
- for (auto it = mFrameTimes.crbegin(); it != mFrameTimes.crend(); ++it) {
- if (now - it->queueTime >= MAX_FREQUENT_LAYER_PERIOD_NS.count()) {
- ALOGV("%s infrequent (last frame is %.2fms ago)", mName.c_str(),
- (now - mFrameTimes.back().queueTime) / 1e6f);
- return false;
- }
-
- const auto numFrames = std::distance(mFrameTimes.crbegin(), it + 1);
- if (numFrames >= FREQUENT_LAYER_WINDOW_SIZE) {
- ALOGV("%s frequent (burst of %zu frames)", mName.c_str(), numFrames);
- return true;
- }
+bool LayerInfoV2::isFrequent(nsecs_t now) const {
+ for (auto it = mFrameTimes.crbegin(); it != mFrameTimes.crend(); ++it) {
+ if (now - it->queueTime >= MAX_FREQUENT_LAYER_PERIOD_NS.count()) {
+ ALOGV("%s infrequent (last frame is %.2fms ago", mName.c_str(),
+ (now - mFrameTimes.back().queueTime) / 1e6f);
+ return false;
}
- ALOGV("%s %sfrequent (not enough frames %zu)", mName.c_str(),
- mLastReportedIsFrequent ? "" : "in", mFrameTimes.size());
- return mLastReportedIsFrequent;
- }();
+ const auto numFrames = std::distance(mFrameTimes.crbegin(), it + 1);
+ if (numFrames >= FREQUENT_LAYER_WINDOW_SIZE) {
+ ALOGV("%s frequent (burst of %zu frames", mName.c_str(), numFrames);
+ return true;
+ }
+ }
- return mLastReportedIsFrequent;
+ ALOGV("%s infrequent (not enough frames %zu)", mName.c_str(), mFrameTimes.size());
+ return false;
}
bool LayerInfoV2::hasEnoughDataForHeuristic() const {