drm_hwcomposer: Simplify default vsync period

VSyncWorker::SetVsyncPeriod won't be called with a value of 0, so the
only time the internal vsync period will be zero is if SetVsyncPeriod
was not called.

Set the 60Hz vsync period as a default value, and let the synthetic
vsync code expect it to be set to a reasonable value.

Change-Id: Ie1f83b0c11504acf304cc241923bfa60a5ffd647
Signed-off-by: Drew Davenport <ddavenport@google.com>
diff --git a/hwc2_device/HwcDisplay.cpp b/hwc2_device/HwcDisplay.cpp
index f3c0fa0..2260e36 100644
--- a/hwc2_device/HwcDisplay.cpp
+++ b/hwc2_device/HwcDisplay.cpp
@@ -680,7 +680,7 @@
   uint32_t prev_vperiod_ns = 0;
   GetDisplayVsyncPeriod(&prev_vperiod_ns);
 
-  auto mode_update_commited_ = false;
+  std::optional<uint32_t> new_vsync_period_ns;
   if (staged_mode_config_id_ &&
       staged_mode_change_time_ <= ResourceManager::GetTimeMonotonicNs()) {
     const HwcDisplayConfig *staged_config = GetConfig(
@@ -697,7 +697,7 @@
     configs_.active_config_id = staged_mode_config_id_.value();
     a_args.display_mode = staged_config->mode;
     if (!a_args.test_only) {
-      mode_update_commited_ = true;
+      new_vsync_period_ns = staged_config->mode.GetVSyncPeriodNs();
     }
   }
 
@@ -773,12 +773,8 @@
     return HWC2::Error::BadParameter;
   }
 
-  if (mode_update_commited_) {
-    const HwcDisplayConfig *new_config = GetCurrentConfig();
-    uint32_t new_vsync_period_ns = new_config
-                                       ? new_config->mode.GetVSyncPeriodNs()
-                                       : 0;
-    vsync_worker_->SetVsyncPeriodNs(new_vsync_period_ns);
+  if (new_vsync_period_ns) {
+    vsync_worker_->SetVsyncPeriodNs(new_vsync_period_ns.value());
     staged_mode_config_id_.reset();
     vsync_tracking_en_ = false;
     if (last_vsync_ts_ != 0) {