drm_hwcomposer: Simplify state tracking for staged configs
This helps to clarify and distinguish between the config that is
currently committed to the kernel and a pending config that will be
applied in a future update.
- Make staged_mode_config_id_ optional to indicate whether the config
change is pending or has completed.
- Remove staged_mode_ since it can be derived from
staged_mode_config_id_
- Add GetConfig() helper, and implement various methods to get a config
in terms of it.
Change-Id: I1dad0fa8a52bc91d5210b3b096a43c21b2e842f5
Signed-off-by: Drew Davenport <ddavenport@google.com>
diff --git a/hwc2_device/HwcDisplay.h b/hwc2_device/HwcDisplay.h
index 91e5df7..7cc1bee 100644
--- a/hwc2_device/HwcDisplay.h
+++ b/hwc2_device/HwcDisplay.h
@@ -78,6 +78,9 @@
auto QueueConfig(hwc2_config_t config, int64_t desired_time, bool seamless,
QueuedConfigTiming *out_timing) -> ConfigError;
+ // Get the HwcDisplayConfig, or nullptor if none.
+ auto GetConfig(hwc2_config_t config_id) const -> const HwcDisplayConfig *;
+
// HWC2 Hooks - these should not be used outside of the hwc2 device.
HWC2::Error AcceptDisplayChanges();
HWC2::Error CreateLayer(hwc2_layer_t *layer);
@@ -226,9 +229,8 @@
SharedFd present_fence_;
- std::optional<DrmMode> staged_mode_;
int64_t staged_mode_change_time_{};
- uint32_t staged_mode_config_id_{};
+ std::optional<uint32_t> staged_mode_config_id_{};
std::shared_ptr<DrmDisplayPipeline> pipeline_;