VRR: Allowlist for small area detection
Add a allowlist mechanism for suppress frame rate when small area.
In this patch, we will keep a array list to record pkg name which
want to apply the small area detection for suppressing frame rate
and its threshold value of small area ratio.
In framewokr, we will check the all pkg uid by pkg name from
package manager and call a native function which include uid and
threshold.
In SF native, it get the threshold of uid and we will save them
as a map, and it will used to check should it apply small area
detection and what threshold it should use.
Bug: 281720315
Test: atest SmallAreaDetectionMappingsTest
Test: atest LayerHistoryTest
Change-Id: Iaf6c0090f9db499fc5ed097b2d3c6d9d871d4812
diff --git a/services/surfaceflinger/Scheduler/Scheduler.h b/services/surfaceflinger/Scheduler/Scheduler.h
index ec20610..d65df2a 100644
--- a/services/surfaceflinger/Scheduler/Scheduler.h
+++ b/services/surfaceflinger/Scheduler/Scheduler.h
@@ -49,6 +49,7 @@
#include "MessageQueue.h"
#include "OneShotTimer.h"
#include "RefreshRateSelector.h"
+#include "SmallAreaDetectionAllowMappings.h"
#include "Utils/Dumper.h"
#include "VsyncModulator.h"
@@ -291,6 +292,13 @@
void setGameModeRefreshRateForUid(FrameRateOverride);
+ void updateSmallAreaDetection(std::vector<std::pair<uid_t, float>>& uidThresholdMappings);
+
+ void setSmallAreaDetectionThreshold(uid_t uid, float threshold);
+
+ // Returns true if the dirty area is less than threshold.
+ bool isSmallDirtyArea(uid_t uid, uint32_t dirtyArea);
+
// Retrieves the overridden refresh rate for a given uid.
std::optional<Fps> getFrameRateOverride(uid_t) const EXCLUDES(mDisplayLock);
@@ -314,11 +322,6 @@
return mFeatures.test(Feature::kSmallDirtyContentDetection);
}
- // Returns true if the dirty area is less than threshold.
- bool isSmallDirtyArea(uint32_t dirtyArea) const {
- return mLayerHistory.isSmallDirtyArea(dirtyArea);
- }
-
private:
friend class TestableScheduler;
@@ -557,6 +560,7 @@
static constexpr std::chrono::nanoseconds MAX_VSYNC_APPLIED_TIME = 200ms;
FrameRateOverrideMappings mFrameRateOverrideMappings;
+ SmallAreaDetectionAllowMappings mSmallAreaDetectionAllowMappings;
};
} // namespace scheduler