From 3037dba80d888a0322d8ebf4e9728800fc314275 Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Sun, 12 Feb 2017 01:11:41 +0200 Subject: [HACK] py: Expose Videomode::to_blob method Returning the blob through an std::unique_ptr<> causes issues with pybind11. Return the blob pointer directly as a workaround while the root cause is investigated and fixed. Signed-off-by: Laurent Pinchart --- kms++/inc/kms++/videomode.h | 2 +- kms++/src/videomode.cpp | 5 +++-- py/pykms/pykmsbase.cpp | 1 + 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/kms++/inc/kms++/videomode.h b/kms++/inc/kms++/videomode.h index 39e5639..085c23a 100644 --- a/kms++/inc/kms++/videomode.h +++ b/kms++/inc/kms++/videomode.h @@ -29,7 +29,7 @@ struct Videomode uint32_t flags; // DRM_MODE_FLAG_* uint32_t type; // DRM_MODE_TYPE_* - std::unique_ptr to_blob(Card& card) const; + Blob *to_blob(Card& card) const; uint16_t hfp() const { return hsync_start - hdisplay; } uint16_t hsw() const { return hsync_end - hsync_start; } diff --git a/kms++/src/videomode.cpp b/kms++/src/videomode.cpp index 4964a57..98754e0 100644 --- a/kms++/src/videomode.cpp +++ b/kms++/src/videomode.cpp @@ -10,11 +10,12 @@ using namespace std; namespace kms { -unique_ptr Videomode::to_blob(Card& card) const +Blob *Videomode::to_blob(Card& card) const { drmModeModeInfo drm_mode = video_mode_to_drm_mode(*this); + Blob *blob = new Blob(card, &drm_mode, sizeof(drm_mode)); - return unique_ptr(new Blob(card, &drm_mode, sizeof(drm_mode))); + return blob; } float Videomode::calculated_vrefresh() const diff --git a/py/pykms/pykmsbase.cpp b/py/pykms/pykmsbase.cpp index 090c212..1492e53 100644 --- a/py/pykms/pykmsbase.cpp +++ b/py/pykms/pykmsbase.cpp @@ -148,6 +148,7 @@ void init_pykmsbase(py::module &m) py::class_(m, "Videomode") .def(py::init<>()) + .def("blob", &Videomode::to_blob) .def_readwrite("name", &Videomode::name) -- cgit v1.2.3