drm_hwcomposer: Use single VSyncWorker per display
Composer 2.4 will require another vsyncworker callback to send
VsyncPeriodTimingChanged event. It makes sence to use single
VSyncWorker and flags to indicate which actions are required
to perform. This should also save some runtime resources.
Signed-off-by: Roman Stratiienko <roman.o.stratiienko@globallogic.com>
diff --git a/hwc2_device/DrmHwcTwo.cpp b/hwc2_device/DrmHwcTwo.cpp
index 2002b85..37901ee 100644
--- a/hwc2_device/DrmHwcTwo.cpp
+++ b/hwc2_device/DrmHwcTwo.cpp
@@ -203,4 +203,21 @@
}
}
+void DrmHwcTwo::SendVsyncEventToClient(
+ hwc2_display_t displayid, int64_t timestamp,
+ [[maybe_unused]] uint32_t vsync_period) const {
+ /* vsync callback */
+#if PLATFORM_SDK_VERSION > 29
+ if (vsync_2_4_callback_.first != nullptr &&
+ vsync_2_4_callback_.second != nullptr) {
+ vsync_2_4_callback_.first(vsync_2_4_callback_.second, displayid, timestamp,
+ vsync_period);
+ } else
+#endif
+ if (vsync_callback_.first != nullptr &&
+ vsync_callback_.second != nullptr) {
+ vsync_callback_.first(vsync_callback_.second, displayid, timestamp);
+ }
+}
+
} // namespace android