[libcamera-devel] [PATCH] libcamera: ipu3: Get request from information structure instead of buffer

Niklas Söderlund niklas.soderlund at ragnatech.se
Fri Feb 5 21:43:03 CET 2021


Buffers dequeued from the ImgU may not be associated with a Request as
they are internal (statistics, parameters and some RAW buffers). Fetch
the request they are used for from the frame information instead.

Fixes: 9708f49fecf2f9ee ("libcamera: ipu3: Share parameter and statistic buffers with IPA")
Signed-off-by: Niklas Söderlund <niklas.soderlund at ragnatech.se>
---
 src/libcamera/pipeline/ipu3/ipu3.cpp | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp
index c3763507c40a5d53..48f0a81f0634d424 100644
--- a/src/libcamera/pipeline/ipu3/ipu3.cpp
+++ b/src/libcamera/pipeline/ipu3/ipu3.cpp
@@ -1109,14 +1109,14 @@ void IPU3CameraData::queueFrameAction(unsigned int id,
  */
 void IPU3CameraData::imguOutputBufferReady(FrameBuffer *buffer)
 {
-	Request *request = buffer->request();
+	IPU3Frames::Info *info = frameInfos_.find(buffer);
+	if (!info)
+		return;
+
+	Request *request = info->request;
 
 	pipe_->completeBuffer(request, buffer);
 
-	IPU3Frames::Info *info = frameInfos_.find(buffer);
-	if (!info)
-		return;
-
 	request->metadata().set(controls::draft::PipelineDepth, 3);
 	/* \todo Move the ExposureTime control to the IPA. */
 	request->metadata().set(controls::ExposureTime, exposureTime_);
@@ -1146,7 +1146,7 @@ void IPU3CameraData::cio2BufferReady(FrameBuffer *buffer)
 	if (!info)
 		return;
 
-	Request *request = buffer->request();
+	Request *request = info->request;
 
 	/* If the buffer is cancelled force a complete of the whole request. */
 	if (buffer->metadata().status == FrameMetadata::FrameCancelled) {
@@ -1175,7 +1175,7 @@ void IPU3CameraData::paramBufferReady(FrameBuffer *buffer)
 
 	info->paramDequeued = true;
 	if (frameInfos_.tryComplete(info))
-		pipe_->completeRequest(buffer->request());
+		pipe_->completeRequest(info->request);
 }
 
 void IPU3CameraData::statBufferReady(FrameBuffer *buffer)
@@ -1187,7 +1187,7 @@ void IPU3CameraData::statBufferReady(FrameBuffer *buffer)
 	if (buffer->metadata().status == FrameMetadata::FrameCancelled) {
 		info->metadataProcessed = true;
 		if (frameInfos_.tryComplete(info))
-			pipe_->completeRequest(buffer->request());
+			pipe_->completeRequest(info->request);
 		return;
 	}
 
-- 
2.30.0



More information about the libcamera-devel mailing list