summaryrefslogtreecommitdiff
path: root/src/libcamera/pipeline_handler.cpp
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2019-07-12 17:17:35 +0300
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2019-07-14 16:00:40 +0300
commit185fe3d4b4d1264b2d72f8c92d17e248092efc46 (patch)
tree7141f270c55f48f67701ec9109f01bf0c5142a56 /src/libcamera/pipeline_handler.cpp
parenta775234d6612a1fbd3bb586de4704883c1fcd817 (diff)
libcamera: pipeline_handler: Simplify request completion
libcamera guarantees that requests complete in sequence. This requirement is currently pushed down to pipeline handlers. Three out of four of our pipeline handlers implement that requirement based on the sole assumption that buffers will always complete in sequeuence, while the IPU3 pipeline handler implements a more complex logic. It turns out that the logic can be moved to the base PipelineHandler class with support from the Request class. Do so to simplify the pipeline handlers. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Diffstat (limited to 'src/libcamera/pipeline_handler.cpp')
-rw-r--r--src/libcamera/pipeline_handler.cpp24
1 files changed, 16 insertions, 8 deletions
diff --git a/src/libcamera/pipeline_handler.cpp b/src/libcamera/pipeline_handler.cpp
index 0283e4e5..c6092002 100644
--- a/src/libcamera/pipeline_handler.cpp
+++ b/src/libcamera/pipeline_handler.cpp
@@ -391,8 +391,9 @@ int PipelineHandler::queueRequest(Camera *camera, Request *request)
* This method shall be called by pipeline handlers to signal completion of the
* \a buffer part of the \a request. It notifies applications of buffer
* completion and updates the request's internal buffer tracking. The request
- * is not completed automatically when the last buffer completes, pipeline
- * handlers shall complete requests explicitly with completeRequest().
+ * is not completed automatically when the last buffer completes to give
+ * pipeline handlers a chance to perform any operation that may still be
+ * needed. They shall complete requests explicitly with completeRequest().
*
* \return True if all buffers contained in the request have completed, false
* otherwise
@@ -413,17 +414,24 @@ bool PipelineHandler::completeBuffer(Camera *camera, Request *request,
* request has completed. The request is deleted and shall not be accessed once
* this method returns.
*
- * The pipeline handler shall ensure that requests complete in the same order
- * they are submitted.
+ * This method ensures that requests will be returned to the application in
+ * submission order, the pipeline handler may call it on any complete request
+ * without any ordering constraint.
*/
void PipelineHandler::completeRequest(Camera *camera, Request *request)
{
+ request->complete(Request::RequestComplete);
+
CameraData *data = cameraData(camera);
- ASSERT(request == data->queuedRequests_.front());
- data->queuedRequests_.pop_front();
- request->complete(Request::RequestComplete);
- camera->requestComplete(request);
+ while (!data->queuedRequests_.empty()) {
+ request = data->queuedRequests_.front();
+ if (request->hasPendingBuffers())
+ break;
+
+ data->queuedRequests_.pop_front();
+ camera->requestComplete(request);
+ }
}
/**