DO NOT MERGE Extend mPreviousPresentFences for high refresh rate

To provide hardware enough time to display a frame under high refresh
rate with long sf-duration, we extend mPreviousPresentFences by storing
extra slots. We check proper present fence at different moment
according to vsync period and sf-duration.

Bug: 241193992
Change-Id: I618dd7abdb1f9ca2cb92623cc4d423389d62e402
diff --git a/services/surfaceflinger/SurfaceFlinger.h b/services/surfaceflinger/SurfaceFlinger.h
index f14c755..46f0e6b 100644
--- a/services/surfaceflinger/SurfaceFlinger.h
+++ b/services/surfaceflinger/SurfaceFlinger.h
@@ -1224,7 +1224,8 @@
     std::unordered_set<sp<Layer>, SpHash<Layer>> mLayersWithQueuedFrames;
     // Tracks layers that need to update a display's dirty region.
     std::vector<sp<Layer>> mLayersPendingRefresh;
-    std::array<FenceWithFenceTime, 2> mPreviousPresentFences;
+    // size should be longest sf-duration / shortest vsync period and round up
+    std::array<FenceWithFenceTime, 5> mPreviousPresentFences; // currently consider 166hz.
     // True if in the previous frame at least one layer was composed via the GPU.
     bool mHadClientComposition = false;
     // True if in the previous frame at least one layer was composed via HW Composer.