Merge "composer: vts: Init display dimension using active config"
This commit is contained in:
commit
12c9d664aa
2 changed files with 36 additions and 4 deletions
|
@ -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();
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue