SF: update consistent criteria for heuristic refresh rate calculation
Enlarge the consistent criteria to apply heuristic logic for more cases.
To prevent introducing oscillation, this makes sure to only select a
valid know refresh rate if all the frametime in the layer history have
the same nearest known refresh rate.
Bug: 299201319
Test: presubmit
Change-Id: Ie317f7fe337c84c2c7314069cba1bd02a147bf6b
diff --git a/services/surfaceflinger/common/FlagManager.cpp b/services/surfaceflinger/common/FlagManager.cpp
index e2a1498..35dd428 100644
--- a/services/surfaceflinger/common/FlagManager.cpp
+++ b/services/surfaceflinger/common/FlagManager.cpp
@@ -121,6 +121,7 @@
DUMP_READ_ONLY_FLAG(hdcp_level_hal);
DUMP_READ_ONLY_FLAG(multithreaded_present);
DUMP_READ_ONLY_FLAG(add_sf_skipped_frames_to_trace);
+ DUMP_READ_ONLY_FLAG(use_known_refresh_rate_for_fps_consistency);
#undef DUMP_READ_ONLY_FLAG
#undef DUMP_SERVER_FLAG
@@ -190,6 +191,7 @@
FLAG_MANAGER_READ_ONLY_FLAG(hdcp_level_hal, "")
FLAG_MANAGER_READ_ONLY_FLAG(multithreaded_present, "debug.sf.multithreaded_present")
FLAG_MANAGER_READ_ONLY_FLAG(add_sf_skipped_frames_to_trace, "")
+FLAG_MANAGER_READ_ONLY_FLAG(use_known_refresh_rate_for_fps_consistency, "")
/// Trunk stable server flags ///
FLAG_MANAGER_SERVER_FLAG(late_boot_misc2, "")
diff --git a/services/surfaceflinger/common/include/common/FlagManager.h b/services/surfaceflinger/common/include/common/FlagManager.h
index 9aabbb9..6d5846a 100644
--- a/services/surfaceflinger/common/include/common/FlagManager.h
+++ b/services/surfaceflinger/common/include/common/FlagManager.h
@@ -60,6 +60,7 @@
bool hdcp_level_hal() const;
bool multithreaded_present() const;
bool add_sf_skipped_frames_to_trace() const;
+ bool use_known_refresh_rate_for_fps_consistency() const;
protected:
// overridden for unit tests