]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - android/external-libkmsxx.git/commitdiff
py: Add OmapCard & OmapFramebuffer support
authorTomi Valkeinen <tomi.valkeinen@ti.com>
Tue, 22 Nov 2016 11:13:20 +0000 (13:13 +0200)
committerTomi Valkeinen <tomi.valkeinen@ti.com>
Tue, 22 Nov 2016 11:13:20 +0000 (13:13 +0200)
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
CMakeLists.txt
py/CMakeLists.txt
py/pykms.cpp
py/pykmsomap.cpp [new file with mode: 0644]

index 30cb5f53c6cd9e307ed9f6279c8b2d9fcc15a956..dccdf14d177acd45a02a2563eb06f4f25abd52b8 100644 (file)
@@ -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()
 
index 0cb4b99e06cedbe2358c4a8935bc82c62324950f..69bb845aa3023c6ebc5b8335c9138bf695bd42cc 100644 (file)
@@ -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
index c759d236cc966f5281436705fc886519700a095b..219903926521ca51a64877ac7cf2a92aab3b1ff4 100644 (file)
@@ -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 (file)
index 0000000..525834b
--- /dev/null
@@ -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
+                       ;
+}