composer: vts: check that refresh rate stays the same on inactivity

Bug: 147890947
Test: adb shell data/nativetest64/VtsHalGraphicsComposerV2_4TargetTest/VtsHalGraphicsComposerV2_4TargetTest
Change-Id: I9e1bc1325701ca1603251cc499712f11aa86d30e
This commit is contained in:
Ady Abraham
2020-01-17 11:39:37 -08:00
parent 2056c2da3b
commit 9c1d0adb3f

View File

@@ -279,23 +279,48 @@ TEST_P(GraphicsComposerHidlTest, getDisplayVsyncPeriod_BadDisplay) {
mComposerClient->getDisplayVsyncPeriod(mInvalidDisplayId, &vsyncPeriodNanos));
}
TEST_P(GraphicsComposerHidlTest, getDisplayVsyncPeriod) {
TEST_P(GraphicsComposerHidlCommandTest, getDisplayVsyncPeriod) {
for (Display display : mComposerCallback->getDisplays()) {
for (Config config : mComposerClient->getDisplayConfigs(display)) {
VsyncPeriodNanos expectedVsyncPeriodNanos = mComposerClient->getDisplayAttribute_2_4(
display, config, IComposerClient::IComposerClient::Attribute::VSYNC_PERIOD);
mComposerClient->setActiveConfig(display, config);
VsyncPeriodChangeTimeline timeline;
IComposerClient::VsyncPeriodChangeConstraints constraints;
constraints.desiredTimeNanos = systemTime();
constraints.seamlessRequired = false;
EXPECT_EQ(Error::NONE, mComposerClient->setActiveConfigWithConstraints(
display, config, constraints, &timeline));
if (timeline.refreshRequired) {
sendRefreshFrame(timeline);
}
waitForVsyncPeriodChange(display, timeline, constraints.desiredTimeNanos, 0,
expectedVsyncPeriodNanos);
VsyncPeriodNanos vsyncPeriodNanos;
int retryCount = 100;
do {
std::this_thread::sleep_for(10ms);
vsyncPeriodNanos = 0;
EXPECT_EQ(Error::NONE,
mComposerClient->getDisplayVsyncPeriod(display, &vsyncPeriodNanos));
--retryCount;
} while (vsyncPeriodNanos != expectedVsyncPeriodNanos && retryCount > 0);
EXPECT_EQ(vsyncPeriodNanos, expectedVsyncPeriodNanos);
// Make sure that the vsync period stays the same if the active config is not changed.
auto timeout = 1ms;
for (int i = 0; i < 10; i++) {
std::this_thread::sleep_for(timeout);
timeout *= 2;
vsyncPeriodNanos = 0;
EXPECT_EQ(Error::NONE,
mComposerClient->getDisplayVsyncPeriod(display, &vsyncPeriodNanos));
EXPECT_EQ(vsyncPeriodNanos, expectedVsyncPeriodNanos);
}
}
}
}