diff options
Diffstat (limited to 'drm/DrmEncoder.h')
-rw-r--r-- | drm/DrmEncoder.h | 40 |
1 files changed, 24 insertions, 16 deletions
diff --git a/drm/DrmEncoder.h b/drm/DrmEncoder.h index a1f96d3..e66d6f1 100644 --- a/drm/DrmEncoder.h +++ b/drm/DrmEncoder.h @@ -29,31 +29,39 @@ namespace android { class DrmEncoder { public: - DrmEncoder(drmModeEncoderPtr e, DrmCrtc *current_crtc, - std::vector<DrmCrtc *> possible_crtcs); + static auto CreateInstance(DrmDevice &dev, uint32_t encoder_id, + uint32_t index) -> std::unique_ptr<DrmEncoder>; + DrmEncoder(const DrmEncoder &) = delete; DrmEncoder &operator=(const DrmEncoder &) = delete; - uint32_t id() const; + auto GetId() const { + return enc_->encoder_id; + }; + + auto GetIndexInResArray() const { + return index_in_res_array_; + } - DrmCrtc *crtc() const; - void set_crtc(DrmCrtc *crtc, int display); - bool can_bind(int display) const; - int display() const; + auto CanClone(DrmEncoder &encoder) { + return (enc_->possible_clones & (1 << encoder.GetIndexInResArray())) != 0; + } - const std::vector<DrmCrtc *> &possible_crtcs() const { - return possible_crtcs_; + auto SupportsCrtc(DrmCrtc &crtc) { + return (enc_->possible_crtcs & (1 << crtc.GetIndexInResArray())) != 0; + } + + auto GetCurrentCrtcId() { + return enc_->crtc_id; } - bool CanClone(DrmEncoder *encoder); - void AddPossibleClone(DrmEncoder *possible_clone); private: - uint32_t id_; - DrmCrtc *crtc_; - int display_; + DrmEncoder(DrmModeEncoderUnique enc, uint32_t index) + : enc_(std::move(enc)), index_in_res_array_(index){}; + + DrmModeEncoderUnique enc_; - std::vector<DrmCrtc *> possible_crtcs_; - std::set<DrmEncoder *> possible_clones_; + const uint32_t index_in_res_array_; }; } // namespace android |