composer: vts: Init display dimension using active config

Dimension was initialized to the size of the last config that is in the config list.
VTS didn't change the dimension in the readback test and allocated buffer
for the readback with the dimension size.
However it was different with actual display size.
This change initializes display dimension to the actual display size.

Bug: 259155172
Change-Id: I64fec02f5386eb6ca1f41ab376be193231810b93
Signed-off-by: HyunKyoung <hk310.kim@samsung.com>
This commit is contained in:
HyunKyoung 2022-11-09 20:43:34 +09:00
parent f856184c02
commit 4775bdce26
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);