drm_hwcomposer: Deprecate usage of HWC2 GetActiveConfig
Add HwcDisplay::GetLastRequestedConfig, and use this to implement
support for getActiveConfig.
Change-Id: I089e2ac0046eceb5da9c130537105290a973ae4a
Signed-off-by: Drew Davenport <ddavenport@google.com>
diff --git a/hwc2_device/HwcDisplay.cpp b/hwc2_device/HwcDisplay.cpp
index 0ab43f9..ec481e1 100644
--- a/hwc2_device/HwcDisplay.cpp
+++ b/hwc2_device/HwcDisplay.cpp
@@ -104,6 +104,14 @@
return &config_iter->second;
}
+const HwcDisplayConfig *HwcDisplay::GetLastRequestedConfig() const {
+ auto config_iter = configs_.hwc_configs.find(staged_mode_config_id_);
+ if (config_iter == configs_.hwc_configs.end()) {
+ return nullptr;
+ }
+ return &config_iter->second;
+}
+
void HwcDisplay::SetPipeline(std::shared_ptr<DrmDisplayPipeline> pipeline) {
Deinit();
diff --git a/hwc2_device/HwcDisplay.h b/hwc2_device/HwcDisplay.h
index 7cdc0b8..a315540 100644
--- a/hwc2_device/HwcDisplay.h
+++ b/hwc2_device/HwcDisplay.h
@@ -62,6 +62,11 @@
// Get the config representing the mode that has been committed to KMS.
const HwcDisplayConfig *GetCurrentConfig() const;
+ // Get the config that was last requested through SetActiveConfig and similar
+ // functions. This may differ from the GetCurrentConfig if the config change
+ // is queued up to take effect in the future.
+ const HwcDisplayConfig *GetLastRequestedConfig() const;
+
// HWC2 Hooks - these should not be used outside of the hwc2 device.
HWC2::Error AcceptDisplayChanges();
HWC2::Error CreateLayer(hwc2_layer_t *layer);