From 83b64ff05433c953ffdd62a01e6e264a62e58a04 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Mon, 24 Jul 2017 11:11:01 -0700 Subject: [PATCH] graphics: ignore/reduce spurious vsync in VTS Bug: 62802718 Test: VTS Change-Id: I1ed73e0b2f14414f540865a96e6bd5ac1599fbf3 (cherry picked from commit e0ff3e4a2679cb505e801db5df4d1546f6caa41a) --- .../2.1/vts/functional/VtsHalGraphicsComposerTestUtils.cpp | 5 +++++ .../vts/functional/VtsHalGraphicsComposerV2_1TargetTest.cpp | 6 +++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/graphics/composer/2.1/vts/functional/VtsHalGraphicsComposerTestUtils.cpp b/graphics/composer/2.1/vts/functional/VtsHalGraphicsComposerTestUtils.cpp index 33cf84c37e..68aede2364 100644 --- a/graphics/composer/2.1/vts/functional/VtsHalGraphicsComposerTestUtils.cpp +++ b/graphics/composer/2.1/vts/functional/VtsHalGraphicsComposerTestUtils.cpp @@ -290,6 +290,11 @@ void ComposerClient::setVsyncEnabled(Display display, bool enabled) { : IComposerClient::Vsync::DISABLE; Error error = mClient->setVsyncEnabled(display, vsync); ASSERT_EQ(Error::NONE, error) << "failed to set vsync mode"; + + // give the hwbinder thread some time to handle any pending vsync callback + if (!enabled) { + usleep(5 * 1000); + } } } // namespace tests diff --git a/graphics/composer/2.1/vts/functional/VtsHalGraphicsComposerV2_1TargetTest.cpp b/graphics/composer/2.1/vts/functional/VtsHalGraphicsComposerV2_1TargetTest.cpp index 387222fbbe..4261d006da 100644 --- a/graphics/composer/2.1/vts/functional/VtsHalGraphicsComposerV2_1TargetTest.cpp +++ b/graphics/composer/2.1/vts/functional/VtsHalGraphicsComposerV2_1TargetTest.cpp @@ -118,7 +118,7 @@ class GraphicsComposerCallback : public IComposerCallback { // the set of all currently connected displays std::unordered_set mDisplays; // true only when vsync is enabled - bool mVsyncAllowed = false; + bool mVsyncAllowed = true; // track invalid callbacks int mInvalidHotplugCount = 0; @@ -137,6 +137,10 @@ class GraphicsComposerHidlTest : public ::testing::VtsHalHidlTargetTestBase { // assume the first display is primary and is never removed mPrimaryDisplay = waitForFirstDisplay(); + + // explicitly disable vsync + mComposerClient->setVsyncEnabled(mPrimaryDisplay, false); + mComposerCallback->setVsyncAllowed(false); } void TearDown() override {