diff options
author | Tomi Valkeinen <tomi.valkeinen@ti.com> | 2016-11-22 13:13:20 +0200 |
---|---|---|
committer | Tomi Valkeinen <tomi.valkeinen@ti.com> | 2016-11-22 13:13:20 +0200 |
commit | 4934864106c4c4ba56559ed2096970e1ea5d7d94 (patch) | |
tree | 02124782b33e2b57f3b7ae3c0f0bf45e591f69bb /py | |
parent | 1e96518a1ee7fc65f212fa1fa76805003bed34e1 (diff) |
py: Add OmapCard & OmapFramebuffer support
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Diffstat (limited to 'py')
-rw-r--r-- | py/CMakeLists.txt | 8 | ||||
-rw-r--r-- | py/pykms.cpp | 7 | ||||
-rw-r--r-- | py/pykmsomap.cpp | 21 |
3 files changed, 35 insertions, 1 deletions
diff --git a/py/CMakeLists.txt b/py/CMakeLists.txt index 0cb4b99..69bb845 100644 --- a/py/CMakeLists.txt +++ b/py/CMakeLists.txt @@ -10,7 +10,13 @@ endif() include_directories(${PROJECT_SOURCE_DIR}/ext/pybind11/include) -add_library(pykms SHARED pykms.cpp pykmsbase.cpp pykmsutil.cpp pyvid.cpp) +set(SRCS pykms.cpp pykmsbase.cpp pykmsutil.cpp pyvid.cpp) + +if(LIBDRM_OMAP_FOUND) + set(SRCS ${SRCS} pykmsomap.cpp) +endif() + +add_library(pykms SHARED ${SRCS}) target_link_libraries(pykms kms++ kms++util ${LIBDRM_LIBRARIES}) # Don't add a 'lib' prefix to the shared library diff --git a/py/pykms.cpp b/py/pykms.cpp index c759d23..2199039 100644 --- a/py/pykms.cpp +++ b/py/pykms.cpp @@ -11,6 +11,10 @@ void init_pykmstest(py::module &m); void init_pykmsbase(py::module &m); void init_pyvid(py::module &m); +#if HAS_LIBDRM_OMAP +void init_pykmsomap(py::module &m); +#endif + class PyPageFlipHandlerBase : PageFlipHandlerBase { public: @@ -42,5 +46,8 @@ PYBIND11_PLUGIN(pykms) { init_pyvid(m); +#if HAS_LIBDRM_OMAP + init_pykmsomap(m); +#endif return m.ptr(); } diff --git a/py/pykmsomap.cpp b/py/pykmsomap.cpp new file mode 100644 index 0000000..525834b --- /dev/null +++ b/py/pykmsomap.cpp @@ -0,0 +1,21 @@ +#include <pybind11/pybind11.h> +#include <pybind11/stl.h> +#include <kms++/kms++.h> +#include <kms++/omap/omapkms++.h> + +namespace py = pybind11; + +using namespace kms; +using namespace std; + +void init_pykmsomap(py::module &m) +{ + py::class_<OmapCard>(m, "OmapCard", py::base<Card>()) + .def(py::init<>()) + ; + + py::class_<OmapFramebuffer>(m, "OmapFramebuffer", py::base<MappedFramebuffer>()) + .def(py::init<OmapCard&, uint32_t, uint32_t, PixelFormat>(), + py::keep_alive<1, 2>()) // Keep OmapCard alive until this is destructed + ; +} |