hwcomposer2: add api to control vsync period
Add new functions to improve vsync period switching by the platform:
- Adding a list of supported vsync periods to hwc2_config_t to avoid the need to expose
separate hwc2_config_t for each vsync period.
- Adding an API to set the vsync period with timeline constraints to allow better
synchronization with vsync period change.
- Extending HWC2_CALLBACK_VSYNC callback to provide the current vsync period.
Test: rev up composer to 2.4 and test refresh rate switching
Bug: 141329414
Change-Id: I0e3371dc41c4fbcf97073a120307f7a8923c9325
diff --git a/include/hardware/hwcomposer_defs.h b/include/hardware/hwcomposer_defs.h
index fd373e3..8ca474b 100644
--- a/include/hardware/hwcomposer_defs.h
+++ b/include/hardware/hwcomposer_defs.h
@@ -299,6 +299,17 @@
HWC_POWER_MODE_DOZE_SUSPEND = 3,
};
+/* Constraints for changing vsync period */
+typedef struct hwc_vsync_period_change_constraints {
+ /* Time in CLOCK_MONOTONIC after which the vsync period may change
+ * (i.e., the vsync period must not change before this time). */
+ int64_t desiredTimeNanos;
+ /*
+ * If true, requires that the vsync period change must happen seamlessly without
+ * a noticeable visual artifact. */
+ uint8_t seamlessRequired;
+} hwc_vsync_period_change_constraints_t;
+
/*****************************************************************************/
__END_DECLS