1
0
Fork 0

drm_hwcomposer: Remove HWC2 from HwcDisplayConfigs

Change Update function to return a bool to indicate success rather than
a HWC2::Error.

Remove the hwc2 #include since it's no longer necessary

Change-Id: I7896d9e6ede68cd4052f2c942fa0b6637ecaa390
Signed-off-by: Drew Davenport <ddavenport@google.com>
This commit is contained in:
Drew Davenport 2025-04-28 11:27:20 -06:00
parent eb6fe09ca1
commit be12e81b02
3 changed files with 6 additions and 9 deletions

View file

@ -565,8 +565,7 @@ bool HwcDisplay::Init() {
pipeline_->writeback_connector = pipeline_->connector;
} else if (IsInHeadlessMode()) {
configs_.GenFakeMode(0, 0);
} else if (configs_.Update(*pipeline_->connector->Get()) !=
HWC2::Error::None) {
} else if (!configs_.Update(*pipeline_->connector->Get())) {
return false;
}
return SetConfig(configs_.preferred_config_id) ==

View file

@ -88,7 +88,7 @@ void HwcDisplayConfigs::GenFakeMode(uint16_t width, uint16_t height) {
}
// NOLINTNEXTLINE (readability-function-cognitive-complexity): Fixme
HWC2::Error HwcDisplayConfigs::Update(DrmConnector &connector) {
bool HwcDisplayConfigs::Update(DrmConnector &connector) {
/* In case UpdateModes will fail we will still have one mode for headless
* mode
*/
@ -97,12 +97,12 @@ HWC2::Error HwcDisplayConfigs::Update(DrmConnector &connector) {
auto ret = connector.UpdateModes();
if (ret != 0) {
ALOGE("Failed to update display modes %d", ret);
return HWC2::Error::BadDisplay;
return false;
}
if (connector.GetModes().empty()) {
ALOGE("No modes reported by KMS");
return HWC2::Error::BadDisplay;
return false;
}
hwc_configs.clear();
@ -234,7 +234,7 @@ HWC2::Error HwcDisplayConfigs::Update(DrmConnector &connector) {
}
}
return HWC2::Error::None;
return true;
}
} // namespace android

View file

@ -16,8 +16,6 @@
#pragma once
#include <hardware/hwcomposer2.h>
#include <map>
#include "drm/DrmMode.h"
@ -38,7 +36,7 @@ struct HwcDisplayConfig {
};
struct HwcDisplayConfigs {
HWC2::Error Update(DrmConnector &conn);
bool Update(DrmConnector &conn);
void GenFakeMode(uint16_t width, uint16_t height);
std::map<uint32_t /*config_id*/, struct HwcDisplayConfig> hwc_configs;