[{"id":1011,"web_url":"https://patchwork.libcamera.org/comment/1011/","msgid":"<20190302225935.GO4682@pendragon.ideasonboard.com>","date":"2019-03-02T22:59:35","subject":"Re: [libcamera-devel] [PATCH 08/10] libcamera: ipu3: Implement\n\tcamera start/stop","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:08PM +0100, Jacopo Mondi wrote:\n> Start and stop all video devices in the pipeline.\n> \n> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n> ---\n>  src/libcamera/pipeline/ipu3/ipu3.cpp | 57 ++++++++++++++++++++++++----\n>  1 file changed, 49 insertions(+), 8 deletions(-)\n> \n> diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp\n> index 8ce661e27f62..b9bc992879f5 100644\n> --- a/src/libcamera/pipeline/ipu3/ipu3.cpp\n> +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp\n> @@ -146,6 +146,8 @@ private:\n>  \tvoid registerCameras();\n>  \n>  \tint releaseBuffers(V4L2Device *dev);\n> +\tint startDevice(V4L2Device *dev);\n> +\tint stopDevice(V4L2Device *dev);\n>  \n>  \tImguDevice imgu0_;\n>  \tImguDevice imgu1_;\n> @@ -410,14 +412,27 @@ int PipelineHandlerIPU3::freeBuffers(Camera *camera, Stream *stream)\n>  int PipelineHandlerIPU3::start(const Camera *camera)\n>  {\n>  \tIPU3CameraData *data = cameraData(camera);\n> -\tV4L2Device *cio2 = data->cio2.output;\n>  \tint ret;\n>  \n> -\tret = cio2->streamOn();\n> -\tif (ret) {\n> -\t\tLOG(IPU3, Info) << \"Failed to start camera \" << camera->name();\n> +\tret = startDevice(data->imgu->output);\n> +\tif (ret)\n> +\t\treturn ret;\n> +\n> +\tret = startDevice(data->imgu->viewfinder);\n> +\tif (ret)\n> +\t\treturn ret;\n> +\n> +\tret = startDevice(data->imgu->stat);\n> +\tif (ret)\n> +\t\treturn ret;\n> +\n> +\tret = startDevice(data->imgu->input);\n> +\tif (ret)\n> +\t\treturn ret;\n> +\n> +\tret = startDevice(data->cio2.output);\n> +\tif (ret)\n>  \t\treturn ret;\n> -\t}\n\nDon't you need to clean up and stop the nodes that have been started ?\ncalling stop() might be all you need.\n\n>  \n>  \treturn 0;\n>  }\n> @@ -425,10 +440,12 @@ int PipelineHandlerIPU3::start(const Camera *camera)\n>  void PipelineHandlerIPU3::stop(const Camera *camera)\n>  {\n>  \tIPU3CameraData *data = cameraData(camera);\n> -\tV4L2Device *cio2 = data->cio2.output;\n>  \n> -\tif (cio2->streamOff())\n> -\t\tLOG(IPU3, Info) << \"Failed to stop camera \" << camera->name();\n> +\tstopDevice(data->imgu->output);\n> +\tstopDevice(data->imgu->viewfinder);\n> +\tstopDevice(data->imgu->stat);\n> +\tstopDevice(data->imgu->input);\n> +\tstopDevice(data->cio2.output);\n\nHow about accummulating errors and printing one message at the end with\nthe number of nodes that failed to stop (if any) ?\n\n>  }\n>  \n>  int PipelineHandlerIPU3::queueRequest(const Camera *camera, Request *request)\n> @@ -934,6 +951,30 @@ int PipelineHandlerIPU3::releaseBuffers(V4L2Device *dev)\n>  \treturn 0;\n>  }\n>  \n> +int PipelineHandlerIPU3::startDevice(V4L2Device *dev)\n> +{\n> +\tint ret = dev->streamOn();\n> +\tif (ret) {\n> +\t\tLOG(IPU3, Info)\n> +\t\t\t<< \"Failed to start video device:\" << dev->deviceNode();\n> +\t\treturn ret;\n\nThe error message is already printed by the V4L2Device class, lets drop\nthese two methods.\n\n> +\t}\n> +\n> +\treturn 0;\n> +}\n> +\n> +int PipelineHandlerIPU3::stopDevice(V4L2Device *dev)\n> +{\n> +\tint ret = dev->streamOff();\n> +\tif (ret) {\n> +\t\tLOG(IPU3, Info)\n> +\t\t\t<< \"Failed to stop video device:\" << dev->deviceNode();\n> +\t\treturn ret;\n> +\t}\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[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id B87F2610BF\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat,  2 Mar 2019 23:59:41 +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 23D8754E;\n\tSat,  2 Mar 2019 23:59:41 +0100 (CET)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1551567581;\n\tbh=kmdr1ruzeDj/sg/r/xUWB8Asd+i0tN5abugv3ncu2iQ=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=muKBklhvNYT5G+t81oyHH+uwvIQn9ALRPKRkH5KwPY+J9zKb4ZwOYSDVe4FHbJntj\n\tiAGFcIh1z6NckNDWxK8Tl04zcCy4xcnwKPevQSuEFLd35i6sf6+ItOOKtCjoIK6AWb\n\tm28tg4ZVGq+jWupZwFtX7IMr6z1u+RJaQqnhr5B8=","Date":"Sun, 3 Mar 2019 00:59:35 +0200","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Jacopo Mondi <jacopo@jmondi.org>","Cc":"libcamera-devel@lists.libcamera.org","Message-ID":"<20190302225935.GO4682@pendragon.ideasonboard.com>","References":"<20190228200410.3022-1-jacopo@jmondi.org>\n\t<20190228200410.3022-9-jacopo@jmondi.org>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20190228200410.3022-9-jacopo@jmondi.org>","User-Agent":"Mutt/1.10.1 (2018-07-13)","Subject":"Re: [libcamera-devel] [PATCH 08/10] libcamera: ipu3: Implement\n\tcamera start/stop","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:59:41 -0000"}},{"id":1024,"web_url":"https://patchwork.libcamera.org/comment/1024/","msgid":"<20190309210050.ezex7m4luqmxqbwd@uno.localdomain>","date":"2019-03-09T21:00:50","subject":"Re: [libcamera-devel] [PATCH 08/10] libcamera: ipu3: Implement\n\tcamera start/stop","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:59:35AM +0200, Laurent Pinchart wrote:\n> Hi Jacopo,\n>\n> Thank you for the patch.\n>\n> On Thu, Feb 28, 2019 at 09:04:08PM +0100, Jacopo Mondi wrote:\n> > Start and stop all video devices in the pipeline.\n> >\n> > Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n> > ---\n> >  src/libcamera/pipeline/ipu3/ipu3.cpp | 57 ++++++++++++++++++++++++----\n> >  1 file changed, 49 insertions(+), 8 deletions(-)\n> >\n> > diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp\n> > index 8ce661e27f62..b9bc992879f5 100644\n> > --- a/src/libcamera/pipeline/ipu3/ipu3.cpp\n> > +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp\n> > @@ -146,6 +146,8 @@ private:\n> >  \tvoid registerCameras();\n> >\n> >  \tint releaseBuffers(V4L2Device *dev);\n> > +\tint startDevice(V4L2Device *dev);\n> > +\tint stopDevice(V4L2Device *dev);\n> >\n> >  \tImguDevice imgu0_;\n> >  \tImguDevice imgu1_;\n> > @@ -410,14 +412,27 @@ int PipelineHandlerIPU3::freeBuffers(Camera *camera, Stream *stream)\n> >  int PipelineHandlerIPU3::start(const Camera *camera)\n> >  {\n> >  \tIPU3CameraData *data = cameraData(camera);\n> > -\tV4L2Device *cio2 = data->cio2.output;\n> >  \tint ret;\n> >\n> > -\tret = cio2->streamOn();\n> > -\tif (ret) {\n> > -\t\tLOG(IPU3, Info) << \"Failed to start camera \" << camera->name();\n> > +\tret = startDevice(data->imgu->output);\n> > +\tif (ret)\n> > +\t\treturn ret;\n> > +\n> > +\tret = startDevice(data->imgu->viewfinder);\n> > +\tif (ret)\n> > +\t\treturn ret;\n> > +\n> > +\tret = startDevice(data->imgu->stat);\n> > +\tif (ret)\n> > +\t\treturn ret;\n> > +\n> > +\tret = startDevice(data->imgu->input);\n> > +\tif (ret)\n> > +\t\treturn ret;\n> > +\n> > +\tret = startDevice(data->cio2.output);\n> > +\tif (ret)\n> >  \t\treturn ret;\n> > -\t}\n>\n> Don't you need to clean up and stop the nodes that have been started ?\n> calling stop() might be all you need.\n>\n> >\n> >  \treturn 0;\n> >  }\n> > @@ -425,10 +440,12 @@ int PipelineHandlerIPU3::start(const Camera *camera)\n> >  void PipelineHandlerIPU3::stop(const Camera *camera)\n> >  {\n> >  \tIPU3CameraData *data = cameraData(camera);\n> > -\tV4L2Device *cio2 = data->cio2.output;\n> >\n> > -\tif (cio2->streamOff())\n> > -\t\tLOG(IPU3, Info) << \"Failed to stop camera \" << camera->name();\n> > +\tstopDevice(data->imgu->output);\n> > +\tstopDevice(data->imgu->viewfinder);\n> > +\tstopDevice(data->imgu->stat);\n> > +\tstopDevice(data->imgu->input);\n> > +\tstopDevice(data->cio2.output);\n>\n> How about accummulating errors and printing one message at the end with\n> the number of nodes that failed to stop (if any) ?\n>\n> >  }\n> >\n> >  int PipelineHandlerIPU3::queueRequest(const Camera *camera, Request *request)\n> > @@ -934,6 +951,30 @@ int PipelineHandlerIPU3::releaseBuffers(V4L2Device *dev)\n> >  \treturn 0;\n> >  }\n> >\n> > +int PipelineHandlerIPU3::startDevice(V4L2Device *dev)\n> > +{\n> > +\tint ret = dev->streamOn();\n> > +\tif (ret) {\n> > +\t\tLOG(IPU3, Info)\n> > +\t\t\t<< \"Failed to start video device:\" << dev->deviceNode();\n> > +\t\treturn ret;\n>\n> The error message is already printed by the V4L2Device class, lets drop\n> these two methods.\n>\n\nWill fix all in v2.\n\nThanks\n  j\n\n> > +\t}\n> > +\n> > +\treturn 0;\n> > +}\n> > +\n> > +int PipelineHandlerIPU3::stopDevice(V4L2Device *dev)\n> > +{\n> > +\tint ret = dev->streamOff();\n> > +\tif (ret) {\n> > +\t\tLOG(IPU3, Info)\n> > +\t\t\t<< \"Failed to stop video device:\" << dev->deviceNode();\n> > +\t\treturn ret;\n> > +\t}\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 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 06347600F9\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat,  9 Mar 2019 22:00:17 +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 90CE460005;\n\tSat,  9 Mar 2019 21:00:16 +0000 (UTC)"],"X-Originating-IP":"2.224.242.101","Date":"Sat, 9 Mar 2019 22:00:50 +0100","From":"Jacopo Mondi <jacopo@jmondi.org>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Message-ID":"<20190309210050.ezex7m4luqmxqbwd@uno.localdomain>","References":"<20190228200410.3022-1-jacopo@jmondi.org>\n\t<20190228200410.3022-9-jacopo@jmondi.org>\n\t<20190302225935.GO4682@pendragon.ideasonboard.com>","MIME-Version":"1.0","Content-Type":"multipart/signed; micalg=pgp-sha256;\n\tprotocol=\"application/pgp-signature\"; boundary=\"tvo6zmpyff4usm44\"","Content-Disposition":"inline","In-Reply-To":"<20190302225935.GO4682@pendragon.ideasonboard.com>","User-Agent":"NeoMutt/20180716","Subject":"Re: [libcamera-devel] [PATCH 08/10] libcamera: ipu3: Implement\n\tcamera start/stop","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 21:00:17 -0000"}}]