[{"id":760,"web_url":"https://patchwork.libcamera.org/comment/760/","msgid":"<ce0ec482-33bf-d0bb-8914-4eade1bf912c@ideasonboard.com>","date":"2019-02-05T08:39:02","subject":"Re: [libcamera-devel] [RFC 1/7] libcamera: pipelines: implement\n\tstart and stop of a camera","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"Hi Niklas,\n\nDiscussion points at the documentation of start() and stop(),\n\nOn 05/02/2019 01:06, Niklas Söderlund wrote:\n> The camera need methods to start and stop capturing once it have been\n> configured. Extend the pipeline API to provide this and implement stubs\n> in all pipeline handlers.\n> \n> Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n> ---\n>  src/libcamera/include/pipeline_handler.h |  3 +++\n>  src/libcamera/pipeline/ipu3/ipu3.cpp     | 14 ++++++++++++\n>  src/libcamera/pipeline/uvcvideo.cpp      | 14 ++++++++++++\n>  src/libcamera/pipeline/vimc.cpp          | 14 ++++++++++++\n>  src/libcamera/pipeline_handler.cpp       | 27 ++++++++++++++++++++++++\n>  5 files changed, 72 insertions(+)\n> \n> diff --git a/src/libcamera/include/pipeline_handler.h b/src/libcamera/include/pipeline_handler.h\n> index b4321f0fa0f765be..4bfe45aaf78e34ab 100644\n> --- a/src/libcamera/include/pipeline_handler.h\n> +++ b/src/libcamera/include/pipeline_handler.h\n> @@ -45,6 +45,9 @@ public:\n>  \tvirtual int configureStreams(Camera *camera,\n>  \t\t\t\t     std::map<Stream *, StreamConfiguration> &config) = 0;\n>  \n> +\tvirtual int start(const Camera *camera) = 0;\n> +\tvirtual void stop(const Camera *camera) = 0;\n> +\n>  \tvirtual bool match(DeviceEnumerator *enumerator) = 0;\n>  \n>  protected:\n> diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp\n> index 7823bbb55d9bde16..3bf196051f2ebdbc 100644\n> --- a/src/libcamera/pipeline/ipu3/ipu3.cpp\n> +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp\n> @@ -34,6 +34,9 @@ public:\n>  \tint configureStreams(Camera *camera,\n>  \t\t\t     std::map<Stream *, StreamConfiguration> &config) override;\n>  \n> +\tint start(const Camera *camera) override;\n> +\tvoid stop(const Camera *camera) override;\n> +\n>  \tbool match(DeviceEnumerator *enumerator);\n>  \n>  private:\n> @@ -104,6 +107,17 @@ int PipelineHandlerIPU3::configureStreams(Camera *camera,\n>  \treturn 0;\n>  }\n>  \n> +int PipelineHandlerIPU3::start(const Camera *camera)\n> +{\n> +\tLOG(IPU3, Error) << \"TODO: start camera\";\n> +\treturn 0;\n> +}\n> +\n> +void PipelineHandlerIPU3::stop(const Camera *camera)\n> +{\n> +\tLOG(IPU3, Error) << \"TODO: stop camera\";\n> +}\n> +\n>  bool PipelineHandlerIPU3::match(DeviceEnumerator *enumerator)\n>  {\n>  \tDeviceMatch cio2_dm(\"ipu3-cio2\");\n> diff --git a/src/libcamera/pipeline/uvcvideo.cpp b/src/libcamera/pipeline/uvcvideo.cpp\n> index ad4d45d0698519b6..e6a15c58a63cf76b 100644\n> --- a/src/libcamera/pipeline/uvcvideo.cpp\n> +++ b/src/libcamera/pipeline/uvcvideo.cpp\n> @@ -30,6 +30,9 @@ public:\n>  \tint configureStreams(Camera *camera,\n>  \t\t\t     std::map<Stream *, StreamConfiguration> &config) override;\n>  \n> +\tint start(const Camera *camera) override;\n> +\tvoid stop(const Camera *camera) override;\n> +\n>  \tbool match(DeviceEnumerator *enumerator);\n>  \n>  private:\n> @@ -82,6 +85,17 @@ int PipelineHandlerUVC::configureStreams(Camera *camera,\n>  \treturn 0;\n>  }\n>  \n> +int PipelineHandlerUVC::start(const Camera *camera)\n> +{\n> +\tLOG(UVC, Error) << \"TODO: start camera\";\n> +\treturn 0;\n> +}\n> +\n> +void PipelineHandlerUVC::stop(const Camera *camera)\n> +{\n> +\tLOG(UVC, Error) << \"TODO: stop camera\";\n> +}\n> +\n>  bool PipelineHandlerUVC::match(DeviceEnumerator *enumerator)\n>  {\n>  \tDeviceMatch dm(\"uvcvideo\");\n> diff --git a/src/libcamera/pipeline/vimc.cpp b/src/libcamera/pipeline/vimc.cpp\n> index 900477e257232b70..11eca0cd4d9a6e0c 100644\n> --- a/src/libcamera/pipeline/vimc.cpp\n> +++ b/src/libcamera/pipeline/vimc.cpp\n> @@ -30,6 +30,9 @@ public:\n>  \tint configureStreams(Camera *camera,\n>  \t\t\t     std::map<Stream *, StreamConfiguration> &config) override;\n>  \n> +\tint start(const Camera *camera) override;\n> +\tvoid stop(const Camera *camera) override;\n> +\n>  \tbool match(DeviceEnumerator *enumerator);\n>  \n>  private:\n> @@ -77,6 +80,17 @@ int PipeHandlerVimc::configureStreams(Camera *camera,\n>  \treturn 0;\n>  }\n>  \n> +int PipeHandlerVimc::start(const Camera *camera)\n> +{\n> +\tLOG(VIMC, Error) << \"TODO: start camera\";\n> +\treturn 0;\n> +}\n> +\n> +void PipeHandlerVimc::stop(const Camera *camera)\n> +{\n> +\tLOG(VIMC, Error) << \"TODO: stop camera\";\n> +}\n> +\n>  bool PipeHandlerVimc::match(DeviceEnumerator *enumerator)\n>  {\n>  \tDeviceMatch dm(\"vimc\");\n> diff --git a/src/libcamera/pipeline_handler.cpp b/src/libcamera/pipeline_handler.cpp\n> index 3a560e10c442717f..fa5f780cea34fc8f 100644\n> --- a/src/libcamera/pipeline_handler.cpp\n> +++ b/src/libcamera/pipeline_handler.cpp\n> @@ -109,6 +109,33 @@ PipelineHandler::~PipelineHandler()\n>   * \\return 0 on success or a negative error code on error.\n>   */\n>  \n> +/**\n> + * \\fn PipelineHandler::start()\n> + * \\brief Start capturing from a group of streams\n> + * \\param[in] camera The camera to start\n> + *\n> + * Start the group of streams that have been configured for capture by\n> + * \\a configureStreams().\n\nMinor:\n\nAha - so looking at the doxygen manual, \\a is not what I thought. It\nemphasises the next word. It's not required for the linking. But that's\nfine I don't think it hurts to highlight the configureStreams(), but it\nmight be a mis-use of \\a command.\n\n\thttp://www.doxygen.nl/manual/commands.html#cmda\n\n^ This is a discussion point not a rejection of the \\a :)\n\n\n>                             The intended caller of this interface is\n> + * the Camera class which will in turn will receive the call from the\n> + * application to indicate that it's done configuring the streams\n> + * and are ready to capture.\n> + *\n\nThe intended caller? Or the only caller?\n\nI don't think anyone else would manage the pipeline (unless we have\npipelines in pipelines ... but lets not go there).\n\n\n\n> + * \\return 0 on success or a negative error code on error.\n> + */\n> +\n> +/**\n> + * \\fn PipelineHandler::stop()\n> + * \\brief Stop capturing from all running streams\n> + * \\param[in] camera The camera to stop\n> + *\n> + * Stop processing requests, finish processing all already queued requests\n> + * and once all buffers on all streams have been dequeued stop capturing\n> + * from all running streams. Finish processing of queued requests do not\n> + * necessarily involve processing them by the capture hardware but notifying\n> + * the application that a queued request was not processed due to the fact\n> + * that the camera was stopped before they could be processed.\n\nSome questions on stop():\n\nWill we expect stop() to be a blocking call (perhaps with a timeout?) if\nwe want it to make sure all buffers and requests are stopped?\n\nOr should this just be somewhat asynchronous - making sure that any\nactive processing finishes as soon as possible and that nothing new is\nqueued?\n\nShould the stop function return a potential error if there is an issue\nstopping the stream?\n\nI would expect most of the time a stop is part of a tear down, but\nperhaps there will be times we want to assert a clean shutdown has happened.\n\n\n\n> + */\n> +\n>  /**\n>   * \\fn PipelineHandler::match(DeviceEnumerator *enumerator)\n>   * \\brief Match media devices and create camera instances\n>","headers":{"Return-Path":"<kieran.bingham@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 0047E60C78\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue,  5 Feb 2019 09:39:22 +0100 (CET)","from [192.168.0.245] (d51A4137F.access.telenet.be [81.164.19.127])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 38D3241;\n\tTue,  5 Feb 2019 09:39:22 +0100 (CET)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1549355962;\n\tbh=lf2j/DBzN1qTIG2kki/rjJH0ntmU2sSDlOqPz3hmt4Y=;\n\th=Reply-To:Subject:To:References:From:Date:In-Reply-To:From;\n\tb=BnuLX2/qjRyNLDZbHmoHlgHl9271bvsDn1fTbkMPhnvm2nDEXOYFochrbWnrXa+Kd\n\tNaX58s/kWL4B04IQrMdpk7YF5BY/1un08xw1DzFwwIe4wRMi5eKXFbsVOkbOmYMHwx\n\tSdRIjHMlMpnF+fck6M5t1iG115r45dkWHKvWJ4I4=","Reply-To":"kieran.bingham@ideasonboard.com","To":"=?utf-8?q?Niklas_S=C3=B6derlund?= <niklas.soderlund@ragnatech.se>,\n\tlibcamera-devel@lists.libcamera.org","References":"<20190205000702.15370-1-niklas.soderlund@ragnatech.se>\n\t<20190205000702.15370-2-niklas.soderlund@ragnatech.se>","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Openpgp":"preference=signencrypt","Autocrypt":"addr=kieran.bingham@ideasonboard.com; keydata=\n\tmQINBFYE/WYBEACs1PwjMD9rgCu1hlIiUA1AXR4rv2v+BCLUq//vrX5S5bjzxKAryRf0uHat\n\tV/zwz6hiDrZuHUACDB7X8OaQcwhLaVlq6byfoBr25+hbZG7G3+5EUl9cQ7dQEdvNj6V6y/SC\n\trRanWfelwQThCHckbobWiQJfK9n7rYNcPMq9B8e9F020LFH7Kj6YmO95ewJGgLm+idg1Kb3C\n\tpotzWkXc1xmPzcQ1fvQMOfMwdS+4SNw4rY9f07Xb2K99rjMwZVDgESKIzhsDB5GY465sCsiQ\n\tcSAZRxqE49RTBq2+EQsbrQpIc8XiffAB8qexh5/QPzCmR4kJgCGeHIXBtgRj+nIkCJPZvZtf\n\tKr2EAbc6tgg6DkAEHJb+1okosV09+0+TXywYvtEop/WUOWQ+zo+Y/OBd+8Ptgt1pDRyOBzL8\n\tRXa8ZqRf0Mwg75D+dKntZeJHzPRJyrlfQokngAAs4PaFt6UfS+yp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zCSdaUaNrWGD3iCBxg6lwSO\n\tLKeRhxxfiXCIYEf3vwOsP3YMx2JkD5doseXmWBGW1U0T/oJF+DVfKB6mv5UfsTzpVhJRgee7\n\t4jkjqFq4qsUGxcvF2xtRkfHFpZDbRgRlVmiWkqDkT4qMA+4q1y/dWwshSKi/uwVZNycuLsz+\n\t+OD8xPNCsMTqeUkAKfbD8xW4LCay3r/dD2ckoxRxtMD9eOAyu5wYzo/ydIPTh1QEj9SYyvp8\n\tO0g6CpxEwyHUQtF5oh15O018z3ZLztFJKR3RD42VKVsrnNDKnoY0f4U0z7eJv2NeF8xHMuiU\n\tRCIzqxX1GVYaNkKTnb/Qja8hnYnkUzY1Lc+OtwiGmXTwYsPZjjAaDX35J/RSKAoy5wGo/YFA\n\tJxB1gWThL4kOTbsqqXj9GLcyOImkW0lJGGR3o/fV91Zh63S5TKnf2YGGGzxki+ADdxVQAm+Q\n\tsbsRB8KNNvVXBOVNwko86rQqF9drZuw=","Organization":"Ideas on Board","Message-ID":"<ce0ec482-33bf-d0bb-8914-4eade1bf912c@ideasonboard.com>","Date":"Tue, 5 Feb 2019 09:39:02 +0100","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101\n\tThunderbird/60.4.0","MIME-Version":"1.0","In-Reply-To":"<20190205000702.15370-2-niklas.soderlund@ragnatech.se>","Content-Type":"text/plain; charset=utf-8","Content-Language":"en-GB","Content-Transfer-Encoding":"8bit","Subject":"Re: [libcamera-devel] [RFC 1/7] libcamera: pipelines: implement\n\tstart and stop of a camera","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":"Tue, 05 Feb 2019 08:39:23 -0000"}}]