[libcamera-devel] [PATCH 09/10] libcamera: ipu3: Connect CIO2 output to ImgU input

Jacopo Mondi jacopo at jmondi.org
Thu Feb 28 21:04:09 CET 2019


Connect the CIO2 output buffer available signal to a slot that simply
queue the received buffer to ImgU for processing.

FIXME: as long as the bufferReady signal cannot transport at least the
cameraData from where to retrieve a pointer to the ImguDevice, store it
as a class member.

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

diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp
index b9bc992879f5..3138eb0bf8b6 100644
--- a/src/libcamera/pipeline/ipu3/ipu3.cpp
+++ b/src/libcamera/pipeline/ipu3/ipu3.cpp
@@ -149,6 +149,8 @@ private:
 	int startDevice(V4L2Device *dev);
 	int stopDevice(V4L2Device *dev);
 
+	void cio2BufferDone(Buffer *buffer);
+
 	ImguDevice imgu0_;
 	ImguDevice imgu1_;
 
@@ -156,6 +158,7 @@ private:
 	std::shared_ptr<MediaDevice> imguMediaDev_;
 
 	unsigned int tmpBufferCount;
+	IPU3CameraData *tmpCameraData;
 };
 
 PipelineHandlerIPU3::PipelineHandlerIPU3(CameraManager *manager)
@@ -430,6 +433,19 @@ int PipelineHandlerIPU3::start(const Camera *camera)
 	if (ret)
 		return ret;
 
+	/*
+	 * FIXME
+	 * This is a big hack! tmpCameraData is used in the cio2BufferDone
+	 * slot, as there is currently no way to access cameraData from there.
+	 */
+	tmpCameraData = data;
+
+	/*
+	 * Connect CIO2 output and ImgU input buffer events, when a buffer
+	 * is available from CIO2, queue it to the ImgU.
+	 */
+	data->cio2.output->bufferReady.connect(this,
+					&PipelineHandlerIPU3::cio2BufferDone);
 	ret = startDevice(data->cio2.output);
 	if (ret)
 		return ret;
@@ -975,6 +991,13 @@ int PipelineHandlerIPU3::stopDevice(V4L2Device *dev)
 	return 0;
 }
 
+void PipelineHandlerIPU3::cio2BufferDone(Buffer *buffer)
+{
+	ImguDevice *imgu = tmpCameraData->imgu;
+
+	imgu->input->queueBuffer(buffer);
+}
+
 REGISTER_PIPELINE_HANDLER(PipelineHandlerIPU3);
 
 } /* namespace libcamera */
-- 
2.20.1



More information about the libcamera-devel mailing list