[libcamera-devel] [PATCH v2 7/8] libcamera: pipeline: ipu3: Ensure no requests are pending at stop()

Kieran Bingham kieran.bingham at ideasonboard.com
Fri Mar 12 06:47:26 CET 2021


The Pipeline handlers are responsible for making sure that all work
is completed during the stop call, and all requests and resources
should be released back to the application.

Add an assertion to guarantee that there are no pending requests
before returning from ::stop()

Signed-off-by: Kieran Bingham <kieran.bingham at ideasonboard.com>

---
RFC? Ideally this should be handled by the base pipeline handler so that
the same guarantee applies to all pipeline handlers. But we don't
currently call into the base class during stop.

 src/libcamera/pipeline/ipu3/ipu3.cpp | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp
index 7ab3a5bfdccb..c5facaea16dd 100644
--- a/src/libcamera/pipeline/ipu3/ipu3.cpp
+++ b/src/libcamera/pipeline/ipu3/ipu3.cpp
@@ -771,6 +771,14 @@ void PipelineHandlerIPU3::stop(Camera *camera)
 	if (ret)
 		LOG(IPU3, Warning) << "Failed to stop camera " << camera->id();
 
+	/*
+	 * All requests must have completed before releaseing buffers.
+	 * \todo: Ensure all pipeline handlers guarantee queuedRequests is emtpy
+	 * at the end of stop().
+	 */
+	if (!data->queuedRequests_.empty())
+		LOG(IPU3, Fatal) << "There are still requests to complete.";
+
 	freeBuffers(camera);
 }
 
-- 
2.25.1



More information about the libcamera-devel mailing list