Merge "composer: vts: Init display dimension using active config" into android13-tests-dev am: 3e1907ae4a am: 88046925d7

Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/2302958

Change-Id: I0a094ce882ae429331e57d12b9457a1235119e0f
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Shubhangi Pawar 2023-01-25 19:35:08 +00:00 committed by Automerger Merge Worker
commit 5ad465beab
2 changed files with 36 additions and 4 deletions

View file

@ -393,14 +393,31 @@ std::pair<ScopedAStatus, std::vector<VtsDisplay>> VtsComposerClient::getDisplays
return {std::move(configs.first), vtsDisplays};
}
for (int config : configs.second) {
auto status = updateDisplayProperties(&vtsDisplay, config);
auto status = addDisplayConfig(&vtsDisplay, config);
if (!status.isOk()) {
ALOGE("Unable to get the displays for test, failed to update the properties "
ALOGE("Unable to get the displays for test, failed to add config "
"for display %" PRId64,
display);
return {std::move(status), vtsDisplays};
}
}
auto config = getActiveConfig(display);
if (!config.first.isOk()) {
ALOGE("Unable to get the displays for test, failed to get active config "
"for display %" PRId64, display);
return {std::move(config.first), vtsDisplays};
}
auto status = updateDisplayProperties(&vtsDisplay, config.second);
if (!status.isOk()) {
ALOGE("Unable to get the displays for test, "
"failed to update the properties "
"for display %" PRId64,
display);
return {std::move(status), vtsDisplays};
}
vtsDisplays.emplace_back(vtsDisplay);
addDisplayToDisplayResources(display, /*isVirtual*/ false);
}
@ -409,7 +426,7 @@ std::pair<ScopedAStatus, std::vector<VtsDisplay>> VtsComposerClient::getDisplays
}
}
ScopedAStatus VtsComposerClient::updateDisplayProperties(VtsDisplay* vtsDisplay, int32_t config) {
ScopedAStatus VtsComposerClient::addDisplayConfig(VtsDisplay* vtsDisplay, int32_t config) {
const auto width =
getDisplayAttribute(vtsDisplay->getDisplayId(), config, DisplayAttribute::WIDTH);
const auto height =
@ -420,7 +437,6 @@ ScopedAStatus VtsComposerClient::updateDisplayProperties(VtsDisplay* vtsDisplay,
getDisplayAttribute(vtsDisplay->getDisplayId(), config, DisplayAttribute::CONFIG_GROUP);
if (width.first.isOk() && height.first.isOk() && vsyncPeriod.first.isOk() &&
configGroup.first.isOk()) {
vtsDisplay->setDimensions(width.second, height.second);
vtsDisplay->addDisplayConfig(config, {vsyncPeriod.second, configGroup.second});
return ScopedAStatus::ok();
}
@ -431,6 +447,21 @@ ScopedAStatus VtsComposerClient::updateDisplayProperties(VtsDisplay* vtsDisplay,
return ScopedAStatus::fromServiceSpecificError(IComposerClient::EX_BAD_CONFIG);
}
ScopedAStatus VtsComposerClient::updateDisplayProperties(VtsDisplay* vtsDisplay, int32_t config) {
const auto width =
getDisplayAttribute(vtsDisplay->getDisplayId(), config, DisplayAttribute::WIDTH);
const auto height =
getDisplayAttribute(vtsDisplay->getDisplayId(), config, DisplayAttribute::HEIGHT);
if (width.first.isOk() && height.first.isOk()) {
vtsDisplay->setDimensions(width.second, height.second);
return ScopedAStatus::ok();
}
LOG(ERROR) << "Failed to update display property for width: " << width.first.isOk()
<< ", height: " << height.first.isOk();
return ScopedAStatus::fromServiceSpecificError(IComposerClient::EX_BAD_CONFIG);
}
ScopedAStatus VtsComposerClient::addDisplayToDisplayResources(int64_t display, bool isVirtual) {
if (mDisplayResources.insert({display, DisplayResource(isVirtual)}).second) {
return ScopedAStatus::ok();

View file

@ -173,6 +173,7 @@ class VtsComposerClient {
std::pair<ScopedAStatus, std::vector<VtsDisplay>> getDisplays();
private:
ScopedAStatus addDisplayConfig(VtsDisplay* vtsDisplay, int32_t config);
ScopedAStatus updateDisplayProperties(VtsDisplay* vtsDisplay, int32_t config);
ScopedAStatus addDisplayToDisplayResources(int64_t display, bool isVirtual);