[libcamera-devel] [PATCH v4 25/31] libcamera: ipu3: Connect viewfinder's BufferReady signal

Jacopo Mondi jacopo at jmondi.org
Wed Mar 20 17:30:49 CET 2019


Connect the viewfinder buffer ready signal to the IPU3CameraData slot
that complets the buffer first, and if not waiting for other buffers
completes the request as well.

Signed-off-by: Jacopo Mondi <jacopo at jmondi.org>
---
 src/libcamera/pipeline/ipu3/ipu3.cpp | 23 +++++++++++++++--------
 1 file changed, 15 insertions(+), 8 deletions(-)

diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp
index b2df9a4ac922..db1ec2a7c3e2 100644
--- a/src/libcamera/pipeline/ipu3/ipu3.cpp
+++ b/src/libcamera/pipeline/ipu3/ipu3.cpp
@@ -135,7 +135,7 @@ private:
 		{
 		}
 
-		void imguOutputBufferReady(Buffer *buffer);
+		void imguCaptureBufferReady(Buffer *buffer);
 		void imguInputBufferReady(Buffer *buffer);
 		void cio2BufferReady(Buffer *buffer);
 
@@ -621,8 +621,13 @@ int PipelineHandlerIPU3::start(Camera *camera)
 					&IPU3CameraData::cio2BufferReady);
 	data->imgu->input->bufferReady.connect(data,
 					&IPU3CameraData::imguInputBufferReady);
-	data->imgu->output->bufferReady.connect(data,
-					&IPU3CameraData::imguOutputBufferReady);
+
+	if (isOutputActive(data))
+		data->imgu->output->bufferReady.connect(data,
+					&IPU3CameraData::imguCaptureBufferReady);
+	if (isViewfinderActive(data))
+		data->imgu->viewfinder->bufferReady.connect(data,
+					&IPU3CameraData::imguCaptureBufferReady);
 
 	/*
 	 * Enqueue all available buffers to the CIO2 unit to start frame
@@ -1434,17 +1439,19 @@ void PipelineHandlerIPU3::IPU3CameraData::imguInputBufferReady(Buffer *buffer)
 }
 
 /**
- * \brief ImgU output BufferReady slot
+ * \brief ImgU main and secondary output BufferReady slot
  * \param buffer The completed buffer
  *
- * Buffer completed from the ImgU output are directed to the applications.
+ * Buffer completed from the ImgU main and secondary outputs are directed to
+ * the applications.
  */
-void PipelineHandlerIPU3::IPU3CameraData::imguOutputBufferReady(Buffer *buffer)
+void PipelineHandlerIPU3::IPU3CameraData::imguCaptureBufferReady(Buffer *buffer)
 {
 	Request *request = queuedRequests_.front();
 
-	pipe_->completeBuffer(camera_, request, buffer);
-	pipe_->completeRequest(camera_, request);
+	/* TODO: this will probably need locking. */
+	if (pipe_->completeBuffer(camera_, request, buffer))
+		pipe_->completeRequest(camera_, request);
 }
 
 /**
-- 
2.21.0



More information about the libcamera-devel mailing list