SF: Remove display config functions from HWC2
HWC2 is unnecessary stateful stopgap between HWComposer and
ComposerHal. In this CL the following functions are removed from HWC2
* getActiveConfig
* getActiveConfigIndex
* getDisplayVsyncPeriod
and ComposerHal is called directly from HWComposer. This way display
configs are stored only in HWComposer.
Additionally HWC2::Display::Config is renamed to DisplayMode and
it's extracted in its own file.
From the perspective of SurfaceFlinger this CL is not modifying
behaviour.
Bug: 159590486
Bug: 175678215
Test: atest libsurfaceflinger_unittest
Change-Id: I8cb450209adf038d891cff00d1c2690c8e6d94f7
diff --git a/services/surfaceflinger/Scheduler/RefreshRateConfigs.h b/services/surfaceflinger/Scheduler/RefreshRateConfigs.h
index 4b99145..a5d37c2 100644
--- a/services/surfaceflinger/Scheduler/RefreshRateConfigs.h
+++ b/services/surfaceflinger/Scheduler/RefreshRateConfigs.h
@@ -24,6 +24,7 @@
#include <optional>
#include <type_traits>
+#include "DisplayHardware/DisplayMode.h"
#include "DisplayHardware/HWComposer.h"
#include "Fps.h"
#include "HwcStrongTypes.h"
@@ -64,8 +65,7 @@
};
public:
- RefreshRate(HwcConfigIndexType configId,
- std::shared_ptr<const HWC2::Display::Config> config, Fps fps, ConstructorTag)
+ RefreshRate(HwcConfigIndexType configId, DisplayModePtr config, Fps fps, ConstructorTag)
: configId(configId), hwcConfig(config), fps(std::move(fps)) {}
HwcConfigIndexType getConfigId() const { return configId; }
@@ -101,7 +101,7 @@
// on the device.
const HwcConfigIndexType configId;
// The config itself
- std::shared_ptr<const HWC2::Display::Config> hwcConfig;
+ DisplayModePtr hwcConfig;
// Refresh rate in frames per second
const Fps fps{0.0f};
};
@@ -296,12 +296,10 @@
// Returns a known frame rate that is the closest to frameRate
Fps findClosestKnownFrameRate(Fps frameRate) const;
- RefreshRateConfigs(const std::vector<std::shared_ptr<const HWC2::Display::Config>>& configs,
- HwcConfigIndexType currentConfigId);
+ RefreshRateConfigs(const DisplayModes& configs, HwcConfigIndexType currentConfigId);
- void updateDisplayConfigs(
- const std::vector<std::shared_ptr<const HWC2::Display::Config>>& configs,
- HwcConfigIndexType currentConfig) EXCLUDES(mLock);
+ void updateDisplayConfigs(const DisplayModes& configs, HwcConfigIndexType currentConfig)
+ EXCLUDES(mLock);
// Returns whether switching configs (refresh rate or resolution) is possible.
// TODO(b/158780872): Consider HAL support, and skip frame rate detection if the configs only