aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomi Valkeinen2017-10-20 03:33:53 -0500
committerTomi Valkeinen2017-10-20 03:34:31 -0500
commitd556f70824727e4e0e4c8b04592b8f3a23733596 (patch)
tree4de49103e6f649735210ecd94fa71a90f92a9c65
parent3da8bff960177bbbd2dc86849846e3b6ec97bc79 (diff)
downloadexternal-libkmsxx-d556f70824727e4e0e4c8b04592b8f3a23733596.tar.gz
external-libkmsxx-d556f70824727e4e0e4c8b04592b8f3a23733596.tar.xz
external-libkmsxx-d556f70824727e4e0e4c8b04592b8f3a23733596.zip
Crtc: add set_mode() which doesn't take a fb
-rw-r--r--kms++/inc/kms++/crtc.h1
-rw-r--r--kms++/src/crtc.cpp22
-rw-r--r--py/pykms/pykmsbase.cpp3
3 files changed, 25 insertions, 1 deletions
diff --git a/kms++/inc/kms++/crtc.h b/kms++/inc/kms++/crtc.h
index c86fc88..ea20ef8 100644
--- a/kms++/inc/kms++/crtc.h
+++ b/kms++/inc/kms++/crtc.h
@@ -18,6 +18,7 @@ public:
18 18
19 const std::vector<Plane*>& get_possible_planes() const { return m_possible_planes; } 19 const std::vector<Plane*>& get_possible_planes() const { return m_possible_planes; }
20 20
21 int set_mode(Connector* conn, const Videomode& mode);
21 int set_mode(Connector* conn, Framebuffer& fb, const Videomode& mode); 22 int set_mode(Connector* conn, Framebuffer& fb, const Videomode& mode);
22 23
23 int set_plane(Plane *plane, Framebuffer &fb, 24 int set_plane(Plane *plane, Framebuffer &fb,
diff --git a/kms++/src/crtc.cpp b/kms++/src/crtc.cpp
index c391f69..f94216f 100644
--- a/kms++/src/crtc.cpp
+++ b/kms++/src/crtc.cpp
@@ -58,6 +58,28 @@ void Crtc::restore_mode(Connector* conn)
58 conns, 1, &c->mode); 58 conns, 1, &c->mode);
59} 59}
60 60
61int Crtc::set_mode(Connector* conn, const Videomode& mode)
62{
63 AtomicReq req(card());
64
65 unique_ptr<Blob> blob = mode.to_blob(card());
66
67 req.add(conn, {
68 { "CRTC_ID", this->id() },
69 });
70
71 req.add(this, {
72 { "ACTIVE", 1 },
73 { "MODE_ID", blob->id() },
74 });
75
76 int r = req.commit_sync(true);
77
78 refresh();
79
80 return r;
81}
82
61int Crtc::set_mode(Connector* conn, Framebuffer& fb, const Videomode& mode) 83int Crtc::set_mode(Connector* conn, Framebuffer& fb, const Videomode& mode)
62{ 84{
63 uint32_t conns[] = { conn->id() }; 85 uint32_t conns[] = { conn->id() };
diff --git a/py/pykms/pykmsbase.cpp b/py/pykms/pykmsbase.cpp
index 258167a..fe4bc46 100644
--- a/py/pykms/pykmsbase.cpp
+++ b/py/pykms/pykmsbase.cpp
@@ -50,7 +50,8 @@ void init_pykmsbase(py::module &m)
50 ; 50 ;
51 51
52 py::class_<Crtc, Crtc*>(m, "Crtc", py::base<DrmPropObject>()) 52 py::class_<Crtc, Crtc*>(m, "Crtc", py::base<DrmPropObject>())
53 .def("set_mode", &Crtc::set_mode) 53 .def("set_mode", (int (Crtc::*)(Connector*, const Videomode&))&Crtc::set_mode)
54 .def("set_mode", (int (Crtc::*)(Connector*, Framebuffer&, const Videomode&))&Crtc::set_mode)
54 .def("disable_mode", &Crtc::disable_mode) 55 .def("disable_mode", &Crtc::disable_mode)
55 .def("page_flip", 56 .def("page_flip",
56 [](Crtc* self, Framebuffer& fb, uint32_t data) 57 [](Crtc* self, Framebuffer& fb, uint32_t data)