aboutsummaryrefslogtreecommitdiff
path: root/drm/DrmEncoder.h
diff options
context:
space:
mode:
authorRoman Stratiienko <roman.o.stratiienko@globallogic.com>2022-01-30 21:06:35 +0200
committerRoman Stratiienko <roman.o.stratiienko@globallogic.com>2022-01-31 21:31:32 +0200
commit027987b1fe91a496e1397d165ced6b3c7026aa06 (patch)
treeb41a9a99b56b30eb8a309317dbe3100bcd95779c /drm/DrmEncoder.h
parent10be875de071672e61a52ab0679bbc6803df8c51 (diff)
downloaddrm_hwcomposer-027987b1fe91a496e1397d165ced6b3c7026aa06.tar.gz
drm_hwcomposer: Tidy-up DrmEncoder class
Implement DrmEncoder instantiation through CreateInstance() static method, which helps to reduce complexity of DrmDevice::Init() function. Move Encoder-to-CRTC binding information to the DrmDevice class. Move drm/DrmEncoder.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/DrmEncoder.h')
-rw-r--r--drm/DrmEncoder.h40
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