summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2019-06-17 02:31:28 +0300
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2020-08-06 05:09:16 +0300
commitb03efda32a4b79149e7e0b58cbe73bfd56786da3 (patch)
tree3b3fe0a2987f0ef93db35358d6c2e88813e244d3
parent41ffb17e22fba40b43575dbf1a516067878ed9e5 (diff)
card: Add support for writeback connectors
Add a Card::has_writeback() method to report if the card support writeback connectors. Similarly to universal planes, add a KMSXX_DISABLE_WRITEBACK_CONNECTORS environment variable to disable enumeration of writeback connectors to avoid confusing existing code that expects all connectors to model an output. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
-rw-r--r--kms++/inc/kms++/card.h2
-rw-r--r--kms++/src/card.cpp11
-rw-r--r--kms++/src/connector.cpp1
-rw-r--r--py/pykms/pykmsbase.cpp1
4 files changed, 15 insertions, 0 deletions
diff --git a/kms++/inc/kms++/card.h b/kms++/inc/kms++/card.h
index e9f90e3..83009ad 100644
--- a/kms++/inc/kms++/card.h
+++ b/kms++/inc/kms++/card.h
@@ -53,6 +53,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 3a7ab70..1221408 100644
--- a/kms++/src/card.cpp
+++ b/kms++/src/card.cpp
@@ -217,6 +217,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;
diff --git a/kms++/src/connector.cpp b/kms++/src/connector.cpp
index a408619..6f5f79f 100644
--- a/kms++/src/connector.cpp
+++ b/kms++/src/connector.cpp
@@ -36,6 +36,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 = {
diff --git a/py/pykms/pykmsbase.cpp b/py/pykms/pykmsbase.cpp
index 0448e02..8276b72 100644
--- a/py/pykms/pykmsbase.cpp
+++ b/py/pykms/pykmsbase.cpp
@@ -47,6 +47,7 @@ void init_pykmsbase(py::module &m)
})
.def_property_readonly("has_atomic", &Card::has_atomic)
+ .def_property_readonly("has_writeback", &Card::has_writeback)
.def("get_prop", (Property* (Card::*)(uint32_t) const)&Card::get_prop)
.def_property_readonly("version_name", &Card::version_name);