composer 2.4: 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 Config to avoid the need to expose
separate Configs for each vsync period.
- Adding an API to set the vsync period with timeline constraints to allow better
synchronization with vsync period change.
- Extending onVsync() callback to provide the current vsync period.
Test: rev up composer to 2.4 and test refresh rate switching
Bug: 141329414
Change-Id: I1a6f395d9634edadc68649d02f624f00173ec519
diff --git a/graphics/composer/2.4/utils/vts/ComposerVts.cpp b/graphics/composer/2.4/utils/vts/ComposerVts.cpp
index 937b50e..b02a59a 100644
--- a/graphics/composer/2.4/utils/vts/ComposerVts.cpp
+++ b/graphics/composer/2.4/utils/vts/ComposerVts.cpp
@@ -25,7 +25,7 @@
namespace V2_4 {
namespace vts {
-using V2_1::Error;
+using V2_4::Error;
Composer::Composer() : Composer(::testing::VtsHalHidlTargetTestBase::getService<IComposer>()) {}
@@ -70,6 +70,40 @@
return error;
}
+Error ComposerClient::getSupportedDisplayVsyncPeriods(
+ Display display, Config config, std::vector<VsyncPeriodNanos>* outSupportedVsyncPeriods) {
+ Error error = Error::NONE;
+ mClient->getSupportedDisplayVsyncPeriods(
+ display, config, [&](const auto& tmpError, const auto& tmpSupportedVsyncPeriods) {
+ error = tmpError;
+ *outSupportedVsyncPeriods = tmpSupportedVsyncPeriods;
+ });
+ return error;
+}
+
+Error ComposerClient::getDisplayVsyncPeriod(Display display, VsyncPeriodNanos* outVsyncPeriod) {
+ Error error = Error::NONE;
+ mClient->getDisplayVsyncPeriod(display, [&](const auto& tmpError, const auto& tmpVsyncPeriod) {
+ error = tmpError;
+ *outVsyncPeriod = tmpVsyncPeriod;
+ });
+ return error;
+}
+
+Error ComposerClient::setActiveConfigAndVsyncPeriod(
+ Display display, Config config, VsyncPeriodNanos vsyncPeriodNanos,
+ const IComposerClient::VsyncPeriodChangeConstraints& vsyncPeriodChangeConstraints,
+ int64_t* outNewVsyncAppliedTime) {
+ Error error = Error::NONE;
+ mClient->setActiveConfigAndVsyncPeriod(
+ display, config, vsyncPeriodNanos, vsyncPeriodChangeConstraints,
+ [&](const auto& tmpError, const auto& tmpNewVsyncAppliedTime) {
+ error = tmpError;
+ *outNewVsyncAppliedTime = tmpNewVsyncAppliedTime;
+ });
+ return error;
+}
+
} // namespace vts
} // namespace V2_4
} // namespace composer