summaryrefslogtreecommitdiff
path: root/src/libcamera/pipeline_handler.cpp
diff options
context:
space:
mode:
authorNiklas Söderlund <niklas.soderlund@ragnatech.se>2019-10-27 04:53:02 +0100
committerNiklas Söderlund <niklas.soderlund@ragnatech.se>2019-12-16 13:39:22 +0100
commit3de65b43a63ad3f528226f3aba937044f65e2013 (patch)
treed2f86b618718a103488e3478514909ce22feb6aa /src/libcamera/pipeline_handler.cpp
parent7df177fd889624c4b149ba2ecabb4969ad8c2bee (diff)
libcamera: pipelines: Align bookkeeping in queueRequest()
Expecting pipeline handler implementations of queueRequest() to call the base class queueRequest() at the correct point have led to different behaviors between the pipelines. Fix this by splitting queueRequest() into a base class implementation which handles the bookkeeping and a new queueRequestDevice() that is to be implemented by pipeline handlers and only deals with committing the request to the device. Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'src/libcamera/pipeline_handler.cpp')
-rw-r--r--src/libcamera/pipeline_handler.cpp35
1 files changed, 25 insertions, 10 deletions
diff --git a/src/libcamera/pipeline_handler.cpp b/src/libcamera/pipeline_handler.cpp
index 4349ca89..5badf31c 100644
--- a/src/libcamera/pipeline_handler.cpp
+++ b/src/libcamera/pipeline_handler.cpp
@@ -345,16 +345,12 @@ const ControlInfoMap &PipelineHandler::controls(Camera *camera)
* \param[in] request The request to queue
*
* This method queues a capture request to the pipeline handler for processing.
- * The request contains a set of buffers associated with streams and a set of
- * parameters. The pipeline handler shall program the device to ensure that the
- * parameters will be applied to the frames captured in the buffers provided in
- * the request.
+ * The request is first added to the internal list of queued requests, and
+ * then passed to the pipeline handler with a call to queueRequestDevice().
*
- * Pipeline handlers shall override this method. The base implementation in the
- * PipelineHandler class keeps track of queued requests in order to ensure
- * completion of all requests when the pipeline handler is stopped with stop().
- * Requests completion shall be signalled by the pipeline handler using the
- * completeRequest() method.
+ * Keeping track of queued requests ensures automatic completion of all requests
+ * when the pipeline handler is stopped with stop(). Request completion shall be
+ * signalled by the pipeline handler using the completeRequest() method.
*
* \return 0 on success or a negative error code otherwise
*/
@@ -363,10 +359,29 @@ int PipelineHandler::queueRequest(Camera *camera, Request *request)
CameraData *data = cameraData(camera);
data->queuedRequests_.push_back(request);
- return 0;
+ int ret = queueRequestDevice(camera, request);
+ if (ret)
+ data->queuedRequests_.remove(request);
+
+ return ret;
}
/**
+ * \fn PipelineHandler::queueRequestDevice()
+ * \brief Queue a request to the device
+ * \param[in] camera The camera to queue the request to
+ * \param[in] request The request to queue
+ *
+ * This method queues a capture request to the device for processing. The
+ * request contains a set of buffers associated with streams and a set of
+ * parameters. The pipeline handler shall program the device to ensure that the
+ * parameters will be applied to the frames captured in the buffers provided in
+ * the request.
+ *
+ * \return 0 on success or a negative error code otherwise
+ */
+
+/**
* \brief Complete a buffer for a request
* \param[in] camera The camera the request belongs to
* \param[in] request The request the buffer belongs to