[{"id":1009,"web_url":"https://patchwork.libcamera.org/comment/1009/","msgid":"<20190302225405.GM4682@pendragon.ideasonboard.com>","date":"2019-03-02T22:54:05","subject":"Re: [libcamera-devel] [PATCH 06/10] libcamera: ipu3: Implement\n\tbuffer release","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 Thu, Feb 28, 2019 at 09:04:06PM +0100, Jacopo Mondi wrote:\n> Release buffers on all video devices in the pipeline.\n> \n> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n> ---\n>  src/libcamera/pipeline/ipu3/ipu3.cpp | 40 +++++++++++++++++++++++++---\n>  1 file changed, 36 insertions(+), 4 deletions(-)\n> \n> diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp\n> index c7b7973952a0..60a48859b398 100644\n> --- a/src/libcamera/pipeline/ipu3/ipu3.cpp\n> +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp\n> @@ -145,6 +145,8 @@ private:\n>  \tint initCio2(unsigned int index, Cio2Device *cio2);\n>  \tvoid registerCameras();\n>  \n> +\tint releaseBuffers(V4L2Device *dev);\n> +\n>  \tImguDevice imgu0_;\n>  \tImguDevice imgu1_;\n>  \n> @@ -371,13 +373,32 @@ error_reserve_memory:\n>  int PipelineHandlerIPU3::freeBuffers(Camera *camera, Stream *stream)\n>  {\n>  \tIPU3CameraData *data = cameraData(camera);\n> +\tV4L2Device *viewfinder = data->imgu->viewfinder;\n> +\tV4L2Device *output = data->imgu->output;\n> +\tV4L2Device *input = data->imgu->input;\n>  \tV4L2Device *cio2 = data->cio2.output;\n> +\tV4L2Device *stat = data->imgu->stat;\n> +\tint ret;\n>  \n> -\tint ret = cio2->releaseBuffers();\n> -\tif (ret) {\n> -\t\tLOG(IPU3, Error) << \"Failed to release memory\";\n> +\tret = releaseBuffers(viewfinder);\n> +\tif (ret)\n> +\t\treturn ret;\n\nLet's not bail out early. If we fail to release buffers for one video\nnode, we can still try the other ones.\n\n> +\n> +\tret = releaseBuffers(stat);\n> +\tif (ret)\n> +\t\treturn ret;\n> +\n> +\tret = releaseBuffers(output);\n> +\tif (ret)\n> +\t\treturn ret;\n> +\n> +\tret = releaseBuffers(cio2);\n> +\tif (ret)\n> +\t\treturn ret;\n> +\n> +\tret = releaseBuffers(input);\n> +\tif (ret)\n>  \t\treturn ret;\n> -\t}\n>  \n>  \treturn 0;\n>  }\n> @@ -877,6 +898,17 @@ void PipelineHandlerIPU3::registerCameras()\n>  \t}\n>  }\n>  \n> +int PipelineHandlerIPU3::releaseBuffers(V4L2Device *dev)\n> +{\n> +\tint ret = dev->releaseBuffers();\n\nInterestingly enough this function never fails. Should we turn it into a\nvoid function, or keep the return type for later use ?\n\n> +\tif (ret) {\n> +\t\tLOG(IPU3, Error) << \"Failed to release memory\";\n> +\t\treturn ret;\n> +\t}\n\nI'd print this in V4L2Device::releaseBuffers(), not here. That way you\ncan remove the releaseBuffers() method in this class.\n\n> +\n> +\treturn 0;\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 49549610BF\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat,  2 Mar 2019 23:54:12 +0100 (CET)","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 B37EF54E;\n\tSat,  2 Mar 2019 23:54:11 +0100 (CET)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1551567251;\n\tbh=mAYVWTeFzR/W/C9kizF5qsv1+v+URfy1lhz9KERFOT0=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=j9yIGgByv858mRNowLWgYIDRBlPQ8Ecjs5vm9XW/UoSJEw+HkKx0nDoJporg5jwHu\n\tabSrpPAQBRAgAWOf1/Qv9Wet+Mow1SEfnzz0qVsZzFn5H/zOLtO0ftilioUtPUZWys\n\t8q44fPt16+eTx2345R8bXI1pZ0BOXS0JWVEABEYc=","Date":"Sun, 3 Mar 2019 00:54:05 +0200","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Jacopo Mondi <jacopo@jmondi.org>","Cc":"libcamera-devel@lists.libcamera.org","Message-ID":"<20190302225405.GM4682@pendragon.ideasonboard.com>","References":"<20190228200410.3022-1-jacopo@jmondi.org>\n\t<20190228200410.3022-7-jacopo@jmondi.org>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20190228200410.3022-7-jacopo@jmondi.org>","User-Agent":"Mutt/1.10.1 (2018-07-13)","Subject":"Re: [libcamera-devel] [PATCH 06/10] libcamera: ipu3: Implement\n\tbuffer release","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":"Sat, 02 Mar 2019 22:54:12 -0000"}},{"id":1023,"web_url":"https://patchwork.libcamera.org/comment/1023/","msgid":"<20190309205942.nlnuf4dgu2djyq5s@uno.localdomain>","date":"2019-03-09T20:59:42","subject":"Re: [libcamera-devel] [PATCH 06/10] libcamera: ipu3: Implement\n\tbuffer release","submitter":{"id":3,"url":"https://patchwork.libcamera.org/api/people/3/","name":"Jacopo Mondi","email":"jacopo@jmondi.org"},"content":"Hi Laurent\n\nOn Sun, Mar 03, 2019 at 12:54:05AM +0200, Laurent Pinchart wrote:\n> Hi Jacopo,\n>\n> Thank you for the patch.\n>\n> On Thu, Feb 28, 2019 at 09:04:06PM +0100, Jacopo Mondi wrote:\n> > Release buffers on all video devices in the pipeline.\n> >\n> > Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n> > ---\n> >  src/libcamera/pipeline/ipu3/ipu3.cpp | 40 +++++++++++++++++++++++++---\n> >  1 file changed, 36 insertions(+), 4 deletions(-)\n> >\n> > diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp\n> > index c7b7973952a0..60a48859b398 100644\n> > --- a/src/libcamera/pipeline/ipu3/ipu3.cpp\n> > +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp\n> > @@ -145,6 +145,8 @@ private:\n> >  \tint initCio2(unsigned int index, Cio2Device *cio2);\n> >  \tvoid registerCameras();\n> >\n> > +\tint releaseBuffers(V4L2Device *dev);\n> > +\n> >  \tImguDevice imgu0_;\n> >  \tImguDevice imgu1_;\n> >\n> > @@ -371,13 +373,32 @@ error_reserve_memory:\n> >  int PipelineHandlerIPU3::freeBuffers(Camera *camera, Stream *stream)\n> >  {\n> >  \tIPU3CameraData *data = cameraData(camera);\n> > +\tV4L2Device *viewfinder = data->imgu->viewfinder;\n> > +\tV4L2Device *output = data->imgu->output;\n> > +\tV4L2Device *input = data->imgu->input;\n> >  \tV4L2Device *cio2 = data->cio2.output;\n> > +\tV4L2Device *stat = data->imgu->stat;\n> > +\tint ret;\n> >\n> > -\tint ret = cio2->releaseBuffers();\n> > -\tif (ret) {\n> > -\t\tLOG(IPU3, Error) << \"Failed to release memory\";\n> > +\tret = releaseBuffers(viewfinder);\n> > +\tif (ret)\n> > +\t\treturn ret;\n>\n> Let's not bail out early. If we fail to release buffers for one video\n> node, we can still try the other ones.\n>\n> > +\n> > +\tret = releaseBuffers(stat);\n> > +\tif (ret)\n> > +\t\treturn ret;\n> > +\n> > +\tret = releaseBuffers(output);\n> > +\tif (ret)\n> > +\t\treturn ret;\n> > +\n> > +\tret = releaseBuffers(cio2);\n> > +\tif (ret)\n> > +\t\treturn ret;\n> > +\n> > +\tret = releaseBuffers(input);\n> > +\tif (ret)\n> >  \t\treturn ret;\n> > -\t}\n> >\n> >  \treturn 0;\n> >  }\n> > @@ -877,6 +898,17 @@ void PipelineHandlerIPU3::registerCameras()\n> >  \t}\n> >  }\n> >\n> > +int PipelineHandlerIPU3::releaseBuffers(V4L2Device *dev)\n> > +{\n> > +\tint ret = dev->releaseBuffers();\n>\n> Interestingly enough this function never fails. Should we turn it into a\n> void function, or keep the return type for later use ?\n>\n> > +\tif (ret) {\n> > +\t\tLOG(IPU3, Error) << \"Failed to release memory\";\n> > +\t\treturn ret;\n> > +\t}\n>\n> I'd print this in V4L2Device::releaseBuffers(), not here. That way you\n> can remove the releaseBuffers() method in this class.\n>\n\nI'll drop this method, it doesn't even make the code nicer...\n\n> > +\n> > +\treturn 0;\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 relay5-d.mail.gandi.net (relay5-d.mail.gandi.net\n\t[217.70.183.197])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 16A18600F9\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat,  9 Mar 2019 21:59:10 +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 relay5-d.mail.gandi.net (Postfix) with ESMTPSA id 9CDFD1C0002;\n\tSat,  9 Mar 2019 20:59:08 +0000 (UTC)"],"X-Originating-IP":"2.224.242.101","Date":"Sat, 9 Mar 2019 21:59:42 +0100","From":"Jacopo Mondi <jacopo@jmondi.org>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Message-ID":"<20190309205942.nlnuf4dgu2djyq5s@uno.localdomain>","References":"<20190228200410.3022-1-jacopo@jmondi.org>\n\t<20190228200410.3022-7-jacopo@jmondi.org>\n\t<20190302225405.GM4682@pendragon.ideasonboard.com>","MIME-Version":"1.0","Content-Type":"multipart/signed; micalg=pgp-sha256;\n\tprotocol=\"application/pgp-signature\"; boundary=\"uiec4gfeivyini2y\"","Content-Disposition":"inline","In-Reply-To":"<20190302225405.GM4682@pendragon.ideasonboard.com>","User-Agent":"NeoMutt/20180716","Subject":"Re: [libcamera-devel] [PATCH 06/10] libcamera: ipu3: Implement\n\tbuffer release","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":"Sat, 09 Mar 2019 20:59:10 -0000"}}]