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>
This commit is contained in:
committed by
Laurent Pinchart
parent
99e1e786b4
commit
f1199a1011
@@ -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) {
|
||||
@@ -289,6 +290,16 @@ Buffer::Buffer(unsigned int index, const Buffer *metadata)
|
||||
* \return The buffer index
|
||||
*/
|
||||
|
||||
/**
|
||||
* \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
|
||||
|
||||
Reference in New Issue
Block a user