aboutsummaryrefslogtreecommitdiffstats
path: root/py/pykms
diff options
context:
space:
mode:
Diffstat (limited to 'py/pykms')
-rw-r--r--py/pykms/__init__.py2
-rw-r--r--py/pykms/pykms.cpp5
-rw-r--r--py/pykms/pykmsbase.cpp18
3 files changed, 7 insertions, 18 deletions
diff --git a/py/pykms/__init__.py b/py/pykms/__init__.py
index 3b5f743..746c917 100644
--- a/py/pykms/__init__.py
+++ b/py/pykms/__init__.py
@@ -130,7 +130,7 @@ def __card_read_events(self):
130 130
131 seq = vbl_tuple[3] 131 seq = vbl_tuple[3]
132 time = vbl_tuple[1] + vbl_tuple[2] / 1000000.0; 132 time = vbl_tuple[1] + vbl_tuple[2] / 1000000.0;
133 udata = pykms.__ob_unpack_helper(vbl_tuple[0]) 133 udata = vbl_tuple[0]
134 134
135 yield DrmEvent(type, seq, time, udata) 135 yield DrmEvent(type, seq, time, udata)
136 136
diff --git a/py/pykms/pykms.cpp b/py/pykms/pykms.cpp
index 7752f19..1e54c9b 100644
--- a/py/pykms/pykms.cpp
+++ b/py/pykms/pykms.cpp
@@ -20,11 +20,6 @@ PYBIND11_PLUGIN(pykms) {
20 20
21 init_pykmsbase(m); 21 init_pykmsbase(m);
22 22
23 m.def("__ob_unpack_helper", [](uint64_t v) {
24 // AtomicReq::commit or Crtc::page_flip added a ref, so we can use borrowed = false
25 return py::object((PyObject*)v, false);
26 });
27
28 init_pykmstest(m); 23 init_pykmstest(m);
29 24
30 init_pyvid(m); 25 init_pyvid(m);
diff --git a/py/pykms/pykmsbase.cpp b/py/pykms/pykmsbase.cpp
index 604e07c..e53fe54 100644
--- a/py/pykms/pykmsbase.cpp
+++ b/py/pykms/pykmsbase.cpp
@@ -53,13 +53,10 @@ void init_pykmsbase(py::module &m)
53 .def("set_mode", &Crtc::set_mode) 53 .def("set_mode", &Crtc::set_mode)
54 .def("disable_mode", &Crtc::disable_mode) 54 .def("disable_mode", &Crtc::disable_mode)
55 .def("page_flip", 55 .def("page_flip",
56 [](Crtc* self, Framebuffer& fb, py::object ob) 56 [](Crtc* self, Framebuffer& fb, uint32_t data)
57 { 57 {
58 // This adds a ref to the object, and must be unpacked with __ob_unpack_helper() 58 self->page_flip(fb, (void*)(intptr_t)data);
59 PyObject* pob = ob.ptr(); 59 }, py::arg("fb"), py::arg("data") = 0)
60 Py_XINCREF(pob);
61 self->page_flip(fb, pob);
62 })
63 .def("set_plane", &Crtc::set_plane) 60 .def("set_plane", &Crtc::set_plane)
64 .def_property_readonly("possible_planes", &Crtc::get_possible_planes) 61 .def_property_readonly("possible_planes", &Crtc::get_possible_planes)
65 .def_property_readonly("primary_plane", &Crtc::get_primary_plane) 62 .def_property_readonly("primary_plane", &Crtc::get_primary_plane)
@@ -196,13 +193,10 @@ void init_pykmsbase(py::module &m)
196 .def("add", (void (AtomicReq::*)(DrmPropObject*, const map<string, uint64_t>&)) &AtomicReq::add) 193 .def("add", (void (AtomicReq::*)(DrmPropObject*, const map<string, uint64_t>&)) &AtomicReq::add)
197 .def("test", &AtomicReq::test, py::arg("allow_modeset") = false) 194 .def("test", &AtomicReq::test, py::arg("allow_modeset") = false)
198 .def("commit", 195 .def("commit",
199 [](AtomicReq* self, py::object ob, bool allow) 196 [](AtomicReq* self, uint32_t data, bool allow)
200 { 197 {
201 // This adds a ref to the object, and must be unpacked with __ob_unpack_helper() 198 return self->commit((void*)(intptr_t)data, allow);
202 PyObject* pob = ob.ptr(); 199 }, py::arg("data") = 0, py::arg("allow_modeset") = false)
203 Py_XINCREF(pob);
204 return self->commit(pob, allow);
205 }, py::arg("data"), py::arg("allow_modeset") = false)
206 .def("commit_sync", &AtomicReq::commit_sync, py::arg("allow_modeset") = false) 200 .def("commit_sync", &AtomicReq::commit_sync, py::arg("allow_modeset") = false)
207 ; 201 ;
208} 202}