[{"id":4323,"web_url":"https://patchwork.libcamera.org/comment/4323/","msgid":"<20200326212923.GD20581@pendragon.ideasonboard.com>","date":"2020-03-26T21:29:23","subject":"Re: [libcamera-devel] [RFCv2 6/7] libcamera: pipeline: vimc: Call\n\tIPA start() and stop()","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Niklas,\n\nThank you for the patch.\n\nOn Thu, Mar 26, 2020 at 05:08:18PM +0100, Niklas Söderlund wrote:\n> Call the IPA start()/stop() functions before/after the camera is\n> started. This makes sure the IPA functions properly once thread\n> management is moved into the start/stop interface.\n> \n> Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n> ---\n>  src/libcamera/pipeline/vimc/vimc.cpp | 8 ++++++++\n>  1 file changed, 8 insertions(+)\n> \n> diff --git a/src/libcamera/pipeline/vimc/vimc.cpp b/src/libcamera/pipeline/vimc/vimc.cpp\n> index b04a9726efa5ade6..c5eea3a01b0e9446 100644\n> --- a/src/libcamera/pipeline/vimc/vimc.cpp\n> +++ b/src/libcamera/pipeline/vimc/vimc.cpp\n> @@ -274,8 +274,15 @@ int PipelineHandlerVimc::start(Camera *camera)\n>  \tif (ret < 0)\n>  \t\treturn ret;\n>  \n> +\tret = data->ipa_->start();\n> +\tif (ret) {\n> +\t\tdata->video_->releaseBuffers();\n> +\t\treturn ret;\n> +\t}\n> +\n>  \tret = data->video_->streamOn();\n>  \tif (ret < 0) {\n> +\t\tdata->ipa_->stop();\n>  \t\tdata->video_->releaseBuffers();\n>  \t\treturn ret;\n>  \t}\n> @@ -287,6 +294,7 @@ void PipelineHandlerVimc::stop(Camera *camera)\n>  {\n>  \tVimcCameraData *data = cameraData(camera);\n>  \tdata->video_->streamOff();\n> +\tdata->ipa_->stop();\n\nConceptually speaking I think the IPA should be stopped first (and\nstarted last), as I see it \"depending\" on the operation of the pipeline\nhandler, but that makes absolutely no difference in practice here. It\nshould however be consistent between the rkisp1 and vimc pipeline\nhandlers.\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\n>  \tdata->video_->releaseBuffers();\n>  }\n>","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 36FF960412\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 26 Mar 2020 22:29:28 +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 A137E2DC;\n\tThu, 26 Mar 2020 22:29:27 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"DaSr11zz\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1585258167;\n\tbh=VEiSyiblZlIw//6fO26VnBiVrSdE8/3RkKPQoDcYEkE=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=DaSr11zzJ4bfY7B79BV08enG8zAmddK+b2nxF+iFFKVu7j+GMqxVaLm0nPuNKa4mm\n\t7WpIMz5d+qSB7EgcWkVXIKGrMJcWYxHb6PE+qXiQphOv3fL/FX87Do/H317vZefzed\n\tGu8vi0yJSJH4w2ZsuQ3rut3IUJX2XLTTxRl6lUqM=","Date":"Thu, 26 Mar 2020 23:29:23 +0200","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Niklas =?utf-8?q?S=C3=B6derlund?= <niklas.soderlund@ragnatech.se>","Cc":"libcamera-devel@lists.libcamera.org","Message-ID":"<20200326212923.GD20581@pendragon.ideasonboard.com>","References":"<20200326160819.4088361-1-niklas.soderlund@ragnatech.se>\n\t<20200326160819.4088361-7-niklas.soderlund@ragnatech.se>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<20200326160819.4088361-7-niklas.soderlund@ragnatech.se>","User-Agent":"Mutt/1.10.1 (2018-07-13)","Subject":"Re: [libcamera-devel] [RFCv2 6/7] libcamera: pipeline: vimc: Call\n\tIPA start() and stop()","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","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, 26 Mar 2020 21:29:28 -0000"}},{"id":4325,"web_url":"https://patchwork.libcamera.org/comment/4325/","msgid":"<20200326214318.GA1844461@oden.dyn.berto.se>","date":"2020-03-26T21:43:18","subject":"Re: [libcamera-devel] [RFCv2 6/7] libcamera: pipeline: vimc: Call\n\tIPA start() and stop()","submitter":{"id":5,"url":"https://patchwork.libcamera.org/api/people/5/","name":"Niklas Söderlund","email":"niklas.soderlund@ragnatech.se"},"content":"Hi Laurent,\n\nThanks for your feedback.\n\nOn 2020-03-26 23:29:23 +0200, Laurent Pinchart wrote:\n> Hi Niklas,\n> \n> Thank you for the patch.\n> \n> On Thu, Mar 26, 2020 at 05:08:18PM +0100, Niklas Söderlund wrote:\n> > Call the IPA start()/stop() functions before/after the camera is\n> > started. This makes sure the IPA functions properly once thread\n> > management is moved into the start/stop interface.\n> > \n> > Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n> > ---\n> >  src/libcamera/pipeline/vimc/vimc.cpp | 8 ++++++++\n> >  1 file changed, 8 insertions(+)\n> > \n> > diff --git a/src/libcamera/pipeline/vimc/vimc.cpp b/src/libcamera/pipeline/vimc/vimc.cpp\n> > index b04a9726efa5ade6..c5eea3a01b0e9446 100644\n> > --- a/src/libcamera/pipeline/vimc/vimc.cpp\n> > +++ b/src/libcamera/pipeline/vimc/vimc.cpp\n> > @@ -274,8 +274,15 @@ int PipelineHandlerVimc::start(Camera *camera)\n> >  \tif (ret < 0)\n> >  \t\treturn ret;\n> >  \n> > +\tret = data->ipa_->start();\n> > +\tif (ret) {\n> > +\t\tdata->video_->releaseBuffers();\n> > +\t\treturn ret;\n> > +\t}\n> > +\n> >  \tret = data->video_->streamOn();\n> >  \tif (ret < 0) {\n> > +\t\tdata->ipa_->stop();\n> >  \t\tdata->video_->releaseBuffers();\n> >  \t\treturn ret;\n> >  \t}\n> > @@ -287,6 +294,7 @@ void PipelineHandlerVimc::stop(Camera *camera)\n> >  {\n> >  \tVimcCameraData *data = cameraData(camera);\n> >  \tdata->video_->streamOff();\n> > +\tdata->ipa_->stop();\n> \n> Conceptually speaking I think the IPA should be stopped first (and\n> started last), as I see it \"depending\" on the operation of the pipeline\n> handler, but that makes absolutely no difference in practice here. It\n> should however be consistent between the rkisp1 and vimc pipeline\n> handlers.\n\nI wrestled a bit with this when writing the IPA. As the ipa_ is stored \nin the base class CameraData shall we move the ipa_-{start,stop}() calls \nto the camera class start/stop to force them being called uniformly for \nall pipelines?\n\n> \n> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> \n> >  \tdata->video_->releaseBuffers();\n> >  }\n> >  \n> \n> -- \n> Regards,\n> \n> Laurent Pinchart","headers":{"Return-Path":"<niklas.soderlund@ragnatech.se>","Received":["from mail-lj1-x234.google.com (mail-lj1-x234.google.com\n\t[IPv6:2a00:1450:4864:20::234])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 6F85360412\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 26 Mar 2020 22:43:20 +0100 (CET)","by mail-lj1-x234.google.com with SMTP id k21so8109637ljh.2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 26 Mar 2020 14:43:20 -0700 (PDT)","from localhost (h-200-138.A463.priv.bahnhof.se. [176.10.200.138])\n\tby smtp.gmail.com with ESMTPSA id\n\ty20sm2010370ljy.100.2020.03.26.14.43.18\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tThu, 26 Mar 2020 14:43:18 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected)\n\theader.d=ragnatech-se.20150623.gappssmtp.com\n\theader.i=@ragnatech-se.20150623.gappssmtp.com header.b=\"032CMYAM\"; \n\tdkim-atps=neutral","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\tbh=TvCf/BshvoDQzOCIJXPCKxgMYWfl5G15iTPt/mga6vQ=;\n\tb=032CMYAMx5+3ltcQS+ghuKbkdD215ZX3B96R31Ls8qpr62P3jG1GURdYFOZkrR35VO\n\tolK6vS9vif7IYdR+2uMyd4SFF/6heKNA/AMTyGBsG+dsY4aNuBtzs0XgLgMskBZEcLYh\n\tS5eXuhB3xP8DOtgtlhGTDJU5U7pWCv9cM9agNq4ABwhulgIPT1KxIue12lr/KCHu4jXf\n\t5pLnjo54I0MQ+B5doyDgOiDwiBra1TzgpeReIU0XzHHGyIjncKQujTcZDkzCtSiWDAgv\n\tgjhC1KQhc0+x1WVzpHnFYEWj992ZNSrWR3oCNyewsC+KWhqrljEJ2NbMGTv33F3QUKB7\n\tq2aw==","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;\n\tbh=TvCf/BshvoDQzOCIJXPCKxgMYWfl5G15iTPt/mga6vQ=;\n\tb=crRZG8r0hHqU4J6lQ496gvLKA5pRZeYzbY/cAQhd9IPSVkoVQULSEn9DnZio1+VTjC\n\tGWhwNw6aWtuK+sEtGMy2eXvT5whsAVv+ZJ36DML9HOglYvEN4cOLPmrNDg/S+jZyFYre\n\tBAgF2EiNeMCx1aQGi6VoONEUfEGpoU50QfUu08b6fiMxwjX2PCcd+Eh6qqEl/LQl3POH\n\tP7+einRZsvb4YFoYLORqPlrwjlR4bG6tZE4J1rXWNyveG95raMi/eXfSwRNXaMUJLM91\n\tEkDzyWzFALvvo+oHfC/Ufmnf8H7JUNxdnM0BtsfQm66qwdm1MCF0m3zBxyTbxM1wzEah\n\tKyBw==","X-Gm-Message-State":"ANhLgQ3U7iddzh7Ou7OEXItKWGfn9ONuZU0Cu4DQ2XCNwCxWR6zDhW9a\n\tJY//RJ0ZqffPNzSyCcGk4n0F4A==","X-Google-Smtp-Source":"APiQypLdotZvGmWyxRSTHjmuyX9/j2lMY34xjo2nKR9mW3sH/KDwzCex8GIvL7O+0j4X4BpY1iygyw==","X-Received":"by 2002:a2e:800a:: with SMTP id j10mr6366320ljg.65.1585258999689;\n\tThu, 26 Mar 2020 14:43:19 -0700 (PDT)","Date":"Thu, 26 Mar 2020 22:43:18 +0100","From":"Niklas =?iso-8859-1?q?S=F6derlund?= <niklas.soderlund@ragnatech.se>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Message-ID":"<20200326214318.GA1844461@oden.dyn.berto.se>","References":"<20200326160819.4088361-1-niklas.soderlund@ragnatech.se>\n\t<20200326160819.4088361-7-niklas.soderlund@ragnatech.se>\n\t<20200326212923.GD20581@pendragon.ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=iso-8859-1","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<20200326212923.GD20581@pendragon.ideasonboard.com>","Subject":"Re: [libcamera-devel] [RFCv2 6/7] libcamera: pipeline: vimc: Call\n\tIPA start() and stop()","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","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, 26 Mar 2020 21:43:20 -0000"}},{"id":4326,"web_url":"https://patchwork.libcamera.org/comment/4326/","msgid":"<20200326214608.GF20581@pendragon.ideasonboard.com>","date":"2020-03-26T21:46:08","subject":"Re: [libcamera-devel] [RFCv2 6/7] libcamera: pipeline: vimc: Call\n\tIPA start() and stop()","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Niklas,\n\nOn Thu, Mar 26, 2020 at 10:43:18PM +0100, Niklas Söderlund wrote:\n> On 2020-03-26 23:29:23 +0200, Laurent Pinchart wrote:\n> > On Thu, Mar 26, 2020 at 05:08:18PM +0100, Niklas Söderlund wrote:\n> > > Call the IPA start()/stop() functions before/after the camera is\n> > > started. This makes sure the IPA functions properly once thread\n> > > management is moved into the start/stop interface.\n> > > \n> > > Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n> > > ---\n> > >  src/libcamera/pipeline/vimc/vimc.cpp | 8 ++++++++\n> > >  1 file changed, 8 insertions(+)\n> > > \n> > > diff --git a/src/libcamera/pipeline/vimc/vimc.cpp b/src/libcamera/pipeline/vimc/vimc.cpp\n> > > index b04a9726efa5ade6..c5eea3a01b0e9446 100644\n> > > --- a/src/libcamera/pipeline/vimc/vimc.cpp\n> > > +++ b/src/libcamera/pipeline/vimc/vimc.cpp\n> > > @@ -274,8 +274,15 @@ int PipelineHandlerVimc::start(Camera *camera)\n> > >  \tif (ret < 0)\n> > >  \t\treturn ret;\n> > >  \n> > > +\tret = data->ipa_->start();\n> > > +\tif (ret) {\n> > > +\t\tdata->video_->releaseBuffers();\n> > > +\t\treturn ret;\n> > > +\t}\n> > > +\n> > >  \tret = data->video_->streamOn();\n> > >  \tif (ret < 0) {\n> > > +\t\tdata->ipa_->stop();\n> > >  \t\tdata->video_->releaseBuffers();\n> > >  \t\treturn ret;\n> > >  \t}\n> > > @@ -287,6 +294,7 @@ void PipelineHandlerVimc::stop(Camera *camera)\n> > >  {\n> > >  \tVimcCameraData *data = cameraData(camera);\n> > >  \tdata->video_->streamOff();\n> > > +\tdata->ipa_->stop();\n> > \n> > Conceptually speaking I think the IPA should be stopped first (and\n> > started last), as I see it \"depending\" on the operation of the pipeline\n> > handler, but that makes absolutely no difference in practice here. It\n> > should however be consistent between the rkisp1 and vimc pipeline\n> > handlers.\n> \n> I wrestled a bit with this when writing the IPA. As the ipa_ is stored \n> in the base class CameraData shall we move the ipa_-{start,stop}() calls \n> to the camera class start/stop to force them being called uniformly for \n> all pipelines?\n\nI think there's room for standardization, but I don't think it belongs\nto the Camera class, as the IPA is for the pipeline handler to control.\nCameraData is a bit of a misnomer, it should be PipelineCameraData or\nsomething similar, but that's longer.\n\nI'd like, when the IPAs will stabilize a bit, to see how we could have\nhelpers in the base PipelineHandler class, but I don't think now is the\nright time.\n\n> > Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> > \n> > >  \tdata->video_->releaseBuffers();\n> > >  }\n> > >","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 93C4460412\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 26 Mar 2020 22:46: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 0B00E2DC;\n\tThu, 26 Mar 2020 22:46:11 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"DlHd6Iae\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1585259172;\n\tbh=+al1EkcRvska47llolG/WkNN9xPPQ6cu6b7dxhIYPjg=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=DlHd6IaeyDuMouofJHLSrQ+L54k6FbNtcd9Rjo0+kD3irk5YiiutLZKDhR5aIdop6\n\tJkvNlvy2+OUCmTFMDMJUCWkMTdG017vWJYUC0u3T/DglG+BFOLh2cB8hB1VbL05bRZ\n\tfCbIQU6iW+k6WBMPMOKZQBdZy/0joKx2kR3yQJGM=","Date":"Thu, 26 Mar 2020 23:46:08 +0200","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Niklas =?utf-8?q?S=C3=B6derlund?= <niklas.soderlund@ragnatech.se>","Cc":"libcamera-devel@lists.libcamera.org","Message-ID":"<20200326214608.GF20581@pendragon.ideasonboard.com>","References":"<20200326160819.4088361-1-niklas.soderlund@ragnatech.se>\n\t<20200326160819.4088361-7-niklas.soderlund@ragnatech.se>\n\t<20200326212923.GD20581@pendragon.ideasonboard.com>\n\t<20200326214318.GA1844461@oden.dyn.berto.se>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<20200326214318.GA1844461@oden.dyn.berto.se>","User-Agent":"Mutt/1.10.1 (2018-07-13)","Subject":"Re: [libcamera-devel] [RFCv2 6/7] libcamera: pipeline: vimc: Call\n\tIPA start() and stop()","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","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, 26 Mar 2020 21:46:12 -0000"}}]