[{"id":1091,"web_url":"https://patchwork.libcamera.org/comment/1091/","msgid":"<20190321101700.GO4615@pendragon.ideasonboard.com>","date":"2019-03-21T10:17:00","subject":"Re: [libcamera-devel] [PATCH v4 12/31] libcamera: ipu3: Connect\n\tCIO2 and ImgU bufferReady signals","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Jacopo,\n\nThank you for the patch.\n\nOn Wed, Mar 20, 2019 at 05:30:36PM +0100, Jacopo Mondi wrote:\n> Connect the CIO2 output bufferRead signal to a slot that simply\n> queue the received buffer to ImgU for processing, and connect the ImgU\n> main output bufferReady signal to the cameraData slot that notifies\n> to applications that a new image buffer is available.\n> \n> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n> ---\n>  src/libcamera/pipeline/ipu3/ipu3.cpp | 58 +++++++++++++++++++++++++---\n>  1 file changed, 53 insertions(+), 5 deletions(-)\n> \n> diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp\n> index 8410e1f4b4a6..2623b2fe65f1 100644\n> --- a/src/libcamera/pipeline/ipu3/ipu3.cpp\n> +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp\n> @@ -124,7 +124,9 @@ private:\n>  \t\t{\n>  \t\t}\n>  \n> -\t\tvoid bufferReady(Buffer *buffer);\n> +\t\tvoid imguOutputBufferReady(Buffer *buffer);\n> +\t\tvoid imguInputBufferReady(Buffer *buffer);\n> +\t\tvoid cio2BufferReady(Buffer *buffer);\n>  \n>  \t\tCIO2Device cio2;\n>  \t\tImgUDevice *imgu;\n> @@ -398,6 +400,21 @@ int PipelineHandlerIPU3::start(Camera *camera)\n>  \tIPU3CameraData *data = cameraData(camera);\n>  \tint ret;\n>  \n> +\t/*\n> +\t * Connect video devices' 'bufferReady' signals to their slot to\n> +\t * implement the image processing pipeline.\n> +\t *\n> +\t * Frames produced by the CIO2 unit are shared with the associated\n> +\t * ImgU input where they get processed and returned through the ImgU\n> +\t * main and secondary outputs.\n> +\t */\n> +\tdata->cio2.output->bufferReady.connect(data,\n> +\t\t\t\t\t&IPU3CameraData::cio2BufferReady);\n> +\tdata->imgu->input->bufferReady.connect(data,\n> +\t\t\t\t\t&IPU3CameraData::imguInputBufferReady);\n> +\tdata->imgu->output->bufferReady.connect(data,\n> +\t\t\t\t\t&IPU3CameraData::imguOutputBufferReady);\n> +\n\nThis should be done when registering cameras, not at start() time,\notherwise you'll have multiple connections when restarting cameras. This\ncall for a camera stream restart test.\n\n>  \t/*\n>  \t * Enqueue all available buffers to the CIO2 unit to start frame\n>  \t * capture. Start ImgU video devices and queue buffers to the output\n> @@ -986,9 +1003,6 @@ void PipelineHandlerIPU3::registerCameras()\n>  \t\t\t\t\t\t\t\tcameraName,\n>  \t\t\t\t\t\t\t\tstreams);\n>  \n> -\t\tcio2->output->bufferReady.connect(data.get(),\n> -\t\t\t\t\t\t  &IPU3CameraData::bufferReady);\n> -\n>  \t\tregisterCamera(std::move(camera), std::move(data));\n>  \n>  \t\tLOG(IPU3, Info)\n> @@ -1000,7 +1014,29 @@ void PipelineHandlerIPU3::registerCameras()\n>  \t}\n>  }\n>  \n> -void PipelineHandlerIPU3::IPU3CameraData::bufferReady(Buffer *buffer)\n> +/* ----------------------------------------------------------------------------\n\nYou're allowed one more dash ;-)\n\n> + * Buffer Ready slots\n> + */\n> +\n> +/**\n> + * \\brief ImgU input BufferReady slot\n\nHow about \"Handle buffers completion at the ImgU input\" ? Same for the\nother functions below.\n\n> + * \\param buffer The completed buffer\n> + *\n> + * Buffer completed from the ImgU input are immediately queued back to the\n\ns/Buffer/Buffers/\n\nSame below.\n\n> + * CIO2 unit to continue frame capture.\n> + */\n> +void PipelineHandlerIPU3::IPU3CameraData::imguInputBufferReady(Buffer *buffer)\n> +{\n> +\tcio2.output->queueBuffer(buffer);\n> +}\n> +\n> +/**\n> + * \\brief ImgU output BufferReady slot\n> + * \\param buffer The completed buffer\n> + *\n> + * Buffer completed from the ImgU output are directed to the applications.\n\ns/applications/application/\n\n> + */\n> +void PipelineHandlerIPU3::IPU3CameraData::imguOutputBufferReady(Buffer *buffer)\n>  {\n>  \tRequest *request = queuedRequests_.front();\n>  \n> @@ -1008,6 +1044,18 @@ void PipelineHandlerIPU3::IPU3CameraData::bufferReady(Buffer *buffer)\n>  \tpipe_->completeRequest(camera_, request);\n>  }\n>  \n> +/**\n> + * \\brief CIO2 BufferReady slot\n> + * \\param buffer The completed buffer\n> + *\n> + * Buffer completed from the CIO2 are immediately queued to the ImgU unit\n> + * for further processing.\n> + */\n> +void PipelineHandlerIPU3::IPU3CameraData::cio2BufferReady(Buffer *buffer)\n> +{\n> +\timgu->input->queueBuffer(buffer);\n\nNow this is where the fun will begin. What happens if the application\ngets slow and has no request queued ? I think you'll need to requeue the\nbuffer to the cio2 instead of the imgu input in that case.\n\n> +}\n> +\n>  REGISTER_PIPELINE_HANDLER(PipelineHandlerIPU3);\n>  \n>  } /* namespace libcamera */","headers":{"Return-Path":"<laurent.pinchart@ideasonboard.com>","Received":["from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 2A7DD600F9\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 21 Mar 2019 11:17:12 +0100 (CET)","from pendragon.ideasonboard.com (30.net042126252.t-com.ne.jp\n\t[42.126.252.30])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id C00B923A;\n\tThu, 21 Mar 2019 11:17:10 +0100 (CET)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1553163431;\n\tbh=pSTJ17TX3pKfFcO6vCMgORfh77V3rFdDE2UyO7bUnPE=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=b2RHvhNXcQwf9UQI+2q9bt8nFNT1A8BiFrf63dVqxJKtsaBY6jmfiQ5gcJmGtKAUx\n\thq80wY0PNj9YDZcJPAWGH+rmZBEphSeISUx5iBpIDou8FoiX4865SxqjouZyvjcwlP\n\t/pAFxKaaqjFdD27H/AIl/S73TQTMrYRG1IgEoA+Y=","Date":"Thu, 21 Mar 2019 12:17:00 +0200","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Jacopo Mondi <jacopo@jmondi.org>","Cc":"libcamera-devel@lists.libcamera.org","Message-ID":"<20190321101700.GO4615@pendragon.ideasonboard.com>","References":"<20190320163055.22056-1-jacopo@jmondi.org>\n\t<20190320163055.22056-13-jacopo@jmondi.org>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20190320163055.22056-13-jacopo@jmondi.org>","User-Agent":"Mutt/1.10.1 (2018-07-13)","Subject":"Re: [libcamera-devel] [PATCH v4 12/31] libcamera: ipu3: Connect\n\tCIO2 and ImgU bufferReady signals","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.23","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","X-List-Received-Date":"Thu, 21 Mar 2019 10:17:12 -0000"}},{"id":1123,"web_url":"https://patchwork.libcamera.org/comment/1123/","msgid":"<20190325154222.ugxhwkvrbix4jrs6@uno.localdomain>","date":"2019-03-25T15:42:22","subject":"Re: [libcamera-devel] [PATCH v4 12/31] libcamera: ipu3: Connect\n\tCIO2 and ImgU bufferReady signals","submitter":{"id":3,"url":"https://patchwork.libcamera.org/api/people/3/","name":"Jacopo Mondi","email":"jacopo@jmondi.org"},"content":"Hi Laurent,\n   one note here below, mostly for the records...\n\nOn Thu, Mar 21, 2019 at 12:17:00PM +0200, Laurent Pinchart wrote:\n> Hi Jacopo,\n>\n> Thank you for the patch.\n>\n> On Wed, Mar 20, 2019 at 05:30:36PM +0100, Jacopo Mondi wrote:\n> > Connect the CIO2 output bufferRead signal to a slot that simply\n> > queue the received buffer to ImgU for processing, and connect the ImgU\n> > main output bufferReady signal to the cameraData slot that notifies\n> > to applications that a new image buffer is available.\n> >\n> > Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n> > ---\n> >  src/libcamera/pipeline/ipu3/ipu3.cpp | 58 +++++++++++++++++++++++++---\n> >  1 file changed, 53 insertions(+), 5 deletions(-)\n> >\n> > diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp\n> > index 8410e1f4b4a6..2623b2fe65f1 100644\n> > --- a/src/libcamera/pipeline/ipu3/ipu3.cpp\n> > +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp\n> > @@ -124,7 +124,9 @@ private:\n> >  \t\t{\n> >  \t\t}\n> >\n> > -\t\tvoid bufferReady(Buffer *buffer);\n> > +\t\tvoid imguOutputBufferReady(Buffer *buffer);\n> > +\t\tvoid imguInputBufferReady(Buffer *buffer);\n> > +\t\tvoid cio2BufferReady(Buffer *buffer);\n> >\n> >  \t\tCIO2Device cio2;\n> >  \t\tImgUDevice *imgu;\n> > @@ -398,6 +400,21 @@ int PipelineHandlerIPU3::start(Camera *camera)\n> >  \tIPU3CameraData *data = cameraData(camera);\n> >  \tint ret;\n> >\n> > +\t/*\n> > +\t * Connect video devices' 'bufferReady' signals to their slot to\n> > +\t * implement the image processing pipeline.\n> > +\t *\n> > +\t * Frames produced by the CIO2 unit are shared with the associated\n> > +\t * ImgU input where they get processed and returned through the ImgU\n> > +\t * main and secondary outputs.\n> > +\t */\n> > +\tdata->cio2.output->bufferReady.connect(data,\n> > +\t\t\t\t\t&IPU3CameraData::cio2BufferReady);\n> > +\tdata->imgu->input->bufferReady.connect(data,\n> > +\t\t\t\t\t&IPU3CameraData::imguInputBufferReady);\n> > +\tdata->imgu->output->bufferReady.connect(data,\n> > +\t\t\t\t\t&IPU3CameraData::imguOutputBufferReady);\n> > +\n>\n> This should be done when registering cameras, not at start() time,\n> otherwise you'll have multiple connections when restarting cameras. This\n> call for a camera stream restart test.\n>\n> >  \t/*\n> >  \t * Enqueue all available buffers to the CIO2 unit to start frame\n> >  \t * capture. Start ImgU video devices and queue buffers to the output\n> > @@ -986,9 +1003,6 @@ void PipelineHandlerIPU3::registerCameras()\n> >  \t\t\t\t\t\t\t\tcameraName,\n> >  \t\t\t\t\t\t\t\tstreams);\n> >\n> > -\t\tcio2->output->bufferReady.connect(data.get(),\n> > -\t\t\t\t\t\t  &IPU3CameraData::bufferReady);\n> > -\n> >  \t\tregisterCamera(std::move(camera), std::move(data));\n> >\n> >  \t\tLOG(IPU3, Info)\n> > @@ -1000,7 +1014,29 @@ void PipelineHandlerIPU3::registerCameras()\n> >  \t}\n> >  }\n> >\n> > -void PipelineHandlerIPU3::IPU3CameraData::bufferReady(Buffer *buffer)\n> > +/* ----------------------------------------------------------------------------\n>\n> You're allowed one more dash ;-)\n>\n> > + * Buffer Ready slots\n> > + */\n> > +\n> > +/**\n> > + * \\brief ImgU input BufferReady slot\n>\n> How about \"Handle buffers completion at the ImgU input\" ? Same for the\n> other functions below.\n>\n> > + * \\param buffer The completed buffer\n> > + *\n> > + * Buffer completed from the ImgU input are immediately queued back to the\n>\n> s/Buffer/Buffers/\n>\n> Same below.\n>\n> > + * CIO2 unit to continue frame capture.\n> > + */\n> > +void PipelineHandlerIPU3::IPU3CameraData::imguInputBufferReady(Buffer *buffer)\n> > +{\n> > +\tcio2.output->queueBuffer(buffer);\n> > +}\n> > +\n> > +/**\n> > + * \\brief ImgU output BufferReady slot\n> > + * \\param buffer The completed buffer\n> > + *\n> > + * Buffer completed from the ImgU output are directed to the applications.\n>\n> s/applications/application/\n>\n> > + */\n> > +void PipelineHandlerIPU3::IPU3CameraData::imguOutputBufferReady(Buffer *buffer)\n> >  {\n> >  \tRequest *request = queuedRequests_.front();\n> >\n> > @@ -1008,6 +1044,18 @@ void PipelineHandlerIPU3::IPU3CameraData::bufferReady(Buffer *buffer)\n> >  \tpipe_->completeRequest(camera_, request);\n> >  }\n> >\n> > +/**\n> > + * \\brief CIO2 BufferReady slot\n> > + * \\param buffer The completed buffer\n> > + *\n> > + * Buffer completed from the CIO2 are immediately queued to the ImgU unit\n> > + * for further processing.\n> > + */\n> > +void PipelineHandlerIPU3::IPU3CameraData::cio2BufferReady(Buffer *buffer)\n> > +{\n> > +\timgu->input->queueBuffer(buffer);\n>\n> Now this is where the fun will begin. What happens if the application\n> gets slow and has no request queued ? I think you'll need to requeue the\n> buffer to the cio2 instead of the imgu input in that case.\n>\n\nSo, I've done some profiling of the buffer queue/requeue sequences,\ninserting random delays in the 'cam' application, both during the\nfirst request queuing sequence and both at request re-queueing time\nafter a request has completed.\n\nWhat I've seen is that regardless of the availability of output\nbuffers to capture, the CIO2->ImgU buffer sharing does not stall.\n\nIn facts, once a buffer has been queued to the ImgU, as soon as its\nprocessing is completed it is immediately returned to userspace, and\nit is thus possible to re-queue it back immediately to the CIO2.\n\nIn other words, the buffer sharing between CIO2 output and ImgU input\ndoes not depend on the availability of output buffers, and does not\nstall if none is queued to the ImgU's main or secondary outputs.\n\nThis seems to be different to what is reported by mainline IPU3\ndevelopers, that describes the usage of main output as mandatory.\n\nThanks\n   j\n\n> > +}\n> > +\n> >  REGISTER_PIPELINE_HANDLER(PipelineHandlerIPU3);\n> >\n> >  } /* namespace libcamera */\n>\n> --\n> Regards,\n>\n> Laurent Pinchart","headers":{"Return-Path":"<jacopo@jmondi.org>","Received":["from relay3-d.mail.gandi.net (relay3-d.mail.gandi.net\n\t[217.70.183.195])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 9FB8E600FD\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 25 Mar 2019 16:41:41 +0100 (CET)","from uno.localdomain (2-224-242-101.ip172.fastwebnet.it\n\t[2.224.242.101]) (Authenticated sender: jacopo@jmondi.org)\n\tby relay3-d.mail.gandi.net (Postfix) with ESMTPSA id 16C0F60009;\n\tMon, 25 Mar 2019 15:41:40 +0000 (UTC)"],"X-Originating-IP":"2.224.242.101","Date":"Mon, 25 Mar 2019 16:42:22 +0100","From":"Jacopo Mondi <jacopo@jmondi.org>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Message-ID":"<20190325154222.ugxhwkvrbix4jrs6@uno.localdomain>","References":"<20190320163055.22056-1-jacopo@jmondi.org>\n\t<20190320163055.22056-13-jacopo@jmondi.org>\n\t<20190321101700.GO4615@pendragon.ideasonboard.com>","MIME-Version":"1.0","Content-Type":"multipart/signed; micalg=pgp-sha256;\n\tprotocol=\"application/pgp-signature\"; boundary=\"qwywupzwcfxxxyee\"","Content-Disposition":"inline","In-Reply-To":"<20190321101700.GO4615@pendragon.ideasonboard.com>","User-Agent":"NeoMutt/20180716","Subject":"Re: [libcamera-devel] [PATCH v4 12/31] libcamera: ipu3: Connect\n\tCIO2 and ImgU bufferReady signals","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.23","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","X-List-Received-Date":"Mon, 25 Mar 2019 15:41:41 -0000"}},{"id":1158,"web_url":"https://patchwork.libcamera.org/comment/1158/","msgid":"<20190401214034.GH4787@pendragon.ideasonboard.com>","date":"2019-04-01T21:40:34","subject":"Re: [libcamera-devel] [PATCH v4 12/31] libcamera: ipu3: Connect\n\tCIO2 and ImgU bufferReady signals","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Jacopo,\n\nOn Mon, Mar 25, 2019 at 04:42:22PM +0100, Jacopo Mondi wrote:\n> Hi Laurent,\n>    one note here below, mostly for the records...\n> \n> On Thu, Mar 21, 2019 at 12:17:00PM +0200, Laurent Pinchart wrote:\n> > On Wed, Mar 20, 2019 at 05:30:36PM +0100, Jacopo Mondi wrote:\n> >> Connect the CIO2 output bufferRead signal to a slot that simply\n> >> queue the received buffer to ImgU for processing, and connect the ImgU\n> >> main output bufferReady signal to the cameraData slot that notifies\n> >> to applications that a new image buffer is available.\n> >>\n> >> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n> >> ---\n> >>  src/libcamera/pipeline/ipu3/ipu3.cpp | 58 +++++++++++++++++++++++++---\n> >>  1 file changed, 53 insertions(+), 5 deletions(-)\n> >>\n> >> diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp\n> >> index 8410e1f4b4a6..2623b2fe65f1 100644\n> >> --- a/src/libcamera/pipeline/ipu3/ipu3.cpp\n> >> +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp\n> >> @@ -124,7 +124,9 @@ private:\n> >>  \t\t{\n> >>  \t\t}\n> >>\n> >> -\t\tvoid bufferReady(Buffer *buffer);\n> >> +\t\tvoid imguOutputBufferReady(Buffer *buffer);\n> >> +\t\tvoid imguInputBufferReady(Buffer *buffer);\n> >> +\t\tvoid cio2BufferReady(Buffer *buffer);\n> >>\n> >>  \t\tCIO2Device cio2;\n> >>  \t\tImgUDevice *imgu;\n> >> @@ -398,6 +400,21 @@ int PipelineHandlerIPU3::start(Camera *camera)\n> >>  \tIPU3CameraData *data = cameraData(camera);\n> >>  \tint ret;\n> >>\n> >> +\t/*\n> >> +\t * Connect video devices' 'bufferReady' signals to their slot to\n> >> +\t * implement the image processing pipeline.\n> >> +\t *\n> >> +\t * Frames produced by the CIO2 unit are shared with the associated\n> >> +\t * ImgU input where they get processed and returned through the ImgU\n> >> +\t * main and secondary outputs.\n> >> +\t */\n> >> +\tdata->cio2.output->bufferReady.connect(data,\n> >> +\t\t\t\t\t&IPU3CameraData::cio2BufferReady);\n> >> +\tdata->imgu->input->bufferReady.connect(data,\n> >> +\t\t\t\t\t&IPU3CameraData::imguInputBufferReady);\n> >> +\tdata->imgu->output->bufferReady.connect(data,\n> >> +\t\t\t\t\t&IPU3CameraData::imguOutputBufferReady);\n> >> +\n> >\n> > This should be done when registering cameras, not at start() time,\n> > otherwise you'll have multiple connections when restarting cameras. This\n> > call for a camera stream restart test.\n> >\n> >>  \t/*\n> >>  \t * Enqueue all available buffers to the CIO2 unit to start frame\n> >>  \t * capture. Start ImgU video devices and queue buffers to the output\n> >> @@ -986,9 +1003,6 @@ void PipelineHandlerIPU3::registerCameras()\n> >>  \t\t\t\t\t\t\t\tcameraName,\n> >>  \t\t\t\t\t\t\t\tstreams);\n> >>\n> >> -\t\tcio2->output->bufferReady.connect(data.get(),\n> >> -\t\t\t\t\t\t  &IPU3CameraData::bufferReady);\n> >> -\n> >>  \t\tregisterCamera(std::move(camera), std::move(data));\n> >>\n> >>  \t\tLOG(IPU3, Info)\n> >> @@ -1000,7 +1014,29 @@ void PipelineHandlerIPU3::registerCameras()\n> >>  \t}\n> >>  }\n> >>\n> >> -void PipelineHandlerIPU3::IPU3CameraData::bufferReady(Buffer *buffer)\n> >> +/* ----------------------------------------------------------------------------\n> >\n> > You're allowed one more dash ;-)\n> >\n> >> + * Buffer Ready slots\n> >> + */\n> >> +\n> >> +/**\n> >> + * \\brief ImgU input BufferReady slot\n> >\n> > How about \"Handle buffers completion at the ImgU input\" ? Same for the\n> > other functions below.\n> >\n> >> + * \\param buffer The completed buffer\n> >> + *\n> >> + * Buffer completed from the ImgU input are immediately queued back to the\n> >\n> > s/Buffer/Buffers/\n> >\n> > Same below.\n> >\n> >> + * CIO2 unit to continue frame capture.\n> >> + */\n> >> +void PipelineHandlerIPU3::IPU3CameraData::imguInputBufferReady(Buffer *buffer)\n> >> +{\n> >> +\tcio2.output->queueBuffer(buffer);\n> >> +}\n> >> +\n> >> +/**\n> >> + * \\brief ImgU output BufferReady slot\n> >> + * \\param buffer The completed buffer\n> >> + *\n> >> + * Buffer completed from the ImgU output are directed to the applications.\n> >\n> > s/applications/application/\n> >\n> >> + */\n> >> +void PipelineHandlerIPU3::IPU3CameraData::imguOutputBufferReady(Buffer *buffer)\n> >>  {\n> >>  \tRequest *request = queuedRequests_.front();\n> >>\n> >> @@ -1008,6 +1044,18 @@ void PipelineHandlerIPU3::IPU3CameraData::bufferReady(Buffer *buffer)\n> >>  \tpipe_->completeRequest(camera_, request);\n> >>  }\n> >>\n> >> +/**\n> >> + * \\brief CIO2 BufferReady slot\n> >> + * \\param buffer The completed buffer\n> >> + *\n> >> + * Buffer completed from the CIO2 are immediately queued to the ImgU unit\n> >> + * for further processing.\n> >> + */\n> >> +void PipelineHandlerIPU3::IPU3CameraData::cio2BufferReady(Buffer *buffer)\n> >> +{\n> >> +\timgu->input->queueBuffer(buffer);\n> >\n> > Now this is where the fun will begin. What happens if the application\n> > gets slow and has no request queued ? I think you'll need to requeue the\n> > buffer to the cio2 instead of the imgu input in that case.\n> >\n> \n> So, I've done some profiling of the buffer queue/requeue sequences,\n> inserting random delays in the 'cam' application, both during the\n> first request queuing sequence and both at request re-queueing time\n> after a request has completed.\n> \n> What I've seen is that regardless of the availability of output\n> buffers to capture, the CIO2->ImgU buffer sharing does not stall.\n> \n> In facts, once a buffer has been queued to the ImgU, as soon as its\n> processing is completed it is immediately returned to userspace, and\n> it is thus possible to re-queue it back immediately to the CIO2.\n> \n> In other words, the buffer sharing between CIO2 output and ImgU input\n> does not depend on the availability of output buffers, and does not\n> stall if none is queued to the ImgU's main or secondary outputs.\n\nWhat does the ImgU write the output to if there's no output buffer\navailable ?\n\n> This seems to be different to what is reported by mainline IPU3\n> developers, that describes the usage of main output as mandatory.\n\nIt makes no sense to execute one processing run of the ImgU if there's\nno buffer available for its output. The driver may do something now (and\nit's unclear what it does), but it shouldn't be the case, and that\nshould be fixed. We'll have to eventually handle this in the IPU3\npipeline handler.\n\n> >> +}\n> >> +\n> >>  REGISTER_PIPELINE_HANDLER(PipelineHandlerIPU3);\n> >>\n> >>  } /* namespace libcamera */","headers":{"Return-Path":"<laurent.pinchart@ideasonboard.com>","Received":["from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 37C7A610B3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon,  1 Apr 2019 23:40:46 +0200 (CEST)","from pendragon.ideasonboard.com (81-175-216-236.bb.dnainternet.fi\n\t[81.175.216.236])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 8A6EB542;\n\tMon,  1 Apr 2019 23:40:45 +0200 (CEST)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1554154845;\n\tbh=1OyWhyhBum/4F5x4toJ2KLzK+DS/S1NZoADax/zgKQ8=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=Rs2up50aosUGyILiQzJk5yQTU7v1sP3yKXEIhItupRuCzCD1fiuFd5YG8nUWK0bYN\n\tkzaEFqA2vQ9vrgmsRKpNpsqYPMy3dSxRf8tdaujRJ6stiPqg12t/gzjIw/yLVQVxgZ\n\tJgBE4XPw55E7G49GN1t92fM/ysVmodE9+XlLKbuc=","Date":"Tue, 2 Apr 2019 00:40:34 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Jacopo Mondi <jacopo@jmondi.org>","Cc":"libcamera-devel@lists.libcamera.org","Message-ID":"<20190401214034.GH4787@pendragon.ideasonboard.com>","References":"<20190320163055.22056-1-jacopo@jmondi.org>\n\t<20190320163055.22056-13-jacopo@jmondi.org>\n\t<20190321101700.GO4615@pendragon.ideasonboard.com>\n\t<20190325154222.ugxhwkvrbix4jrs6@uno.localdomain>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20190325154222.ugxhwkvrbix4jrs6@uno.localdomain>","User-Agent":"Mutt/1.10.1 (2018-07-13)","Subject":"Re: [libcamera-devel] [PATCH v4 12/31] libcamera: ipu3: Connect\n\tCIO2 and ImgU bufferReady signals","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.23","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","X-List-Received-Date":"Mon, 01 Apr 2019 21:40:46 -0000"}}]