HighHint touch boost fix re. frame rate override
Fix HighHint touch boost regarding frame rate override. The
touch boost logic in getFrameRateOverrides should mirror frame rate
selection in getRankedFrameRates. We decided earlier that HighHint is
only ignored when there are ExplicitDefault compatibility votes.
Bug: 326666127
Test: atest libsurfaceflinger_unittest
Test: jank test cases + manual
Change-Id: I54ac61f2a174b9a4dea7d67d8b196217b4f60921
diff --git a/services/surfaceflinger/Scheduler/RefreshRateSelector.cpp b/services/surfaceflinger/Scheduler/RefreshRateSelector.cpp
index 93350b5..ffd3463 100644
--- a/services/surfaceflinger/Scheduler/RefreshRateSelector.cpp
+++ b/services/surfaceflinger/Scheduler/RefreshRateSelector.cpp
@@ -948,17 +948,43 @@
const auto layersByUid = groupLayersByUid(layers);
UidToFrameRateOverride frameRateOverrides;
for (const auto& [uid, layersWithSameUid] : layersByUid) {
- // Layers with ExplicitExactOrMultiple expect touch boost
- const bool hasExplicitExactOrMultiple =
- std::any_of(layersWithSameUid.cbegin(), layersWithSameUid.cend(),
- [](const auto& layer) {
- return layer->vote == LayerVoteType::ExplicitExactOrMultiple;
- });
+ // Look for cases that should not have frame rate overrides.
+ bool hasExplicitExactOrMultiple = false;
+ bool hasExplicitDefault = false;
+ bool hasHighHint = false;
+ for (const auto& layer : layersWithSameUid) {
+ switch (layer->vote) {
+ case LayerVoteType::ExplicitExactOrMultiple:
+ hasExplicitExactOrMultiple = true;
+ break;
+ case LayerVoteType::ExplicitDefault:
+ hasExplicitDefault = true;
+ break;
+ case LayerVoteType::ExplicitCategory:
+ if (layer->frameRateCategory == FrameRateCategory::HighHint) {
+ hasHighHint = true;
+ }
+ break;
+ default:
+ // No action
+ break;
+ }
+ if (hasExplicitExactOrMultiple && hasExplicitDefault && hasHighHint) {
+ break;
+ }
+ }
+ // Layers with ExplicitExactOrMultiple expect touch boost
if (globalSignals.touch && hasExplicitExactOrMultiple) {
continue;
}
+ // Mirrors getRankedFrameRates. If there is no ExplicitDefault, expect touch boost and
+ // skip frame rate override.
+ if (hasHighHint && !hasExplicitDefault) {
+ continue;
+ }
+
for (auto& [_, score] : scoredFrameRates) {
score = 0;
}