From f1199a1011a22f00e863473ae241c781f4bd999d Mon Sep 17 00:00:00 2001 From: Jacopo Mondi Date: Wed, 10 Jul 2019 12:07:19 +0200 Subject: libcamera: buffer: Add dmabuf file descriptors MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In addition to referencing buffer memory by index, add support to referencing it using dmabuf file descriptors. This will be used to reference buffer memory allocated outside of libcamera and import it. The dmabuf file descriptors are stored in an array in the Buffer class, and a new Stream::createBuffer() overload is added to construct a buffer from dmabuf file descriptor. Signed-off-by: Jacopo Mondi Signed-off-by: Laurent Pinchart Reviewed-by: Niklas Söderlund --- include/libcamera/buffer.h | 3 +++ include/libcamera/stream.h | 1 + 2 files changed, 4 insertions(+) (limited to 'include') diff --git a/include/libcamera/buffer.h b/include/libcamera/buffer.h index f5ba6207..f8569a6b 100644 --- a/include/libcamera/buffer.h +++ b/include/libcamera/buffer.h @@ -7,6 +7,7 @@ #ifndef __LIBCAMERA_BUFFER_H__ #define __LIBCAMERA_BUFFER_H__ +#include #include #include @@ -75,6 +76,7 @@ public: Buffer &operator=(const Buffer &) = delete; unsigned int index() const { return index_; } + const std::array &dmabufs() const { return dmabuf_; } unsigned int bytesused() const { return bytesused_; } uint64_t timestamp() const { return timestamp_; } @@ -95,6 +97,7 @@ private: void setRequest(Request *request) { request_ = request; } unsigned int index_; + std::array dmabuf_; unsigned int bytesused_; uint64_t timestamp_; diff --git a/include/libcamera/stream.h b/include/libcamera/stream.h index 08eb8cc7..1883d9e9 100644 --- a/include/libcamera/stream.h +++ b/include/libcamera/stream.h @@ -75,6 +75,7 @@ public: Stream(); std::unique_ptr createBuffer(unsigned int index); + std::unique_ptr createBuffer(const std::array &fds); BufferPool &bufferPool() { return bufferPool_; } std::vector &buffers() { return bufferPool_.buffers(); } -- cgit v1.2.1