FrameRateCategory::NoPreference votes Min
LayerVoteType::Min is a vote type that is ignored unless all voting
active layers also vote Min for minimum refresh rate.
Now the NoPreference category works for
infrequent animations such as a blinking cursor.
Bug: 298716564
Test: atest CtsSurfaceControlTestsStaging
Test: atest libsurfaceflinger_unittest
Change-Id: I970d59ff6499b9d64962361f3098d19b6b953d9c
diff --git a/services/surfaceflinger/Scheduler/LayerInfo.cpp b/services/surfaceflinger/Scheduler/LayerInfo.cpp
index e4df494..551d744 100644
--- a/services/surfaceflinger/Scheduler/LayerInfo.cpp
+++ b/services/surfaceflinger/Scheduler/LayerInfo.cpp
@@ -294,7 +294,7 @@
if (mLayerVote.category != FrameRateCategory::Default) {
ALOGV("%s uses frame rate category: %d", mName.c_str(),
static_cast<int>(mLayerVote.category));
- votes.push_back({LayerHistory::LayerVoteType::ExplicitCategory, mLayerVote.fps,
+ votes.push_back({LayerHistory::LayerVoteType::ExplicitCategory, Fps(),
Seamlessness::Default, mLayerVote.category});
}
diff --git a/services/surfaceflinger/Scheduler/RefreshRateSelector.cpp b/services/surfaceflinger/Scheduler/RefreshRateSelector.cpp
index 7e77bbe..be28e98 100644
--- a/services/surfaceflinger/Scheduler/RefreshRateSelector.cpp
+++ b/services/surfaceflinger/Scheduler/RefreshRateSelector.cpp
@@ -501,6 +501,12 @@
break;
case LayerVoteType::ExplicitCategory:
explicitCategoryVoteLayers++;
+ if (layer.frameRateCategory == FrameRateCategory::NoPreference) {
+ // Count this layer for Min vote as well. The explicit vote avoids
+ // touch boost and idle for choosing a category, while Min vote is for correct
+ // behavior when all layers are Min or no vote.
+ minVoteLayers++;
+ }
break;
case LayerVoteType::Heuristic:
break;