summaryrefslogtreecommitdiff
path: root/src/libcamera/pipeline_handler.cpp
diff options
context:
space:
mode:
authorNiklas Söderlund <niklas.soderlund@ragnatech.se>2019-12-30 00:49:14 +0100
committerNiklas Söderlund <niklas.soderlund@ragnatech.se>2020-01-12 16:10:37 +0100
commite9e6135d97d0afd3191e59578a71d51db14d6ad4 (patch)
treed939f671cbce33540814fe16e4999a4f2a024eac /src/libcamera/pipeline_handler.cpp
parent6c69bf982e607db555d1c3d96aa356c1c933de0b (diff)
libcamera: pipeline: Add FrameBuffer handlers
Extend the pipeline handlers to support the FrameBuffer API with three new methods to handle allocation, importing and freeing of buffers. The new methods will replace allocateBuffers() and freeBuffers(). The FrameBuffer API will use the methods on a stream level and either allocate or import buffers for each active stream controlled from the Camera class and an upcoming FrameBufferAllocator helper. With this new API the implementation in pipeline handlers can be made simpler as all streams don't need to be handled in allocateBuffers(). Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'src/libcamera/pipeline_handler.cpp')
-rw-r--r--src/libcamera/pipeline_handler.cpp72
1 files changed, 72 insertions, 0 deletions
diff --git a/src/libcamera/pipeline_handler.cpp b/src/libcamera/pipeline_handler.cpp
index 698dd525..11d68456 100644
--- a/src/libcamera/pipeline_handler.cpp
+++ b/src/libcamera/pipeline_handler.cpp
@@ -290,6 +290,78 @@ const ControlInfoMap &PipelineHandler::controls(Camera *camera)
*/
/**
+ * \fn PipelineHandler::exportFrameBuffers()
+ * \brief Allocate buffers for \a stream
+ * \param[in] camera The camera
+ * \param[in] stream The stream to allocate buffers for
+ * \param[out] buffers Array of buffers successfully allocated
+ *
+ * This method allocates buffers for the \a stream from the devices associated
+ * with the stream in the corresponding pipeline handler. Those buffers shall be
+ * suitable to be added to a Request for the stream, and shall be mappable to
+ * the CPU through their associated dmabufs with mmap().
+ *
+ * The method may only be called after the Camera has been configured and before
+ * it gets started, or after it gets stopped. It shall be called only for
+ * streams that are part of the active camera configuration, and at most once
+ * per stream until buffers for the stream are freed with freeFrameBuffers().
+ *
+ * exportFrameBuffers() shall also allocate all other resources required by
+ * the pipeline handler for the stream to prepare for starting the Camera. This
+ * responsibility is shared with importFrameBuffers(), and one and only one of
+ * those two methods shall be called for each stream until the buffers are
+ * freed. The pipeline handler shall support all combinations of
+ * exportFrameBuffers() and importFrameBuffers() for the streams contained in
+ * any camera configuration.
+ *
+ * The only intended caller is the FrameBufferAllocator helper.
+ *
+ * \return 0 on success or a negative error code otherwise
+ */
+
+/**
+ * \fn PipelineHandler::importFrameBuffers()
+ * \brief Prepare \a stream to use external buffers
+ * \param[in] camera The camera
+ * \param[in] stream The stream to prepare for import
+ *
+ * This method prepares the pipeline handler to use buffers provided by the
+ * application for the \a stream.
+ *
+ * The method may only be called after the Camera has been configured and before
+ * it gets started, or after it gets stopped. It shall be called only for
+ * streams that are part of the active camera configuration, and at most once
+ * per stream until buffers for the stream are freed with freeFrameBuffers().
+ *
+ * importFrameBuffers() shall also allocate all other resources required by the
+ * pipeline handler for the stream to prepare for starting the Camera. This
+ * responsibility is shared with exportFrameBuffers(), and one and only one of
+ * those two methods shall be called for each stream until the buffers are
+ * freed. The pipeline handler shall support all combinations of
+ * exportFrameBuffers() and importFrameBuffers() for the streams contained in
+ * any camera configuration.
+ *
+ * The only intended caller is Camera::start().
+ *
+ * \return 0 on success or a negative error code otherwise
+ */
+
+/**
+ * \fn PipelineHandler::freeFrameBuffers()
+ * \brief Free buffers allocated from the stream
+ * \param[in] camera The camera
+ * \param[in] stream The stream to free buffers for
+ *
+ * This method shall free all buffers and all other resources allocated for the
+ * \a stream by exportFrameBuffers() or importFrameBuffers(). It shall be
+ * called only after a successful call to either of these two methods, and only
+ * once per stream.
+ *
+ * The only intended callers are Camera::stop() and the FrameBufferAllocator
+ * helper.
+ */
+
+/**
* \fn PipelineHandler::allocateBuffers()
* \brief Allocate buffers for a stream
* \param[in] camera The camera the \a stream belongs to