[{"id":15653,"web_url":"https://patchwork.libcamera.org/comment/15653/","msgid":"<YE0a/JqZetH6OPTB@pendragon.ideasonboard.com>","date":"2021-03-13T20:05:16","subject":"Re: [libcamera-devel] [PATCH 1/2] pipeline: raspberrypi: Avoid\n\tmultiple opens of Unicam embedded data node","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Naush,\n\nThank you for the patch.\n\nOn Sat, Mar 13, 2021 at 10:27:40AM +0000, Naushir Patuck wrote:\n> It is possible for the application to call pipeline_handler::configure()\n> multiple times, which would attempt to open the Unicam embedded data\n> node on every call. This would cause a warning message as the node\n> would have already been opened. Avoid this by tracking if the node\n> has previously been opened.\n> \n> Note that this is a temporary fix since the open call for the Unicam\n> embedded data node will be moved from pipeline_handler::configure() to\n> pipeline_handler::match().\n> \n> Signed-off-by: Naushir Patuck <naush@raspberrypi.com>\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\nEspecially as it's temporary :-)\n\n> ---\n>  src/libcamera/pipeline/raspberrypi/raspberrypi.cpp | 10 ++++++++--\n>  1 file changed, 8 insertions(+), 2 deletions(-)\n> \n> diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n> index 41f1cbffa931..9847e926b048 100644\n> --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n> +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n> @@ -138,7 +138,7 @@ class RPiCameraData : public CameraData\n>  {\n>  public:\n>  \tRPiCameraData(PipelineHandler *pipe)\n> -\t\t: CameraData(pipe), state_(State::Stopped),\n> +\t\t: CameraData(pipe), embeddedNodeOpened_(false), state_(State::Stopped),\n>  \t\t  supportsFlips_(false), flipsAlterBayerOrder_(false),\n>  \t\t  updateScalerCrop_(true), dropFrameCount_(0), ispOutputCount_(0)\n>  \t{\n> @@ -183,6 +183,7 @@ public:\n>  \n>  \tstd::unique_ptr<DelayedControls> delayedCtrls_;\n>  \tbool sensorMetadata_;\n> +\tbool embeddedNodeOpened_;\n>  \n>  \t/*\n>  \t * All the functions in this class are called from a single calling\n> @@ -726,8 +727,13 @@ int PipelineHandlerRPi::configure(Camera *camera, CameraConfiguration *config)\n>  \tif (data->sensorMetadata_) {\n>  \t\tformat = {};\n>  \t\tformat.fourcc = V4L2PixelFormat(V4L2_META_FMT_SENSOR_DATA);\n> +\n> +\t\tif (!data->embeddedNodeOpened_) {\n> +\t\t\tdata->unicam_[Unicam::Embedded].dev()->open();\n> +\t\t\tdata->embeddedNodeOpened_ = true;\n> +\t\t}\n> +\n>  \t\tLOG(RPI, Debug) << \"Setting embedded data format.\";\n> -\t\tdata->unicam_[Unicam::Embedded].dev()->open();\n>  \t\tret = data->unicam_[Unicam::Embedded].dev()->setFormat(&format);\n>  \t\tif (ret) {\n>  \t\t\tLOG(RPI, Error) << \"Failed to set format on Unicam embedded: \"","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 38BB6BD80C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tSat, 13 Mar 2021 20:05:54 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id A40F86084D;\n\tSat, 13 Mar 2021 21:05:53 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id C4FAB605B2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat, 13 Mar 2021 21:05:51 +0100 (CET)","from pendragon.ideasonboard.com (62-78-145-57.bb.dnainternet.fi\n\t[62.78.145.57])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 4D0FE3F0;\n\tSat, 13 Mar 2021 21:05:51 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"tWzPDvOR\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1615665951;\n\tbh=8JWdn8WFgOyAOg3YljifABhKZAyJdYEL5BGmEKSgNwI=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=tWzPDvORe0J2cn5Q8Sn2w+yLDyXg3RRmKmlcsqa6eW3LofOm+YEJulGEGRkCi86/e\n\tK7MwOD+iNWF4l7qdKlgUL1zJf837e3lSMJLN1+1a2AqiiiQzcOM5qnHQAta9LZ5756\n\tlIYpYzqkHapNZC+rfDsoPEMLIqztUEFojJsPmoeg=","Date":"Sat, 13 Mar 2021 22:05:16 +0200","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Naushir Patuck <naush@raspberrypi.com>","Message-ID":"<YE0a/JqZetH6OPTB@pendragon.ideasonboard.com>","References":"<20210313102741.2890809-1-naush@raspberrypi.com>\n\t<20210313102741.2890809-2-naush@raspberrypi.com>","MIME-Version":"1.0","Content-Disposition":"inline","In-Reply-To":"<20210313102741.2890809-2-naush@raspberrypi.com>","Subject":"Re: [libcamera-devel] [PATCH 1/2] pipeline: raspberrypi: Avoid\n\tmultiple opens of Unicam embedded data node","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>","Cc":"libcamera-devel@lists.libcamera.org","Content-Type":"text/plain; charset=\"us-ascii\"","Content-Transfer-Encoding":"7bit","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]