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

Message ID 20190228200410.3022-10-jacopo@jmondi.org
State Superseded
Headers show
Series
  • libcamera: ipu3: ImgU support
Related show

Commit Message

Jacopo Mondi Feb. 28, 2019, 8:04 p.m. UTC
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@jmondi.org>
---
 src/libcamera/pipeline/ipu3/ipu3.cpp | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

Comments

Laurent Pinchart March 2, 2019, 11 p.m. UTC | #1
Hi Jacopo,

Thank you for the patch.

On Thu, Feb 28, 2019 at 09:04:09PM +0100, Jacopo Mondi wrote:
> 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.

You should be able to fix this with a rebase :-)

> Signed-off-by: Jacopo Mondi <jacopo@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 */
Jacopo Mondi March 9, 2019, 9:01 p.m. UTC | #2
Hi Laurent,

On Sun, Mar 03, 2019 at 01:00:55AM +0200, Laurent Pinchart wrote:
> Hi Jacopo,
>
> Thank you for the patch.
>
> On Thu, Feb 28, 2019 at 09:04:09PM +0100, Jacopo Mondi wrote:
> > 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.
>
> You should be able to fix this with a rebase :-)
>

Done by adding slots to the IPU3CameraData :)

Thanks
  j

> > Signed-off-by: Jacopo Mondi <jacopo@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 */
>
> --
> Regards,
>
> Laurent Pinchart

Patch

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 */