aboutsummaryrefslogtreecommitdiff
path: root/hwc2_device/HwcDisplay.h
diff options
context:
space:
mode:
Diffstat (limited to 'hwc2_device/HwcDisplay.h')
-rw-r--r--hwc2_device/HwcDisplay.h31
1 files changed, 17 insertions, 14 deletions
diff --git a/hwc2_device/HwcDisplay.h b/hwc2_device/HwcDisplay.h
index b73404a..42b000a 100644
--- a/hwc2_device/HwcDisplay.h
+++ b/hwc2_device/HwcDisplay.h
@@ -37,10 +37,10 @@ inline constexpr uint32_t kPrimaryDisplay = 0;
class HwcDisplay {
public:
- HwcDisplay(ResourceManager *resource_manager, DrmDisplayPipeline *pipeline,
- hwc2_display_t handle, HWC2::DisplayType type, DrmHwcTwo *hwc2);
+ HwcDisplay(DrmDisplayPipeline *pipeline, hwc2_display_t handle,
+ HWC2::DisplayType type, DrmHwcTwo *hwc2);
HwcDisplay(const HwcDisplay &) = delete;
- HWC2::Error Init();
+ ~HwcDisplay();
HWC2::Error CreateComposition(AtomicCommitArgs &a_args);
std::vector<HwcLayer *> GetOrderLayersByZPos();
@@ -144,6 +144,10 @@ class HwcDisplay {
const Backend *backend() const;
void set_backend(std::unique_ptr<Backend> backend);
+ auto GetHwc2() {
+ return hwc2_;
+ }
+
std::map<hwc2_layer_t, HwcLayer> &layers() {
return layers_;
}
@@ -152,10 +156,6 @@ class HwcDisplay {
return *pipeline_;
}
- ResourceManager *resource_manager() const {
- return resource_manager_;
- }
-
android_color_transform_t &color_transform_hint() {
return color_transform_hint_;
}
@@ -193,8 +193,7 @@ class HwcDisplay {
* https://source.android.com/devices/graphics/hotplug#handling-common-scenarios
*/
bool IsInHeadlessMode() {
- return handle_ == kPrimaryDisplay &&
- !GetPipe().connector->Get()->IsConnected();
+ return !pipeline_;
}
private:
@@ -213,20 +212,22 @@ class HwcDisplay {
HwcDisplayConfigs configs_;
- DrmHwcTwo *hwc2_;
+ DrmHwcTwo *const hwc2_;
std::optional<DrmMode> staged_mode;
- ResourceManager *resource_manager_;
-
DrmDisplayPipeline *const pipeline_;
std::unique_ptr<Backend> backend_;
VSyncWorker vsync_worker_;
- hwc2_display_t handle_;
+
+ const hwc2_display_t handle_;
HWC2::DisplayType type_;
- uint32_t layer_idx_ = 0;
+
+ // NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables)
+ static uint32_t layer_idx_;
+
std::map<hwc2_layer_t, HwcLayer> layers_;
HwcLayer client_layer_;
int32_t color_mode_{};
@@ -237,6 +238,8 @@ class HwcDisplay {
Stats total_stats_;
Stats prev_stats_;
std::string DumpDelta(HwcDisplay::Stats delta);
+
+ HWC2::Error Init();
};
} // namespace android