diff options
Diffstat (limited to 'py/pykms')
-rw-r--r-- | py/pykms/__init__.py | 14 | ||||
-rw-r--r-- | py/pykms/pykmsomap.cpp | 24 |
2 files changed, 33 insertions, 5 deletions
diff --git a/py/pykms/__init__.py b/py/pykms/__init__.py index 41c1219..3b5f743 100644 --- a/py/pykms/__init__.py +++ b/py/pykms/__init__.py @@ -16,6 +16,20 @@ white = RGB(255, 255, 255) cyan = RGB(0, 255, 255) # +# Rotation enum +# + +class Rotation(int, Enum): + ROTATE_0 = 1 << 0 + ROTATE_90 = 1 << 1 + ROTATE_180 = 1 << 2 + ROTATE_270 = 1 << 3 + ROTATE_MASK = ROTATE_0 | ROTATE_90 | ROTATE_180 | ROTATE_270 + REFLECT_X = 1 << 4 + REFLECT_Y = 1 << 5 + REFLECT_MASK = REFLECT_X | REFLECT_Y + +# # DrmObject API extensions # diff --git a/py/pykms/pykmsomap.cpp b/py/pykms/pykmsomap.cpp index 7480c78..0c3a8ee 100644 --- a/py/pykms/pykmsomap.cpp +++ b/py/pykms/pykmsomap.cpp @@ -14,11 +14,25 @@ void init_pykmsomap(py::module &m) .def(py::init<>()) ; - py::class_<OmapFramebuffer>(m, "OmapFramebuffer", py::base<MappedFramebuffer>()) - .def(py::init<OmapCard&, uint32_t, uint32_t, const string&>(), - py::keep_alive<1, 2>()) // Keep Card alive until this is destructed - .def(py::init<OmapCard&, uint32_t, uint32_t, PixelFormat>(), - py::keep_alive<1, 2>()) // Keep OmapCard alive until this is destructed + py::class_<OmapFramebuffer> omapfb(m, "OmapFramebuffer", py::base<MappedFramebuffer>()); + + // XXX we should use py::arithmetic() here to support or and and operators, but it's not supported in the pybind11 we use + py::enum_<OmapFramebuffer::Flags>(omapfb, "Flags") + .value("None", OmapFramebuffer::Flags::None) + .value("Tiled", OmapFramebuffer::Flags::Tiled) + .value("MemContig", OmapFramebuffer::Flags::MemContig) + .value("MemTiler", OmapFramebuffer::Flags::MemTiler) + .value("MemPin", OmapFramebuffer::Flags::MemPin) + .export_values() + ; + + omapfb + .def(py::init<OmapCard&, uint32_t, uint32_t, const string&, OmapFramebuffer::Flags>(), + py::keep_alive<1, 2>(), // Keep Card alive until this is destructed + py::arg("card"), py::arg("width"), py::arg("height"), py::arg("fourcc"), py::arg("flags") = OmapFramebuffer::None) + .def(py::init<OmapCard&, uint32_t, uint32_t, PixelFormat, OmapFramebuffer::Flags>(), + py::keep_alive<1, 2>(), // Keep OmapCard alive until this is destructed + py::arg("card"), py::arg("width"), py::arg("height"), py::arg("pixfmt"), py::arg("flags") = OmapFramebuffer::None) .def_property_readonly("format", &OmapFramebuffer::format) .def_property_readonly("num_planes", &OmapFramebuffer::num_planes) .def("fd", &OmapFramebuffer::prime_fd) |