summaryrefslogtreecommitdiff
path: root/kms++
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2019-06-17 02:31:28 +0300
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2021-09-05 00:54:49 +0300
commit70ed259ba057e629ad22ac93168a438dbd93113f (patch)
tree91df416b0d08c6231975e94a96da84a9c0df4ebc /kms++
parent77eedf7574809ce5edf4d4ea6aa55542b3045c02 (diff)
card: Add support for writeback connectors
Enable enumeration of writeback connectors if both libdrm and the device support it. The new Card::has_writeback() method report if the card support writeback connectors. Existing code that expect all connectors to model an output may be confused by the sudden availability of new connectors. To handle this issue, - add a KMSXX_DISABLE_WRITEBACK_CONNECTORS environment variable to disable enumeration of writeback connectors, similarly to universal planes ; and - ignore writeback connectors where no specific connector is requested (Card::get_first_connected_connector(), ResourceManager::reserve_connector() if no connector name is specified, and applications that use all connected outputs). Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'kms++')
-rw-r--r--kms++/inc/kms++/card.h2
-rw-r--r--kms++/src/card.cpp13
-rw-r--r--kms++/src/connector.cpp1
3 files changed, 16 insertions, 0 deletions
diff --git a/kms++/inc/kms++/card.h b/kms++/inc/kms++/card.h
index bf6f9bf..fc11e92 100644
--- a/kms++/inc/kms++/card.h
+++ b/kms++/inc/kms++/card.h
@@ -54,6 +54,7 @@ public:
bool has_universal_planes() const { return m_has_universal_planes; }
bool has_dumb_buffers() const { return m_has_dumb; }
bool has_kms() const;
+ bool has_writeback() const { return m_has_writeback; }
std::vector<Connector*> get_connectors() const { return m_connectors; }
std::vector<Encoder*> get_encoders() const { return m_encoders; }
@@ -92,6 +93,7 @@ private:
bool m_has_atomic;
bool m_has_universal_planes;
bool m_has_dumb;
+ bool m_has_writeback;
CardVersion m_version;
};
diff --git a/kms++/src/card.cpp b/kms++/src/card.cpp
index 935969d..6ad922a 100644
--- a/kms++/src/card.cpp
+++ b/kms++/src/card.cpp
@@ -216,6 +216,17 @@ void Card::setup()
m_has_atomic = false;
#endif
+#ifdef DRM_CLIENT_CAP_WRITEBACK_CONNECTORS
+ if (getenv("KMSXX_DISABLE_WRITEBACK_CONNECTORS") == 0) {
+ r = drmSetClientCap(m_fd, DRM_CLIENT_CAP_WRITEBACK_CONNECTORS, 1);
+ m_has_writeback = r == 0;
+ } else {
+ m_has_writeback = false;
+ }
+#else
+ m_has_writeback = false;
+#endif
+
uint64_t has_dumb;
r = drmGetCap(m_fd, DRM_CAP_DUMB_BUFFER, &has_dumb);
m_has_dumb = r == 0 && has_dumb;
@@ -315,6 +326,8 @@ void Card::restore_modes()
Connector* Card::get_first_connected_connector() const
{
for (auto c : m_connectors) {
+ if (c->connector_type() == DRM_MODE_CONNECTOR_WRITEBACK)
+ continue;
if (c->connected())
return c;
}
diff --git a/kms++/src/connector.cpp b/kms++/src/connector.cpp
index 92bab80..522851a 100644
--- a/kms++/src/connector.cpp
+++ b/kms++/src/connector.cpp
@@ -35,6 +35,7 @@ static const map<int, string> connector_names = {
{ DRM_MODE_CONNECTOR_VIRTUAL, "Virtual" },
{ DRM_MODE_CONNECTOR_DSI, "DSI" },
{ DRM_MODE_CONNECTOR_DPI, "DPI" },
+ { DRM_MODE_CONNECTOR_WRITEBACK, "writeback" },
};
static const map<int, string> connection_str = {