Merge ab/6692658 into stage-aosp-rvc-ts-dev
Bug: 148878042
Merged-In: I236e5c9c16b4ba730677cd4c980a7071ba25840e
Change-Id: Ia102f1a63fddcaa43365e35680ea04242fe2ee80
diff --git a/graphics/composer/2.4/vts/functional/VtsHalGraphicsComposerV2_4TargetTest.cpp b/graphics/composer/2.4/vts/functional/VtsHalGraphicsComposerV2_4TargetTest.cpp
index 6b0d106..f0de4f7 100644
--- a/graphics/composer/2.4/vts/functional/VtsHalGraphicsComposerV2_4TargetTest.cpp
+++ b/graphics/composer/2.4/vts/functional/VtsHalGraphicsComposerV2_4TargetTest.cpp
@@ -201,8 +201,12 @@
void execute() { mComposerClient->execute(mReader.get(), mWriter.get()); }
- void Test_setActiveConfigWithConstraints(
- const IComposerClient::VsyncPeriodChangeConstraints& constraints, bool refreshMiss);
+ struct TestParameters {
+ nsecs_t delayForChange;
+ bool refreshMiss;
+ };
+
+ void Test_setActiveConfigWithConstraints(const TestParameters& params);
void sendRefreshFrame(const VsyncPeriodChangeTimeline*);
@@ -453,9 +457,7 @@
}
void GraphicsComposerHidlCommandTest::Test_setActiveConfigWithConstraints(
- const IComposerClient::VsyncPeriodChangeConstraints& constraints, bool refreshMiss) {
- VsyncPeriodChangeTimeline timeline = {};
-
+ const TestParameters& params) {
for (Display display : mComposerCallback->getDisplays()) {
forEachTwoConfigs(display, [&](Config config1, Config config2) {
mComposerClient->setActiveConfig(display, config1);
@@ -470,6 +472,10 @@
return; // continue
}
+ VsyncPeriodChangeTimeline timeline;
+ IComposerClient::VsyncPeriodChangeConstraints constraints = {
+ .desiredTimeNanos = systemTime() + params.delayForChange,
+ .seamlessRequired = false};
EXPECT_EQ(Error::NONE, mComposerClient->setActiveConfigWithConstraints(
display, config2, constraints, &timeline));
@@ -480,7 +486,7 @@
kReasonableTimeForChange.count());
if (timeline.refreshRequired) {
- if (refreshMiss) {
+ if (params.refreshMiss) {
// Miss the refresh frame on purpose to make sure the implementation sends a
// callback
std::this_thread::sleep_until(toTimePoint(timeline.refreshTimeNanos) + 100ms);
@@ -494,7 +500,7 @@
// cases the implementation might have missed the deadline. In this case a new
// timeline should have been provided.
auto newTimeline = mComposerCallback->takeLastVsyncPeriodChangeTimeline();
- if (timeline.refreshRequired && refreshMiss) {
+ if (timeline.refreshRequired && params.refreshMiss) {
EXPECT_TRUE(newTimeline.has_value());
}
@@ -515,28 +521,16 @@
}
TEST_P(GraphicsComposerHidlCommandTest, setActiveConfigWithConstraints) {
- IComposerClient::VsyncPeriodChangeConstraints constraints;
-
- constraints.seamlessRequired = false;
- constraints.desiredTimeNanos = systemTime();
- Test_setActiveConfigWithConstraints(constraints, false);
+ Test_setActiveConfigWithConstraints({.delayForChange = 0, .refreshMiss = false});
}
TEST_P(GraphicsComposerHidlCommandTest, setActiveConfigWithConstraints_Delayed) {
- IComposerClient::VsyncPeriodChangeConstraints constraints;
-
- constexpr nsecs_t kDelayForChange = 300'000'000; // 300ms
- constraints.seamlessRequired = false;
- constraints.desiredTimeNanos = systemTime() + kDelayForChange;
- Test_setActiveConfigWithConstraints(constraints, false);
+ Test_setActiveConfigWithConstraints({.delayForChange = 300'000'000, // 300ms
+ .refreshMiss = false});
}
TEST_P(GraphicsComposerHidlCommandTest, setActiveConfigWithConstraints_MissRefresh) {
- IComposerClient::VsyncPeriodChangeConstraints constraints;
-
- constraints.seamlessRequired = false;
- constraints.desiredTimeNanos = systemTime();
- Test_setActiveConfigWithConstraints(constraints, true);
+ Test_setActiveConfigWithConstraints({.delayForChange = 0, .refreshMiss = true});
}
TEST_P(GraphicsComposerHidlTest, setAutoLowLatencyModeBadDisplay) {