Crtc: add set_mode() which doesn't take a fb
authorTomi Valkeinen <tomi.valkeinen@ti.com>
Fri, 20 Oct 2017 08:33:53 +0000 (11:33 +0300)
committerTomi Valkeinen <tomi.valkeinen@ti.com>
Fri, 20 Oct 2017 08:34:31 +0000 (11:34 +0300)
kms++/inc/kms++/crtc.h
kms++/src/crtc.cpp
py/pykms/pykmsbase.cpp

index c86fc8877c00ebeb6eb76c8e6fd3d6c10f5560e1..ea20ef869f82f78014d73d47bbec64e00f5040d7 100644 (file)
@@ -18,6 +18,7 @@ public:
 
        const std::vector<Plane*>& get_possible_planes() const { return m_possible_planes; }
 
+       int set_mode(Connector* conn, const Videomode& mode);
        int set_mode(Connector* conn, Framebuffer& fb, const Videomode& mode);
 
        int set_plane(Plane *plane, Framebuffer &fb,
index c391f69de020649bef607483c54b390132503701..f94216f1853e90a8cf0c15a2b66d2641921b513e 100644 (file)
@@ -58,6 +58,28 @@ void Crtc::restore_mode(Connector* conn)
                       conns, 1, &c->mode);
 }
 
+int Crtc::set_mode(Connector* conn, const Videomode& mode)
+{
+       AtomicReq req(card());
+
+       unique_ptr<Blob> blob = mode.to_blob(card());
+
+       req.add(conn, {
+                       { "CRTC_ID", this->id() },
+               });
+
+       req.add(this, {
+                       { "ACTIVE", 1 },
+                       { "MODE_ID", blob->id() },
+               });
+
+       int r = req.commit_sync(true);
+
+       refresh();
+
+       return r;
+}
+
 int Crtc::set_mode(Connector* conn, Framebuffer& fb, const Videomode& mode)
 {
        uint32_t conns[] = { conn->id() };
index 258167a9834b11a8527789aa5bcc961ace39a842..fe4bc463ab699e899c05f1a49b8ff328b5ced4e9 100644 (file)
@@ -50,7 +50,8 @@ void init_pykmsbase(py::module &m)
                        ;
 
        py::class_<Crtc, Crtc*>(m, "Crtc",  py::base<DrmPropObject>())
-                       .def("set_mode", &Crtc::set_mode)
+                       .def("set_mode", (int (Crtc::*)(Connector*, const Videomode&))&Crtc::set_mode)
+                       .def("set_mode", (int (Crtc::*)(Connector*, Framebuffer&, const Videomode&))&Crtc::set_mode)
                        .def("disable_mode", &Crtc::disable_mode)
                        .def("page_flip",
                             [](Crtc* self, Framebuffer& fb, uint32_t data)