hwc: Proactively enable vsync on fps change.

-- SF would react to active config changes and enable vsync.
-- this can lead to one vsync delay in propagating event to SF.

CRs-Fixed: 2719462
Change-Id: I80251ec21911fc18c601795eaf8f4fe81fe237bd
diff --git a/composer/hwc_display_builtin.cpp b/composer/hwc_display_builtin.cpp
index bf3aeae..a289c9d 100644
--- a/composer/hwc_display_builtin.cpp
+++ b/composer/hwc_display_builtin.cpp
@@ -174,6 +174,11 @@
 
   DLOGI("active_refresh_rate: %d", active_refresh_rate_);
 
+  int enhance_idle_time = 0;
+  HWCDebugHandler::Get()->GetProperty(ENHANCE_IDLE_TIME, &enhance_idle_time);
+  enhance_idle_time_ = (enhance_idle_time == 1);
+  DLOGI("enhance_idle_time: %d", enhance_idle_time);
+
   return status;
 }
 
@@ -241,7 +246,8 @@
   bool vsync_source = (callbacks_->GetVsyncSource() == id_);
 
   if (error == kErrorNone) {
-    if (vsync_source && (current_refresh_rate_ < refresh_rate)) {
+    if (vsync_source && ((current_refresh_rate_ < refresh_rate) ||
+                         (enhance_idle_time_ && (current_refresh_rate_ != refresh_rate)))) {
       DTRACE_BEGIN("HWC2::Vsync::Enable");
       // Display is ramping up from idle.
       // Client realizes need for resync upon change in config.
diff --git a/composer/hwc_display_builtin.h b/composer/hwc_display_builtin.h
index 198d551..d1c5d40 100644
--- a/composer/hwc_display_builtin.h
+++ b/composer/hwc_display_builtin.h
@@ -225,6 +225,7 @@
   const char *kDisplayBwName = "display_bw";
   bool enable_bw_limits_ = false;
   bool disable_dyn_fps_ = false;
+  bool enhance_idle_time_ = false;
 };
 
 }  // namespace sdm
diff --git a/include/display_properties.h b/include/display_properties.h
index 9945118..b8a8b49 100644
--- a/include/display_properties.h
+++ b/include/display_properties.h
@@ -122,6 +122,7 @@
 #define DISABLE_INLINE_ROTATOR_UI_PROP       DISPLAY_PROP("disable_inline_rotator_ui")
 #define ENABLE_POMS_DURING_DOZE              DISPLAY_PROP("enable_poms_during_doze")
 #define DISABLE_DYNAMIC_FPS                  DISPLAY_PROP("disable_dynamic_fps")
+#define ENHANCE_IDLE_TIME                    DISPLAY_PROP("enhance_idle_time")
 
 // Add all vendor.display properties above