[{"id":1337,"web_url":"https://patchwork.libcamera.org/comment/1337/","msgid":"<20190414203229.GO1980@bigcity.dyn.berto.se>","date":"2019-04-14T20:32:29","subject":"Re: [libcamera-devel] [PATCH v4 10/12] libcamera: ipu3: Connect\n\tviewfinder's BufferReady signal","submitter":{"id":5,"url":"https://patchwork.libcamera.org/api/people/5/","name":"Niklas Söderlund","email":"niklas.soderlund@ragnatech.se"},"content":"Hi Jacopo,\n\nThanks for your work.\n\nOn 2019-04-09 21:25:46 +0200, Jacopo Mondi wrote:\n> Connect the viewfinder buffer ready signal to the IPU3CameraData slot\n> that complets the buffer first, and if not waiting for other buffers\n> completes the request as well.\n> \n> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n> ---\n>  src/libcamera/pipeline/ipu3/ipu3.cpp | 43 ++++++++++++++++++++++++----\n>  1 file changed, 37 insertions(+), 6 deletions(-)\n> \n> diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp\n> index bb8d4ce644ca..75ffdc56d157 100644\n> --- a/src/libcamera/pipeline/ipu3/ipu3.cpp\n> +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp\n> @@ -182,7 +182,7 @@ private:\n>  \t\t{\n>  \t\t}\n>  \n> -\t\tvoid imguOutputBufferReady(Buffer *buffer);\n> +\t\tvoid imguCaptureBufferReady(Buffer *buffer);\n>  \t\tvoid imguInputBufferReady(Buffer *buffer);\n>  \t\tvoid cio2BufferReady(Buffer *buffer);\n>  \n> @@ -722,7 +722,9 @@ int PipelineHandlerIPU3::registerCameras()\n>  \t\tdata->imgu_->input_->bufferReady.connect(data.get(),\n>  \t\t\t\t\t&IPU3CameraData::imguInputBufferReady);\n>  \t\tdata->imgu_->output_.dev->bufferReady.connect(data.get(),\n> -\t\t\t\t\t&IPU3CameraData::imguOutputBufferReady);\n> +\t\t\t\t\t&IPU3CameraData::imguCaptureBufferReady);\n> +\t\tdata->imgu_->viewfinder_.dev->bufferReady.connect(data.get(),\n> +\t\t\t\t\t&IPU3CameraData::imguCaptureBufferReady);\n>  \n>  \n>  \t\t/* Initialize and register the Camera and its streams. */\n> @@ -769,12 +771,41 @@ void PipelineHandlerIPU3::IPU3CameraData::imguInputBufferReady(Buffer *buffer)\n>   *\n>   * Buffers completed from the ImgU output are directed to the application.\n>   */\n> -void PipelineHandlerIPU3::IPU3CameraData::imguOutputBufferReady(Buffer *buffer)\n> +void PipelineHandlerIPU3::IPU3CameraData::imguCaptureBufferReady(Buffer *buffer)\n>  {\n> -\tRequest *request = queuedRequests_.front();\n> +\tRequest *request = buffer->request();\n> +\tif (!request)\n> +\t\t/*\n> +\t\t * Completed buffers not part of a request are ignored\n> +\t\t * (they most probably come from the output stream\n> +\t\t * internal pool)\n> +\t\t */\n> +\t\treturn;\n> +\n> +\tif (!pipe_->completeBuffer(camera_, request, buffer))\n> +\t\t/* Request not completed yet, return here. */\n> +\t\treturn;\n> +\n> +\t/*\n> +\t * Complete requests in queuing order: if some other request is\n> +\t * pending, post-pone completion.\n> +\t */\n> +\tRequest *front = queuedRequests_.front();\n> +\tif (front != request)\n> +\t\treturn;\n\nI'm not sure, but i think this needs to be moved to the framework \nsomehow. It will be slight variations of how this will be implemented in \ndifferent pipeline handlers if we leave it to each pipeline handler to \nimplement ordered completion of requests.\n\nBest case it should happen transparent to the pipeline handlers, but \nthat might be a tall order. How about implementing a \nPipelineHandler::completeReady() helper which implementations can call \nwhich would take care of dequeuing requests in a ordered fashion? Or if \nyou have a nice idea for how to skip the helper and move to something \ntransparent that would be even better.\n\n>  \n> -\tpipe_->completeBuffer(camera_, request, buffer);\n> -\tpipe_->completeRequest(camera_, request);\n> +\t/*\n> +\t * Complete the current request, and all the other pending ones,\n> +\t * in queuing order.\n> +\t */\n> +\twhile (1) {\n> +\t\tif (front->empty())\n> +\t\t\tpipe_->completeRequest(camera_, front);\n> +\t\telse\n> +\t\t\tbreak;\n> +\n> +\t\tfront = queuedRequests_.front();\n> +\t}\n>  }\n>  \n>  /**\n> -- \n> 2.21.0\n> \n> _______________________________________________\n> libcamera-devel mailing list\n> libcamera-devel@lists.libcamera.org\n> https://lists.libcamera.org/listinfo/libcamera-devel","headers":{"Return-Path":"<niklas.soderlund@ragnatech.se>","Received":["from mail-lj1-x243.google.com (mail-lj1-x243.google.com\n\t[IPv6:2a00:1450:4864:20::243])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 84A4B60DBE\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSun, 14 Apr 2019 22:32:32 +0200 (CEST)","by mail-lj1-x243.google.com with SMTP id k8so13657912lja.8\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSun, 14 Apr 2019 13:32:32 -0700 (PDT)","from localhost (89-233-230-99.cust.bredband2.com. [89.233.230.99])\n\tby smtp.gmail.com with ESMTPSA id\n\tu18sm9529040ljd.77.2019.04.14.13.32.30\n\t(version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);\n\tSun, 14 Apr 2019 13:32:30 -0700 (PDT)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=ragnatech-se.20150623.gappssmtp.com; s=20150623;\n\th=date:from:to:cc:subject:message-id:references:mime-version\n\t:content-disposition:content-transfer-encoding:in-reply-to\n\t:user-agent; bh=D8sl/Vu2NH/WeTxHDXRkpHBmt6oAp+03JGKjyIGHRyo=;\n\tb=tmdWqJnwPrwP+0kYeYsSrmQqPBU3FG/cJGWT9rwKKQ7/lhrV5HvQnvxtREvaj+ew+L\n\ttTtpB2BojgLPVw2ANMiCAg/ZH0kHgNVY4uFOGoC4h/U6RyNmc/O6DuMObPvextC7Y6WC\n\tR7LVqp7+63df6qv6f9c391oDIIenivfSC5LBMo8tXzcFRDaKvQcY1BOj43zaprEgemQb\n\tmssWJKSgQoEKVUGm/R/VvI1n5bfEqsmrd5bDwcyldkpRZ1FHsEou/f0h3T6lSqXNlZRH\n\tqE08eg+1mv72s9L4tr+6zDL81cTkCNaAHtbl2Sl07Q+bNPH4YQMJYMdGFG+c7YoJEw1P\n\tpj2g==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:date:from:to:cc:subject:message-id:references\n\t:mime-version:content-disposition:content-transfer-encoding\n\t:in-reply-to:user-agent;\n\tbh=D8sl/Vu2NH/WeTxHDXRkpHBmt6oAp+03JGKjyIGHRyo=;\n\tb=p7iAr8w7XWN5UFcmX0VQtpky7dA4as4vlIxRcUVuuKLkPoGbFUgS1jzXfStKLvdhVB\n\tOM1sNwus1nJFWGSyjj9E0wXX7PwUszzxY9yFGJ9wbO7D/EoxmzesTNZmzRSsGcq63kAK\n\tAlaK0KmTaPFn4lGtnpsHP8Y1i6U0MheoLxuind/GjIPGCUY/1krEBhIgN3NlpAQm95jE\n\thyFOMvOQSaoD3w77s9U7BD2+v84GfAHoh9IoQDUuYsT1zLvxmfl7B7eJYMaRSu/vWQb1\n\tvDon9c2Vlp7U9ihmS4O1KBFqfB5P8LI+Z9jc0stFMiE+NqrdyqwVXu/cIa0Hd9oUrXSV\n\tJjAw==","X-Gm-Message-State":"APjAAAWHV/4z6Odnifa7Pg1RRTKeBtnyiQzIrkl5tyoQ91cEytzknsNf\n\tlT3jCCmigiznhlYbcLXeW4+uq3iEAME=","X-Google-Smtp-Source":"APXvYqzGbZSnB67kugTwtdADZGp72fGCiWBBmDLzFHQuuXDusD3GjVI/LcLM1GNoWbu7ZqLvVD3MsQ==","X-Received":"by 2002:a2e:8684:: with SMTP id\n\tl4mr36960831lji.121.1555273950928; \n\tSun, 14 Apr 2019 13:32:30 -0700 (PDT)","Date":"Sun, 14 Apr 2019 22:32:29 +0200","From":"Niklas =?iso-8859-1?q?S=F6derlund?= <niklas.soderlund@ragnatech.se>","To":"Jacopo Mondi <jacopo@jmondi.org>","Cc":"libcamera-devel@lists.libcamera.org","Message-ID":"<20190414203229.GO1980@bigcity.dyn.berto.se>","References":"<20190409192548.20325-1-jacopo@jmondi.org>\n\t<20190409192548.20325-11-jacopo@jmondi.org>","MIME-Version":"1.0","Content-Type":"text/plain; charset=iso-8859-1","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<20190409192548.20325-11-jacopo@jmondi.org>","User-Agent":"Mutt/1.11.3 (2019-02-01)","Subject":"Re: [libcamera-devel] [PATCH v4 10/12] libcamera: ipu3: Connect\n\tviewfinder's BufferReady signal","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":"Sun, 14 Apr 2019 20:32:32 -0000"}},{"id":1344,"web_url":"https://patchwork.libcamera.org/comment/1344/","msgid":"<20190415113930.yxiphjvcpznsdeq2@uno.localdomain>","date":"2019-04-15T11:39:30","subject":"Re: [libcamera-devel] [PATCH v4 10/12] libcamera: ipu3: Connect\n\tviewfinder's BufferReady signal","submitter":{"id":3,"url":"https://patchwork.libcamera.org/api/people/3/","name":"Jacopo Mondi","email":"jacopo@jmondi.org"},"content":"Hi Niklas,\n\nOn Sun, Apr 14, 2019 at 10:32:29PM +0200, Niklas Söderlund wrote:\n> Hi Jacopo,\n>\n> Thanks for your work.\n>\n> On 2019-04-09 21:25:46 +0200, Jacopo Mondi wrote:\n> > Connect the viewfinder buffer ready signal to the IPU3CameraData slot\n> > that complets the buffer first, and if not waiting for other buffers\n> > completes the request as well.\n> >\n> > Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n> > ---\n> >  src/libcamera/pipeline/ipu3/ipu3.cpp | 43 ++++++++++++++++++++++++----\n> >  1 file changed, 37 insertions(+), 6 deletions(-)\n> >\n> > diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp\n> > index bb8d4ce644ca..75ffdc56d157 100644\n> > --- a/src/libcamera/pipeline/ipu3/ipu3.cpp\n> > +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp\n> > @@ -182,7 +182,7 @@ private:\n> >  \t\t{\n> >  \t\t}\n> >\n> > -\t\tvoid imguOutputBufferReady(Buffer *buffer);\n> > +\t\tvoid imguCaptureBufferReady(Buffer *buffer);\n> >  \t\tvoid imguInputBufferReady(Buffer *buffer);\n> >  \t\tvoid cio2BufferReady(Buffer *buffer);\n> >\n> > @@ -722,7 +722,9 @@ int PipelineHandlerIPU3::registerCameras()\n> >  \t\tdata->imgu_->input_->bufferReady.connect(data.get(),\n> >  \t\t\t\t\t&IPU3CameraData::imguInputBufferReady);\n> >  \t\tdata->imgu_->output_.dev->bufferReady.connect(data.get(),\n> > -\t\t\t\t\t&IPU3CameraData::imguOutputBufferReady);\n> > +\t\t\t\t\t&IPU3CameraData::imguCaptureBufferReady);\n> > +\t\tdata->imgu_->viewfinder_.dev->bufferReady.connect(data.get(),\n> > +\t\t\t\t\t&IPU3CameraData::imguCaptureBufferReady);\n> >\n> >\n> >  \t\t/* Initialize and register the Camera and its streams. */\n> > @@ -769,12 +771,41 @@ void PipelineHandlerIPU3::IPU3CameraData::imguInputBufferReady(Buffer *buffer)\n> >   *\n> >   * Buffers completed from the ImgU output are directed to the application.\n> >   */\n> > -void PipelineHandlerIPU3::IPU3CameraData::imguOutputBufferReady(Buffer *buffer)\n> > +void PipelineHandlerIPU3::IPU3CameraData::imguCaptureBufferReady(Buffer *buffer)\n> >  {\n> > -\tRequest *request = queuedRequests_.front();\n> > +\tRequest *request = buffer->request();\n\nWhen commenting patch #9 you said you don't like this.\nI agree on the part that makes the 'request' and 'setRequest' method\npublic and we might need to play with 'friend' to limit the\naccessibility of those method, but you also said you don't like how it\nis used. How would you like to see this being used ?\n\n\n> > +\tif (!request)\n> > +\t\t/*\n> > +\t\t * Completed buffers not part of a request are ignored\n> > +\t\t * (they most probably come from the output stream\n> > +\t\t * internal pool)\n> > +\t\t */\n> > +\t\treturn;\n> > +\n> > +\tif (!pipe_->completeBuffer(camera_, request, buffer))\n> > +\t\t/* Request not completed yet, return here. */\n> > +\t\treturn;\n> > +\n> > +\t/*\n> > +\t * Complete requests in queuing order: if some other request is\n> > +\t * pending, post-pone completion.\n> > +\t */\n> > +\tRequest *front = queuedRequests_.front();\n> > +\tif (front != request)\n> > +\t\treturn;\n>\n> I'm not sure, but i think this needs to be moved to the framework\n> somehow. It will be slight variations of how this will be implemented in\n> different pipeline handlers if we leave it to each pipeline handler to\n> implement ordered completion of requests.\n>\n\nI agree, but not right now. We agreed when discussing v3 to do this\nfor IPU3 and see how it looks like. The second 'real' pipeline handler\nwe'll have we'll try to move this one layer up.\n\n> Best case it should happen transparent to the pipeline handlers, but\n> that might be a tall order. How about implementing a\n> PipelineHandler::completeReady() helper which implementations can call\n> which would take care of dequeuing requests in a ordered fashion? Or if\n> you have a nice idea for how to skip the helper and move to something\n> transparent that would be even better.\n>\n> >\n> > -\tpipe_->completeBuffer(camera_, request, buffer);\n> > -\tpipe_->completeRequest(camera_, request);\n> > +\t/*\n> > +\t * Complete the current request, and all the other pending ones,\n> > +\t * in queuing order.\n> > +\t */\n> > +\twhile (1) {\n> > +\t\tif (front->empty())\n> > +\t\t\tpipe_->completeRequest(camera_, front);\n> > +\t\telse\n> > +\t\t\tbreak;\n> > +\n> > +\t\tfront = queuedRequests_.front();\n> > +\t}\n> >  }\n> >\n> >  /**\n> > --\n> > 2.21.0\n> >\n> > _______________________________________________\n> > libcamera-devel mailing list\n> > libcamera-devel@lists.libcamera.org\n> > https://lists.libcamera.org/listinfo/libcamera-devel\n>\n> --\n> Regards,\n> Niklas Söderlund","headers":{"Return-Path":"<jacopo@jmondi.org>","Received":["from relay1-d.mail.gandi.net (relay1-d.mail.gandi.net\n\t[217.70.183.193])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id DC09C600F9\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 15 Apr 2019 13:38:39 +0200 (CEST)","from uno.localdomain (2-224-242-101.ip172.fastwebnet.it\n\t[2.224.242.101]) (Authenticated sender: jacopo@jmondi.org)\n\tby relay1-d.mail.gandi.net (Postfix) with ESMTPSA id 596D724000F;\n\tMon, 15 Apr 2019 11:38:39 +0000 (UTC)"],"X-Originating-IP":"2.224.242.101","Date":"Mon, 15 Apr 2019 13:39:30 +0200","From":"Jacopo Mondi <jacopo@jmondi.org>","To":"Niklas =?utf-8?q?S=C3=B6derlund?= <niklas.soderlund@ragnatech.se>","Cc":"libcamera-devel@lists.libcamera.org","Message-ID":"<20190415113930.yxiphjvcpznsdeq2@uno.localdomain>","References":"<20190409192548.20325-1-jacopo@jmondi.org>\n\t<20190409192548.20325-11-jacopo@jmondi.org>\n\t<20190414203229.GO1980@bigcity.dyn.berto.se>","MIME-Version":"1.0","Content-Type":"multipart/signed; micalg=pgp-sha256;\n\tprotocol=\"application/pgp-signature\"; boundary=\"fdpkm6gwchwcwaf6\"","Content-Disposition":"inline","In-Reply-To":"<20190414203229.GO1980@bigcity.dyn.berto.se>","User-Agent":"NeoMutt/20180716","Subject":"Re: [libcamera-devel] [PATCH v4 10/12] libcamera: ipu3: Connect\n\tviewfinder's BufferReady signal","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, 15 Apr 2019 11:38:40 -0000"}},{"id":1357,"web_url":"https://patchwork.libcamera.org/comment/1357/","msgid":"<20190415153319.GC17083@pendragon.ideasonboard.com>","date":"2019-04-15T15:33:19","subject":"Re: [libcamera-devel] [PATCH v4 10/12] libcamera: ipu3: Connect\n\tviewfinder's BufferReady signal","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 Mon, Apr 15, 2019 at 01:39:30PM +0200, Jacopo Mondi wrote:\n> On Sun, Apr 14, 2019 at 10:32:29PM +0200, Niklas Söderlund wrote:\n> > On 2019-04-09 21:25:46 +0200, Jacopo Mondi wrote:\n> >> Connect the viewfinder buffer ready signal to the IPU3CameraData slot\n> >> that complets the buffer first, and if not waiting for other buffers\n> >> completes the request as well.\n\nThe commit message is a bit confusing. How about\n\nThe viewfinder and main output require identical logic for buffer and\nrequest completion. Rename the IPU3CameraData::imguOutputBufferReady()\nslot to IPU3CameraData::imguCaptureBufferReady() to reflect this, and\nconnect the viewfinder bufferReady signal to the slot.\n\nUpdate the slot logic to ignore internal buffers that are not part of\nthe request, and to complete the request only when the last buffer\ncompletes.\n\n> >>\n> >> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n> >> ---\n> >>  src/libcamera/pipeline/ipu3/ipu3.cpp | 43 ++++++++++++++++++++++++----\n> >>  1 file changed, 37 insertions(+), 6 deletions(-)\n> >>\n> >> diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp\n> >> index bb8d4ce644ca..75ffdc56d157 100644\n> >> --- a/src/libcamera/pipeline/ipu3/ipu3.cpp\n> >> +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp\n> >> @@ -182,7 +182,7 @@ private:\n> >>  \t\t{\n> >>  \t\t}\n> >>\n> >> -\t\tvoid imguOutputBufferReady(Buffer *buffer);\n> >> +\t\tvoid imguCaptureBufferReady(Buffer *buffer);\n\nBy the way, I think it's fine if you keep the existing name, as it\nmatches imguInputBufferReady(). Up to you, I don't mind one way or the\nother.\n\n> >>  \t\tvoid imguInputBufferReady(Buffer *buffer);\n> >>  \t\tvoid cio2BufferReady(Buffer *buffer);\n> >>\n> >> @@ -722,7 +722,9 @@ int PipelineHandlerIPU3::registerCameras()\n> >>  \t\tdata->imgu_->input_->bufferReady.connect(data.get(),\n> >>  \t\t\t\t\t&IPU3CameraData::imguInputBufferReady);\n> >>  \t\tdata->imgu_->output_.dev->bufferReady.connect(data.get(),\n> >> -\t\t\t\t\t&IPU3CameraData::imguOutputBufferReady);\n> >> +\t\t\t\t\t&IPU3CameraData::imguCaptureBufferReady);\n> >> +\t\tdata->imgu_->viewfinder_.dev->bufferReady.connect(data.get(),\n> >> +\t\t\t\t\t&IPU3CameraData::imguCaptureBufferReady);\n> >>\n> >>\n> >>  \t\t/* Initialize and register the Camera and its streams. */\n> >> @@ -769,12 +771,41 @@ void PipelineHandlerIPU3::IPU3CameraData::imguInputBufferReady(Buffer *buffer)\n> >>   *\n> >>   * Buffers completed from the ImgU output are directed to the application.\n> >>   */\n> >> -void PipelineHandlerIPU3::IPU3CameraData::imguOutputBufferReady(Buffer *buffer)\n> >> +void PipelineHandlerIPU3::IPU3CameraData::imguCaptureBufferReady(Buffer *buffer)\n> >>  {\n> >> -\tRequest *request = queuedRequests_.front();\n> >> +\tRequest *request = buffer->request();\n> \n> When commenting patch #9 you said you don't like this.\n> I agree on the part that makes the 'request' and 'setRequest' method\n> public and we might need to play with 'friend' to limit the\n> accessibility of those method, but you also said you don't like how it\n> is used. How would you like to see this being used ?\n> \n> >> +\tif (!request)\n> >> +\t\t/*\n> >> +\t\t * Completed buffers not part of a request are ignored\n> >> +\t\t * (they most probably come from the output stream\n> >> +\t\t * internal pool)\n\nMost probably ? Is there any other option ?\n\n> >> +\t\t */\n> >> +\t\treturn;\n> >> +\n> >> +\tif (!pipe_->completeBuffer(camera_, request, buffer))\n> >> +\t\t/* Request not completed yet, return here. */\n> >> +\t\treturn;\n> >> +\n> >> +\t/*\n> >> +\t * Complete requests in queuing order: if some other request is\n> >> +\t * pending, post-pone completion.\n> >> +\t */\n> >> +\tRequest *front = queuedRequests_.front();\n> >> +\tif (front != request)\n> >> +\t\treturn;\n> >\n> > I'm not sure, but i think this needs to be moved to the framework\n> > somehow. It will be slight variations of how this will be implemented in\n> > different pipeline handlers if we leave it to each pipeline handler to\n> > implement ordered completion of requests.\n> \n> I agree, but not right now. We agreed when discussing v3 to do this\n> for IPU3 and see how it looks like. The second 'real' pipeline handler\n> we'll have we'll try to move this one layer up.\n\nI guess I'll have to handle this then :-)\n\n> > Best case it should happen transparent to the pipeline handlers, but\n> > that might be a tall order. How about implementing a\n> > PipelineHandler::completeReady() helper which implementations can call\n> > which would take care of dequeuing requests in a ordered fashion? Or if\n> > you have a nice idea for how to skip the helper and move to something\n> > transparent that would be even better.\n> >\n> >> -\tpipe_->completeBuffer(camera_, request, buffer);\n> >> -\tpipe_->completeRequest(camera_, request);\n> >> +\t/*\n> >> +\t * Complete the current request, and all the other pending ones,\n> >> +\t * in queuing order.\n> >> +\t */\n> >> +\twhile (1) {\n> >> +\t\tif (front->empty())\n> >> +\t\t\tpipe_->completeRequest(camera_, front);\n> >> +\t\telse\n> >> +\t\t\tbreak;\n> >> +\n> >> +\t\tfront = queuedRequests_.front();\n> >> +\t}\n\nI think you can simplify all this with\n\n\t/* Complete requests in queuing order. */\n\twhile (1) {\n\t\trequest = queuedRequest_.front();\n\t\tif (!request->empty())\n\t\t\tbreak;\n\n\t\tpipe_->completeRequest(camera_, request);\n\t}\n\n> >>  }\n> >>\n> >>  /**","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 E91B6600F9\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 15 Apr 2019 17:33:28 +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 35177333;\n\tMon, 15 Apr 2019 17:33:28 +0200 (CEST)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1555342408;\n\tbh=djRXOXoGWAZVjFQPEmFXGzzpQ0YEeRIkJ5YV4XIbQCU=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=P2hpuVwF/Ba8HuWJqtyhO35/QQcoqV9OQjhCLHn0m632TlGNGSadUxTKuVE2vi6jj\n\tZV05T6f/SMvEtYJ4EWnMsjV8RZzWKXpxXCHabmGahpqtvCzpNFPAe4eKq6OdcuOy81\n\tcIuneUrPf2jMhKEIxoYM0sK2Ms1thFq0LrEukV7Q=","Date":"Mon, 15 Apr 2019 18:33:19 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Jacopo Mondi <jacopo@jmondi.org>","Cc":"Niklas =?utf-8?q?S=C3=B6derlund?= <niklas.soderlund@ragnatech.se>,\n\tlibcamera-devel@lists.libcamera.org","Message-ID":"<20190415153319.GC17083@pendragon.ideasonboard.com>","References":"<20190409192548.20325-1-jacopo@jmondi.org>\n\t<20190409192548.20325-11-jacopo@jmondi.org>\n\t<20190414203229.GO1980@bigcity.dyn.berto.se>\n\t<20190415113930.yxiphjvcpznsdeq2@uno.localdomain>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<20190415113930.yxiphjvcpznsdeq2@uno.localdomain>","User-Agent":"Mutt/1.10.1 (2018-07-13)","Subject":"Re: [libcamera-devel] [PATCH v4 10/12] libcamera: ipu3: Connect\n\tviewfinder's BufferReady signal","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, 15 Apr 2019 15:33:29 -0000"}}]