diff options
author | Jacopo Mondi <jacopo@jmondi.org> | 2019-07-10 12:07:19 +0200 |
---|---|---|
committer | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2019-07-14 16:01:03 +0300 |
commit | f1199a1011a22f00e863473ae241c781f4bd999d (patch) | |
tree | 1201339db3d65fcd5d8ad9718c063b3abea5910e /src/libcamera/request.cpp | |
parent | 99e1e786b475f3d6f4f8d9f5cd21db6c524ba60f (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/request.cpp')
-rw-r--r-- | src/libcamera/request.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/libcamera/request.cpp b/src/libcamera/request.cpp index 19131472..ee2158fc 100644 --- a/src/libcamera/request.cpp +++ b/src/libcamera/request.cpp @@ -106,10 +106,15 @@ Request::~Request() * * \return 0 on success or a negative error code otherwise * \retval -EEXIST The request already contains a buffer for the stream + * \retval -EINVAL The buffer does not reference a valid Stream */ int Request::addBuffer(std::unique_ptr<Buffer> buffer) { Stream *stream = buffer->stream(); + if (!stream) { + LOG(Request, Error) << "Invalid stream reference"; + return -EINVAL; + } auto it = bufferMap_.find(stream); if (it != bufferMap_.end()) { |