From be12e81b02692d25bd0667471716d3d3bbdc21be Mon Sep 17 00:00:00 2001 From: Drew Davenport Date: Mon, 28 Apr 2025 11:27:20 -0600 Subject: [PATCH] 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 --- hwc2_device/HwcDisplay.cpp | 3 +-- hwc2_device/HwcDisplayConfigs.cpp | 8 ++++---- hwc2_device/HwcDisplayConfigs.h | 4 +--- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/hwc2_device/HwcDisplay.cpp b/hwc2_device/HwcDisplay.cpp index ca2495b..40924e6 100644 --- a/hwc2_device/HwcDisplay.cpp +++ b/hwc2_device/HwcDisplay.cpp @@ -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) == diff --git a/hwc2_device/HwcDisplayConfigs.cpp b/hwc2_device/HwcDisplayConfigs.cpp index fa1d2a9..8d3f525 100644 --- a/hwc2_device/HwcDisplayConfigs.cpp +++ b/hwc2_device/HwcDisplayConfigs.cpp @@ -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 diff --git a/hwc2_device/HwcDisplayConfigs.h b/hwc2_device/HwcDisplayConfigs.h index 33dcb81..817805c 100644 --- a/hwc2_device/HwcDisplayConfigs.h +++ b/hwc2_device/HwcDisplayConfigs.h @@ -16,8 +16,6 @@ #pragma once -#include - #include #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 hwc_configs;