diff options
author | Roman Stratiienko <roman.o.stratiienko@globallogic.com> | 2022-01-30 20:28:46 +0200 |
---|---|---|
committer | Roman Stratiienko <roman.o.stratiienko@globallogic.com> | 2022-01-31 21:31:32 +0200 |
commit | 10be875de071672e61a52ab0679bbc6803df8c51 (patch) | |
tree | 0bbe92cbdb37e83745e2bc03a3a1048d8fa989c5 /drm/DrmCrtc.h | |
parent | edb97ed8b58952641aae12f77225df305acead53 (diff) | |
download | drm_hwcomposer-10be875de071672e61a52ab0679bbc6803df8c51.tar.gz |
drm_hwcomposer: Tidy-up DrmCrtc class
Implement DrmCrtc instantiation through CreateInstance() static method,
which helps to reduce complexity of DrmDevice::Init() function.
Move CRTC-to-Display binding information to the DrmDevice class.
Move drm/DrmCrtc.h to Normal clang-tidy checks list by fixing
clang-tidy findings.
Signed-off-by: Roman Stratiienko <roman.o.stratiienko@globallogic.com>
Diffstat (limited to 'drm/DrmCrtc.h')
-rw-r--r-- | drm/DrmCrtc.h | 39 |
1 files changed, 24 insertions, 15 deletions
diff --git a/drm/DrmCrtc.h b/drm/DrmCrtc.h index 85e067a..42fc9f9 100644 --- a/drm/DrmCrtc.h +++ b/drm/DrmCrtc.h @@ -23,6 +23,7 @@ #include "DrmMode.h" #include "DrmProperty.h" +#include "DrmUnique.h" namespace android { @@ -30,32 +31,40 @@ class DrmDevice; class DrmCrtc { public: - DrmCrtc(DrmDevice *drm, drmModeCrtcPtr c, unsigned pipe); + static auto CreateInstance(DrmDevice &dev, uint32_t crtc_id, uint32_t index) + -> std::unique_ptr<DrmCrtc>; + + DrmCrtc() = delete; DrmCrtc(const DrmCrtc &) = delete; DrmCrtc &operator=(const DrmCrtc &) = delete; - int Init(); + auto GetId() const { + return crtc_->crtc_id; + } - uint32_t id() const; - unsigned pipe() const; + auto GetIndexInResArray() const { + return index_in_res_array_; + } - int display() const; - void set_display(int display); + auto &GetActiveProperty() const { + return active_property_; + } - bool can_bind(int display) const; + auto &GetModeProperty() const { + return mode_property_; + } - const DrmProperty &active_property() const; - const DrmProperty &mode_property() const; - const DrmProperty &out_fence_ptr_property() const; + auto &GetOutFencePtrProperty() const { + return out_fence_ptr_property_; + } private: - DrmDevice *drm_; + DrmCrtc(DrmModeCrtcUnique crtc, uint32_t index) + : crtc_(std::move(crtc)), index_in_res_array_(index){}; - uint32_t id_; - unsigned pipe_; - int display_; + DrmModeCrtcUnique crtc_; - DrmMode mode_; + const uint32_t index_in_res_array_; DrmProperty active_property_; DrmProperty mode_property_; |