diff options
-rw-r--r-- | kms++/inc/kms++/card.h | 2 | ||||
-rw-r--r-- | kms++/src/card.cpp | 13 | ||||
-rw-r--r-- | kms++/src/connector.cpp | 1 | ||||
-rw-r--r-- | kms++util/meson.build | 2 | ||||
-rw-r--r-- | kms++util/src/resourcemanager.cpp | 5 | ||||
-rw-r--r-- | py/pykms/pykmsbase.cpp | 1 | ||||
-rw-r--r-- | utils/kmsblank.cpp | 5 | ||||
-rw-r--r-- | utils/kmstest.cpp | 4 | ||||
-rw-r--r-- | utils/meson.build | 2 |
9 files changed, 33 insertions, 2 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 = { diff --git a/kms++util/meson.build b/kms++util/meson.build index 9df75e1..6dfce8f 100644 --- a/kms++util/meson.build +++ b/kms++util/meson.build @@ -34,7 +34,7 @@ if thread_dep.found() libkmsxxutil_args += [ '-DHAS_PTHREAD' ] endif -libkmsxxutil_deps = [ libkmsxx_dep, libfmt_dep, thread_dep ] +libkmsxxutil_deps = [ libkmsxx_dep, libdrm_dep, libfmt_dep, thread_dep ] libkmsxxutil = library('kms++util', libkmsxxutil_sources, diff --git a/kms++util/src/resourcemanager.cpp b/kms++util/src/resourcemanager.cpp index 5a9f016..01edaf3 100644 --- a/kms++util/src/resourcemanager.cpp +++ b/kms++util/src/resourcemanager.cpp @@ -2,6 +2,8 @@ #include <algorithm> #include <kms++util/strhelpers.h> +#include <xf86drmMode.h> + using namespace kms; using namespace std; @@ -20,6 +22,9 @@ void ResourceManager::reset() static Connector* find_connector(Card& card, const set<Connector*> reserved) { for (Connector* conn : card.get_connectors()) { + if (conn->connector_type() == DRM_MODE_CONNECTOR_WRITEBACK) + continue; + if (!conn->connected()) continue; diff --git a/py/pykms/pykmsbase.cpp b/py/pykms/pykmsbase.cpp index 088d267..5df6fb3 100644 --- a/py/pykms/pykmsbase.cpp +++ b/py/pykms/pykmsbase.cpp @@ -51,6 +51,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); diff --git a/utils/kmsblank.cpp b/utils/kmsblank.cpp index d9a3460..207d807 100644 --- a/utils/kmsblank.cpp +++ b/utils/kmsblank.cpp @@ -5,6 +5,8 @@ #include <kms++/kms++.h> #include <kms++util/kms++util.h> +#include <xf86drmMode.h> + using namespace std; using namespace kms; @@ -74,6 +76,9 @@ int main(int argc, char** argv) while (true) { for (Connector* conn : conns) { + if (conn->connector_type() == DRM_MODE_CONNECTOR_WRITEBACK) + continue; + if (!conn->connected()) { printf("Connector %u not connected\n", conn->idx()); continue; diff --git a/utils/kmstest.cpp b/utils/kmstest.cpp index 3f1716f..15db072 100644 --- a/utils/kmstest.cpp +++ b/utils/kmstest.cpp @@ -17,6 +17,8 @@ #include <kms++util/kms++util.h> +#include <xf86drmMode.h> + using namespace std; using namespace kms; @@ -618,6 +620,8 @@ static vector<OutputInfo> setups_to_outputs(Card& card, ResourceManager& resman, if (outputs.empty()) { // no outputs defined, show a pattern on all connected screens for (Connector* conn : card.get_connectors()) { + if (conn->connector_type() == DRM_MODE_CONNECTOR_WRITEBACK) + continue; if (!conn->connected()) continue; diff --git a/utils/meson.build b/utils/meson.build index b1e7918..e3f5821 100644 --- a/utils/meson.build +++ b/utils/meson.build @@ -1,4 +1,4 @@ -common_deps = [ libkmsxx_dep, libkmsxxutil_dep, libfmt_dep ] +common_deps = [ libkmsxx_dep, libkmsxxutil_dep, libdrm_dep, libfmt_dep ] libevdev_dep = dependency('libevdev', required : false) |