Skip record layer when setting category on MRR
When dVRR features are guarded from MRR devices,
skips recording the layer history for MRR devices when setting dVRR
feature's vote types.
This avoids unnecessary activity such as when frame rate category
changes (a dVRR vote type) on MRR devices.
Bug: 330224639
Test: atest FrameRateOverrideTest
Test: atest libsurfaceflinger_unittest
Change-Id: I2aabefd177fddc5f91f238baceb88db339728058
diff --git a/services/surfaceflinger/Scheduler/Scheduler.cpp b/services/surfaceflinger/Scheduler/Scheduler.cpp
index 7968096..32279ae 100644
--- a/services/surfaceflinger/Scheduler/Scheduler.cpp
+++ b/services/surfaceflinger/Scheduler/Scheduler.cpp
@@ -675,7 +675,13 @@
void Scheduler::recordLayerHistory(int32_t id, const LayerProps& layerProps, nsecs_t presentTime,
nsecs_t now, LayerHistory::LayerUpdateType updateType) {
- if (pacesetterSelectorPtr()->canSwitch()) {
+ const auto& selectorPtr = pacesetterSelectorPtr();
+ // Skip recording layer history on LayerUpdateType::SetFrameRate for MRR devices when the
+ // dVRR vote types are guarded (disabled) for MRR. This is to avoid activity when setting dVRR
+ // vote types.
+ if (selectorPtr->canSwitch() &&
+ (updateType != LayerHistory::LayerUpdateType::SetFrameRate ||
+ layerProps.setFrameRateVote.isVoteValidForMrr(selectorPtr->isVrrDevice()))) {
mLayerHistory.record(id, layerProps, presentTime, now, updateType);
}
}