summaryrefslogtreecommitdiff
path: root/py
diff options
context:
space:
mode:
authorNoralf Trønnes <noralf@tronnes.org>2021-07-19 18:17:54 +0200
committerNoralf Trønnes <noralf@tronnes.org>2021-07-19 18:26:43 +0200
commit60586e12ad31a7241fd531eee0e41ef20625f7e3 (patch)
tree68d151aa54c458c77fc1ca6d46c8cb61909c9278 /py
parent43e03aacfa211eb56037b68da66e79b162491c1b (diff)
py: Framebuffer: Add flush and __repr__
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Diffstat (limited to 'py')
-rw-r--r--py/pykms/pykmsbase.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/py/pykms/pykmsbase.cpp b/py/pykms/pykmsbase.cpp
index 382ef6f..b3ada1b 100644
--- a/py/pykms/pykmsbase.cpp
+++ b/py/pykms/pykmsbase.cpp
@@ -148,6 +148,9 @@ void init_pykmsbase(py::module& m)
.def("offset", &Framebuffer::offset)
.def("fd", &Framebuffer::prime_fd)
+ .def("flush", (void (Framebuffer::*)(void)) & Framebuffer::flush)
+ .def("flush", (void (Framebuffer::*)(uint32_t x, uint32_t y, uint32_t width, uint32_t height)) & Framebuffer::flush)
+
// XXX pybind11 doesn't support a base object (DrmObject) with custom holder-type,
// and a subclass with standard holder-type.
// So we just copy the DrmObject members here.
@@ -161,6 +164,7 @@ void init_pykmsbase(py::module& m)
py::keep_alive<1, 2>()) // Keep Card alive until this is destructed
.def(py::init<Card&, uint32_t, uint32_t, PixelFormat>(),
py::keep_alive<1, 2>()) // Keep Card alive until this is destructed
+ .def("__repr__", [](const DumbFramebuffer& o) { return "<pykms.DumbFramebuffer " + to_string(o.id()) + ">"; })
;
py::class_<DmabufFramebuffer, Framebuffer>(m, "DmabufFramebuffer")
@@ -168,6 +172,7 @@ void init_pykmsbase(py::module& m)
py::keep_alive<1, 2>()) // Keep Card alive until this is destructed
.def(py::init<Card&, uint32_t, uint32_t, PixelFormat, vector<int>, vector<uint32_t>, vector<uint32_t>>(),
py::keep_alive<1, 2>()) // Keep Card alive until this is destructed
+ .def("__repr__", [](const DmabufFramebuffer& o) { return "<pykms.DmabufFramebuffer " + to_string(o.id()) + ">"; })
;
py::enum_<PixelFormat>(m, "PixelFormat")