summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomi Valkeinen <tomi.valkeinen@ti.com>2016-11-22 13:13:20 +0200
committerTomi Valkeinen <tomi.valkeinen@ti.com>2016-11-22 13:13:20 +0200
commit4934864106c4c4ba56559ed2096970e1ea5d7d94 (patch)
tree02124782b33e2b57f3b7ae3c0f0bf45e591f69bb
parent1e96518a1ee7fc65f212fa1fa76805003bed34e1 (diff)
py: Add OmapCard & OmapFramebuffer support
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
-rw-r--r--CMakeLists.txt4
-rw-r--r--py/CMakeLists.txt8
-rw-r--r--py/pykms.cpp7
-rw-r--r--py/pykmsomap.cpp21
4 files changed, 39 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 30cb5f5..dccdf14 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -59,7 +59,11 @@ endif()
find_package(PkgConfig REQUIRED)
pkg_check_modules(LIBDRM libdrm>=2.4.64 REQUIRED)
+
pkg_check_modules(LIBDRM_OMAP libdrm_omap)
+if(LIBDRM_OMAP_FOUND)
+ add_definitions(-DHAS_LIBDRM_OMAP)
+endif()
enable_testing()
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
+ ;
+}