drm_hwcomposer: Add display field to Drmencoder
In the current implementation TryEncoderForDisplay just looks
at the crtc linked to the display, if that's not assigned to
a display it means the encoder could be used, otherwise iterate
to the list of possible_crtcs and find one which is not used.
This logic works fine when you have just one encoder connected to a
crtc but with two or more, like is the case when we attach a writeback
connector, we need to know if we already assigned the encoder to a
display.
Signed-off-by: Alexandru Gheorghe <alexandru-cosmin.gheorghe@arm.com>
diff --git a/drmencoder.h b/drmencoder.h
index 58ccbfb..aeab5ac 100644
--- a/drmencoder.h
+++ b/drmencoder.h
@@ -36,6 +36,8 @@
DrmCrtc *crtc() const;
void set_crtc(DrmCrtc *crtc);
+ bool can_bind(int display) const;
+ int display() const;
const std::vector<DrmCrtc *> &possible_crtcs() const {
return possible_crtcs_;
@@ -44,6 +46,7 @@
private:
uint32_t id_;
DrmCrtc *crtc_;
+ int display_;
std::vector<DrmCrtc *> possible_crtcs_;
};