From 3de65b43a63ad3f528226f3aba937044f65e2013 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niklas=20S=C3=B6derlund?= Date: Sun, 27 Oct 2019 04:53:02 +0100 Subject: libcamera: pipelines: Align bookkeeping in queueRequest() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Jacopo Mondi Reviewed-by: Laurent Pinchart --- src/libcamera/pipeline_handler.cpp | 35 +++++++++++++++++++++++++---------- 1 file changed, 25 insertions(+), 10 deletions(-) (limited to 'src/libcamera/pipeline_handler.cpp') 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,9 +359,28 @@ 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 -- cgit v1.2.1