SurfaceFlinger: tree vote for FrameRateCompatibility::ExactOrMultiple
Layers that voted with FrameRateCompatibility::ExactOrMultiple
will still allow touch boost as those layers are typically not
interactive and therefore touch is probably meant for a different
layer. For the same reasoning, we should continue to heuristically
calculate frame rate for layers in the same tree.
Bug: 157254751
Test: run Swappy with statistics overlay and observe refresh rate
Test: run YouTube, play a video, scrolling the recommended videos and observe refresh rate
Change-Id: I9311512a663eba61dfcae6277a52c077e135a244
diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp
index 17458e3..5b9dbf2 100644
--- a/services/surfaceflinger/Layer.cpp
+++ b/services/surfaceflinger/Layer.cpp
@@ -1353,8 +1353,15 @@
// First traverse the tree and count how many layers has votes
int layersWithVote = 0;
traverseTree([&layersWithVote](Layer* layer) {
- if (layer->mCurrentState.frameRate.rate > 0 ||
- layer->mCurrentState.frameRate.type == FrameRateCompatibility::NoVote) {
+ const auto layerVotedWithDefaultCompatibility = layer->mCurrentState.frameRate.rate > 0 &&
+ layer->mCurrentState.frameRate.type == FrameRateCompatibility::Default;
+ const auto layerVotedWithNoVote =
+ layer->mCurrentState.frameRate.type == FrameRateCompatibility::NoVote;
+
+ // We do not count layers that are ExactOrMultiple for the same reason
+ // we are allowing touch boost for those layers. See
+ // RefreshRateConfigs::getBestRefreshRate for more details.
+ if (layerVotedWithDefaultCompatibility || layerVotedWithNoVote) {
layersWithVote++;
}
});