diff options
author | Roman Stratiienko <roman.o.stratiienko@globallogic.com> | 2022-01-29 00:50:22 +0200 |
---|---|---|
committer | Roman Stratiienko <roman.o.stratiienko@globallogic.com> | 2022-01-31 21:31:31 +0200 |
commit | b671fab16a08830703f5fe73037563ff8001a1a3 (patch) | |
tree | 1b4a42144305a2574321fe48fb26c46d463ec453 /drm/DrmPlane.h | |
parent | 938a74244d7afbff431a0430e37f462968ed55a3 (diff) | |
download | drm_hwcomposer-b671fab16a08830703f5fe73037563ff8001a1a3.tar.gz |
drm_hwcomposer: Tidy-up DrmPlane class
This allow to throw away few lines from DrmDevice::Init() making it less
complicated.
Signed-off-by: Roman Stratiienko <roman.o.stratiienko@globallogic.com>
Diffstat (limited to 'drm/DrmPlane.h')
-rw-r--r-- | drm/DrmPlane.h | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/drm/DrmPlane.h b/drm/DrmPlane.h index e1ee920..9826f67 100644 --- a/drm/DrmPlane.h +++ b/drm/DrmPlane.h @@ -33,16 +33,18 @@ struct DrmHwcLayer; class DrmPlane { public: - DrmPlane(DrmDevice *drm, drmModePlanePtr p); DrmPlane(const DrmPlane &) = delete; DrmPlane &operator=(const DrmPlane &) = delete; - int Init(); + static auto CreateInstance(DrmDevice &dev, uint32_t plane_id) + -> std::unique_ptr<DrmPlane>; - bool GetCrtcSupported(const DrmCrtc &crtc) const; + bool IsCrtcSupported(const DrmCrtc &crtc) const; bool IsValidForLayer(DrmHwcLayer *layer); - uint32_t GetType() const; + auto GetType() const { + return type_; + } bool IsFormatSupported(uint32_t format) const; bool HasNonRgbFormat() const; @@ -50,19 +52,26 @@ class DrmPlane { auto AtomicSetState(drmModeAtomicReq &pset, DrmHwcLayer &layer, uint32_t zpos, uint32_t crtc_id) -> int; auto AtomicDisablePlane(drmModeAtomicReq &pset) -> int; - const DrmProperty &GetZPosProperty() const; + auto &GetZPosProperty() const { + return zpos_property_; + } + + auto GetId() const { + return plane_->plane_id; + } private: - DrmDevice *drm_; - uint32_t id_; + DrmPlane(DrmDevice &dev, DrmModePlaneUnique plane) + : drm_(&dev), plane_(std::move(plane)){}; + DrmDevice *const drm_; + DrmModePlaneUnique plane_; enum class Presence { kOptional, kMandatory }; + auto Init() -> int; auto GetPlaneProperty(const char *prop_name, DrmProperty &property, Presence presence = Presence::kMandatory) -> bool; - uint32_t possible_crtc_mask_; - uint32_t type_{}; std::vector<uint32_t> formats_; |