mirror of
https://github.com/Evolution-X/hardware_interfaces
synced 2026-02-01 11:36:00 +00:00
VtsHalGraphicsComposer3_TargetTest test fixes.
GraphicsComposerCallback Extend BnComposerCallback -> This will ensure that callback can be used for the binder. Test: atest VtsHalGraphicsComposer3_TargetTest BUG: 202053621 Change-Id: I739217cc40ede49601446306bd6ce0029a77cfba
This commit is contained in:
@@ -81,6 +81,8 @@ class GraphicsComposerAidlTest : public ::testing::TestWithParam<std::string> {
|
||||
// assume the first displays are built-in and are never removed
|
||||
mDisplays = waitForDisplays();
|
||||
|
||||
mPrimaryDisplay = mDisplays[0].get();
|
||||
|
||||
// explicitly disable vsync
|
||||
for (const auto& display : mDisplays) {
|
||||
EXPECT_TRUE(mComposerClient->setVsyncEnabled(display.get(), false).isOk());
|
||||
@@ -318,7 +320,7 @@ class GraphicsComposerAidlTest : public ::testing::TestWithParam<std::string> {
|
||||
}
|
||||
|
||||
mWriter->selectDisplay(display.get());
|
||||
setPowerMode(display.get(), PowerMode::ON);
|
||||
EXPECT_TRUE(mComposerClient->setPowerMode(display.get(), PowerMode::ON).isOk());
|
||||
EXPECT_TRUE(
|
||||
mComposerClient
|
||||
->setColorMode(display.get(), ColorMode::NATIVE, RenderIntent::COLORIMETRIC)
|
||||
@@ -484,13 +486,6 @@ class GraphicsComposerAidlTest : public ::testing::TestWithParam<std::string> {
|
||||
}
|
||||
}
|
||||
|
||||
void setPowerMode(int64_t display, PowerMode powerMode) {
|
||||
::ndk::ScopedAStatus error = mComposerClient->setPowerMode(display, powerMode);
|
||||
ASSERT_TRUE(error.isOk() ||
|
||||
IComposerClient::EX_UNSUPPORTED == error.getServiceSpecificError())
|
||||
<< "failed to set power mode";
|
||||
}
|
||||
|
||||
// Keep track of all virtual displays and layers. When a test fails with
|
||||
// ASSERT_*, the destructor will clean up the resources for the test.
|
||||
struct DisplayResource {
|
||||
@@ -617,6 +612,7 @@ TEST_P(GraphicsComposerAidlTest, setActiveConfigWithConstraints_SeamlessNotAllow
|
||||
TEST_P(GraphicsComposerAidlTest, setActiveConfigWithConstraints) {
|
||||
Test_setActiveConfigWithConstraints({.delayForChange = 0, .refreshMiss = false});
|
||||
}
|
||||
|
||||
TEST_P(GraphicsComposerAidlTest, GetDisplayIdentificationData) {
|
||||
DisplayIdentification displayIdentification0;
|
||||
|
||||
@@ -826,17 +822,19 @@ TEST_P(GraphicsComposerAidlTest, GetDisplayedContentSample) {
|
||||
displayContentSamplingAttributes.format = static_cast<common::PixelFormat>(invalid);
|
||||
displayContentSamplingAttributes.dataspace = static_cast<common::Dataspace>(invalid);
|
||||
displayContentSamplingAttributes.componentMask = static_cast<FormatColorComponent>(invalid);
|
||||
EXPECT_TRUE(mComposerClient
|
||||
->getDisplayedContentSamplingAttributes(mPrimaryDisplay,
|
||||
&displayContentSamplingAttributes)
|
||||
.isOk());
|
||||
auto error = mComposerClient->getDisplayedContentSamplingAttributes(
|
||||
mPrimaryDisplay, &displayContentSamplingAttributes);
|
||||
if (error.getServiceSpecificError() == IComposerClient::EX_UNSUPPORTED) {
|
||||
SUCCEED() << "Sampling attributes aren't supported on this device, test skipped";
|
||||
return;
|
||||
}
|
||||
|
||||
int64_t maxFrames = 10;
|
||||
int64_t timestamp = 0;
|
||||
int64_t frameCount = 0;
|
||||
DisplayContentSample displayContentSample;
|
||||
auto error = mComposerClient->getDisplayedContentSample(mPrimaryDisplay, maxFrames, timestamp,
|
||||
&displayContentSample);
|
||||
error = mComposerClient->getDisplayedContentSample(mPrimaryDisplay, maxFrames, timestamp,
|
||||
&displayContentSample);
|
||||
if (error.getServiceSpecificError() == IComposerClient::EX_UNSUPPORTED) {
|
||||
SUCCEED() << "Device does not support optional extension. Test skipped";
|
||||
return;
|
||||
@@ -1197,7 +1195,7 @@ TEST_P(GraphicsComposerAidlTest, SetPowerMode) {
|
||||
modes.push_back(PowerMode::ON);
|
||||
|
||||
for (auto mode : modes) {
|
||||
setPowerMode(mPrimaryDisplay, mode);
|
||||
EXPECT_TRUE(mComposerClient->setPowerMode(mPrimaryDisplay, mode).isOk());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1208,7 +1206,7 @@ TEST_P(GraphicsComposerAidlTest, SetPowerModeVariations) {
|
||||
modes.push_back(PowerMode::OFF);
|
||||
|
||||
for (auto mode : modes) {
|
||||
setPowerMode(mPrimaryDisplay, mode);
|
||||
EXPECT_TRUE(mComposerClient->setPowerMode(mPrimaryDisplay, mode).isOk());
|
||||
}
|
||||
|
||||
modes.clear();
|
||||
@@ -1217,7 +1215,7 @@ TEST_P(GraphicsComposerAidlTest, SetPowerModeVariations) {
|
||||
modes.push_back(PowerMode::ON);
|
||||
|
||||
for (auto mode : modes) {
|
||||
setPowerMode(mPrimaryDisplay, mode);
|
||||
EXPECT_TRUE(mComposerClient->setPowerMode(mPrimaryDisplay, mode).isOk());
|
||||
}
|
||||
|
||||
modes.clear();
|
||||
@@ -1226,7 +1224,7 @@ TEST_P(GraphicsComposerAidlTest, SetPowerModeVariations) {
|
||||
modes.push_back(PowerMode::ON_SUSPEND);
|
||||
|
||||
for (auto mode : modes) {
|
||||
setPowerMode(mPrimaryDisplay, mode);
|
||||
EXPECT_TRUE(mComposerClient->setPowerMode(mPrimaryDisplay, mode).isOk());
|
||||
}
|
||||
|
||||
bool isDozeSupported = false;
|
||||
@@ -1238,7 +1236,7 @@ TEST_P(GraphicsComposerAidlTest, SetPowerModeVariations) {
|
||||
modes.push_back(PowerMode::DOZE);
|
||||
|
||||
for (auto mode : modes) {
|
||||
setPowerMode(mPrimaryDisplay, mode);
|
||||
EXPECT_TRUE(mComposerClient->setPowerMode(mPrimaryDisplay, mode).isOk());
|
||||
}
|
||||
|
||||
modes.clear();
|
||||
@@ -1247,7 +1245,7 @@ TEST_P(GraphicsComposerAidlTest, SetPowerModeVariations) {
|
||||
modes.push_back(PowerMode::DOZE_SUSPEND);
|
||||
|
||||
for (auto mode : modes) {
|
||||
setPowerMode(mPrimaryDisplay, mode);
|
||||
EXPECT_TRUE(mComposerClient->setPowerMode(mPrimaryDisplay, mode).isOk());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1285,6 +1283,7 @@ TEST_P(GraphicsComposerAidlTest, GetDataspaceSaturationMatrix) {
|
||||
EXPECT_TRUE(
|
||||
mComposerClient->getDataspaceSaturationMatrix(common::Dataspace::SRGB_LINEAR, &matrix)
|
||||
.isOk());
|
||||
|
||||
// the last row is known
|
||||
ASSERT_EQ(0.0f, matrix[12]);
|
||||
ASSERT_EQ(0.0f, matrix[13]);
|
||||
|
||||
@@ -125,12 +125,4 @@ GraphicsComposerCallback::takeLastVsyncPeriodChangeTimeline() {
|
||||
return ::ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
::ndk::SpAIBinder GraphicsComposerCallback::asBinder() {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool GraphicsComposerCallback::isRemote() {
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace aidl::android::hardware::graphics::composer3::vts
|
||||
|
||||
@@ -37,15 +37,15 @@ void TestCommandReader::parseSingleCommand(int32_t commandRaw, uint16_t length)
|
||||
auto command = static_cast<Command>(commandRaw);
|
||||
|
||||
switch (command) {
|
||||
case Command::SET_CLIENT_TARGET_PROPERTY:
|
||||
case Command::SET_CLIENT_TARGET_PROPERTY: {
|
||||
ASSERT_EQ(2, length);
|
||||
read();
|
||||
close(readFence());
|
||||
break;
|
||||
case Command::SELECT_DISPLAY:
|
||||
} break;
|
||||
case Command::SELECT_DISPLAY: {
|
||||
ASSERT_EQ(2, length);
|
||||
read64(); // display
|
||||
break;
|
||||
} break;
|
||||
case Command::SET_ERROR: {
|
||||
ASSERT_EQ(2, length);
|
||||
auto loc = read();
|
||||
@@ -53,7 +53,7 @@ void TestCommandReader::parseSingleCommand(int32_t commandRaw, uint16_t length)
|
||||
std::pair<uint32_t, uint32_t> error(loc, err);
|
||||
mErrors.push_back(error);
|
||||
} break;
|
||||
case Command::SET_CHANGED_COMPOSITION_TYPES:
|
||||
case Command::SET_CHANGED_COMPOSITION_TYPES: {
|
||||
ASSERT_EQ(0, length % 3);
|
||||
for (uint16_t count = 0; count < length / 3; ++count) {
|
||||
uint64_t layerId = read64();
|
||||
@@ -62,8 +62,8 @@ void TestCommandReader::parseSingleCommand(int32_t commandRaw, uint16_t length)
|
||||
std::pair<uint64_t, uint32_t> compositionChange(layerId, composition);
|
||||
mCompositionChanges.push_back(compositionChange);
|
||||
}
|
||||
break;
|
||||
case Command::SET_DISPLAY_REQUESTS:
|
||||
} break;
|
||||
case Command::SET_DISPLAY_REQUESTS: {
|
||||
ASSERT_EQ(1, length % 3);
|
||||
read(); // displayRequests, ignored for now
|
||||
for (uint16_t count = 0; count < (length - 1) / 3; ++count) {
|
||||
@@ -72,18 +72,18 @@ void TestCommandReader::parseSingleCommand(int32_t commandRaw, uint16_t length)
|
||||
// client composition anyway
|
||||
ASSERT_EQ(1u, read());
|
||||
}
|
||||
break;
|
||||
case Command::SET_PRESENT_FENCE:
|
||||
} break;
|
||||
case Command::SET_PRESENT_FENCE: {
|
||||
ASSERT_EQ(1, length);
|
||||
close(readFence());
|
||||
break;
|
||||
case Command::SET_RELEASE_FENCES:
|
||||
} break;
|
||||
case Command::SET_RELEASE_FENCES: {
|
||||
ASSERT_EQ(0, length % 3);
|
||||
for (uint16_t count = 0; count < length / 3; ++count) {
|
||||
read64();
|
||||
close(readFence());
|
||||
}
|
||||
break;
|
||||
} break;
|
||||
default:
|
||||
GTEST_FAIL() << "unexpected return command " << std::hex << static_cast<int>(command);
|
||||
break;
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wconversion"
|
||||
|
||||
#include <aidl/android/hardware/graphics/composer3/IComposerCallback.h>
|
||||
#include <aidl/android/hardware/graphics/composer3/BnComposerCallback.h>
|
||||
#include <android-base/thread_annotations.h>
|
||||
#include <mutex>
|
||||
#include <unordered_set>
|
||||
@@ -29,8 +29,7 @@
|
||||
|
||||
namespace aidl::android::hardware::graphics::composer3::vts {
|
||||
|
||||
// IComposerCallback to be installed with IComposerClient::registerCallback.
|
||||
class GraphicsComposerCallback : public IComposerCallback {
|
||||
class GraphicsComposerCallback : public BnComposerCallback {
|
||||
public:
|
||||
void setVsyncAllowed(bool allowed);
|
||||
|
||||
@@ -59,9 +58,6 @@ class GraphicsComposerCallback : public IComposerCallback {
|
||||
const ::aidl::android::hardware::graphics::composer3::VsyncPeriodChangeTimeline&
|
||||
in_updatedTimeline) override;
|
||||
|
||||
::ndk::SpAIBinder asBinder() override;
|
||||
bool isRemote() override;
|
||||
|
||||
mutable std::mutex mMutex;
|
||||
// the set of all currently connected displays
|
||||
std::unordered_set<int64_t> mDisplays GUARDED_BY(mMutex);
|
||||
|
||||
Reference in New Issue
Block a user