drm_hwcomposer: Deprecate usage of HWC2 GetDisplayVsyncPeriod

Add an interface to HwcDisplay to query which HwcDisplayConfig is
currently committed in the kernel. Use this to implement
getDisplayVsyncPeriod.

Change-Id: Ie57759f22c012ab331ad0187043a4bea598cba78
Signed-off-by: Drew Davenport <ddavenport@google.com>
diff --git a/hwc2_device/HwcDisplay.cpp b/hwc2_device/HwcDisplay.cpp
index 51694c2..0ab43f9 100644
--- a/hwc2_device/HwcDisplay.cpp
+++ b/hwc2_device/HwcDisplay.cpp
@@ -96,6 +96,14 @@
   Deinit();
 };
 
+const HwcDisplayConfig *HwcDisplay::GetCurrentConfig() const {
+  auto config_iter = configs_.hwc_configs.find(configs_.active_config_id);
+  if (config_iter == configs_.hwc_configs.end()) {
+    return nullptr;
+  }
+  return &config_iter->second;
+}
+
 void HwcDisplay::SetPipeline(std::shared_ptr<DrmDisplayPipeline> pipeline) {
   Deinit();
 
diff --git a/hwc2_device/HwcDisplay.h b/hwc2_device/HwcDisplay.h
index 4680ca9..7cdc0b8 100644
--- a/hwc2_device/HwcDisplay.h
+++ b/hwc2_device/HwcDisplay.h
@@ -59,6 +59,9 @@
     return configs_;
   }
 
+  // Get the config representing the mode that has been committed to KMS.
+  const HwcDisplayConfig *GetCurrentConfig() const;
+
   // HWC2 Hooks - these should not be used outside of the hwc2 device.
   HWC2::Error AcceptDisplayChanges();
   HWC2::Error CreateLayer(hwc2_layer_t *layer);