Add shouldBeSeamless to setFrameRate
This CL adds a new parameter shouldBeSeamless to the existing
setFrameRate APIs. This parameter indicates whether the desired
refresh rate should be achieved only seamlessly or also switches
with visual interruptions for the user are allowed. The default
value of the new parameter is "true".
Test: atest RefreshRateConfigsTest
Test: atest SetFrameRateTest
Test: atest libsurfaceflinger_unittest
Test: atest libgui_test
Bug: 161776961
Change-Id: I0df16e09f77c8c198fd3733fb581a2aaadfed685
diff --git a/services/surfaceflinger/Scheduler/LayerHistoryV2.cpp b/services/surfaceflinger/Scheduler/LayerHistoryV2.cpp
index 37e67e1..a63ccc1 100644
--- a/services/surfaceflinger/Scheduler/LayerHistoryV2.cpp
+++ b/services/surfaceflinger/Scheduler/LayerHistoryV2.cpp
@@ -130,9 +130,9 @@
ALOGV("%s has priority: %d %s focused", strong->getName().c_str(),
frameRateSelectionPriority, layerFocused ? "" : "not");
- const auto [type, refreshRate] = info->getRefreshRate(now);
+ const auto vote = info->getRefreshRateVote(now);
// Skip NoVote layer as those don't have any requirements
- if (type == LayerHistory::LayerVoteType::NoVote) {
+ if (vote.type == LayerHistory::LayerVoteType::NoVote) {
continue;
}
@@ -144,10 +144,11 @@
const float layerArea = transformed.getWidth() * transformed.getHeight();
float weight = mDisplayArea ? layerArea / mDisplayArea : 0.0f;
- summary.push_back({strong->getName(), type, refreshRate, weight, layerFocused});
+ summary.push_back({strong->getName(), vote.type, vote.fps, vote.shouldBeSeamless, weight,
+ layerFocused});
if (CC_UNLIKELY(mTraceEnabled)) {
- trace(layer, *info, type, static_cast<int>(std::round(refreshRate)));
+ trace(layer, *info, vote.type, static_cast<int>(std::round(vote.fps)));
}
}
@@ -178,7 +179,7 @@
if (frameRate.rate > 0 || voteType == LayerVoteType::NoVote) {
const auto type = layer->isVisible() ? voteType : LayerVoteType::NoVote;
- info->setLayerVote(type, frameRate.rate);
+ info->setLayerVote({type, frameRate.rate, frameRate.shouldBeSeamless});
} else {
info->resetLayerVote();
}