summaryrefslogtreecommitdiff
path: root/src/libcamera/buffer.cpp
diff options
context:
space:
mode:
authorJacopo Mondi <jacopo@jmondi.org>2019-07-10 12:07:19 +0200
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2019-07-14 16:01:03 +0300
commitf1199a1011a22f00e863473ae241c781f4bd999d (patch)
tree1201339db3d65fcd5d8ad9718c063b3abea5910e /src/libcamera/buffer.cpp
parent99e1e786b475f3d6f4f8d9f5cd21db6c524ba60f (diff)
libcamera: buffer: Add dmabuf file descriptors
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 <jacopo@jmondi.org> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Diffstat (limited to 'src/libcamera/buffer.cpp')
-rw-r--r--src/libcamera/buffer.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/libcamera/buffer.cpp b/src/libcamera/buffer.cpp
index ecbf2524..99358633 100644
--- a/src/libcamera/buffer.cpp
+++ b/src/libcamera/buffer.cpp
@@ -269,7 +269,8 @@ void BufferPool::destroyBuffers()
* for a stream with Stream::createBuffer().
*/
Buffer::Buffer(unsigned int index, const Buffer *metadata)
- : index_(index), status_(Buffer::BufferSuccess), request_(nullptr),
+ : index_(index), dmabuf_({ -1, -1, -1 }),
+ status_(Buffer::BufferSuccess), request_(nullptr),
stream_(nullptr)
{
if (metadata) {
@@ -290,6 +291,16 @@ Buffer::Buffer(unsigned int index, const Buffer *metadata)
*/
/**
+ * \fn Buffer::dmabufs()
+ * \brief Retrieve the dmabuf file descriptors for all buffer planes
+ *
+ * The dmabufs array contains one dmabuf file descriptor per plane. Unused
+ * entries are set to -1.
+ *
+ * \return The dmabuf file descriptors
+ */
+
+/**
* \fn Buffer::bytesused()
* \brief Retrieve the number of bytes occupied by the data in the buffer
* \return Number of bytes occupied in the buffer