summaryrefslogtreecommitdiff
path: root/py
diff options
context:
space:
mode:
Diffstat (limited to 'py')
-rw-r--r--py/CMakeLists.txt8
-rw-r--r--py/pykms.cpp7
-rw-r--r--py/pykmsomap.cpp21
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
+ ;
+}