drm_hwcomposer: Parse and store possible_clones information
drmModeEncoder has a field called possible_clones. It's a bit mask
which tells if the encoder could be simultaneously connected, to the
same CRTC, with the encoders specified in the possible_clones mask.
Signed-off-by: Alexandru Gheorghe <alexandru-cosmin.gheorghe@arm.com>
diff --git a/drmdevice.cpp b/drmdevice.cpp
index 7a54c9d..25273ac 100644
--- a/drmdevice.cpp
+++ b/drmdevice.cpp
@@ -96,6 +96,7 @@
crtcs_.emplace_back(std::move(crtc));
}
+ std::vector<int> possible_clones;
for (int i = 0; !ret && i < res->count_encoders; ++i) {
drmModeEncoderPtr e = drmModeGetEncoder(fd(), res->encoders[i]);
if (!e) {
@@ -116,12 +117,18 @@
std::unique_ptr<DrmEncoder> enc(
new DrmEncoder(e, current_crtc, possible_crtcs));
-
+ possible_clones.push_back(e->possible_clones);
drmModeFreeEncoder(e);
encoders_.emplace_back(std::move(enc));
}
+ for (unsigned int i = 0; i < encoders_.size(); i++) {
+ for (unsigned int j = 0; j < encoders_.size(); j++)
+ if (possible_clones[i] & (1 << j))
+ encoders_[i]->AddPossibleClone(encoders_[j].get());
+ }
+
for (int i = 0; !ret && i < res->count_connectors; ++i) {
drmModeConnectorPtr c = drmModeGetConnector(fd(), res->connectors[i]);
if (!c) {