[{"id":12853,"web_url":"https://patchwork.libcamera.org/comment/12853/","msgid":"<20200929020125.GQ14614@pendragon.ideasonboard.com>","date":"2020-09-29T02:01:25","subject":"Re: [libcamera-devel] [PATCH v4 7/7] libcamera: pipeline: rkisp1:\n\tUse the media link to track if a path is enabled","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 Tue, Sep 29, 2020 at 03:43:34AM +0200, Niklas Söderlund wrote:\n> Instead of manually tracking if a path is enable or not use the media\n> graph link status. There is no functional change.\n> \n> Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n> ---\n> * Changes since v3\n> - Update spelling in commit message.\n> - Do not check path status in RkISP1Path::start() instead keep check in\n>   pipeline start().\n> ---\n>  src/libcamera/pipeline/rkisp1/rkisp1.cpp    | 26 +++++++--------------\n>  src/libcamera/pipeline/rkisp1/rkisp1_path.h |  1 +\n>  2 files changed, 9 insertions(+), 18 deletions(-)\n> \n> diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n> index 72593a06b0f502b0..48d00970aba3beda 100644\n> --- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n> +++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n> @@ -122,8 +122,7 @@ public:\n>  \tRkISP1CameraData(PipelineHandler *pipe, RkISP1MainPath *mainPath,\n>  \t\t\t RkISP1SelfPath *selfPath)\n>  \t\t: CameraData(pipe), sensor_(nullptr), frame_(0),\n> -\t\t  frameInfo_(pipe), mainPath_(mainPath), selfPath_(selfPath),\n> -\t\t  mainPathActive_(false), selfPathActive_(false)\n> +\t\t  frameInfo_(pipe), mainPath_(mainPath), selfPath_(selfPath)\n>  \t{\n>  \t}\n>  \n> @@ -145,9 +144,6 @@ public:\n>  \tRkISP1MainPath *mainPath_;\n>  \tRkISP1SelfPath *selfPath_;\n>  \n> -\tbool mainPathActive_;\n> -\tbool selfPathActive_;\n> -\n>  private:\n>  \tvoid queueFrameAction(unsigned int frame,\n>  \t\t\t      const IPAOperationData &action);\n> @@ -709,20 +705,14 @@ int PipelineHandlerRkISP1::configure(Camera *camera, CameraConfiguration *c)\n>  \n>  \tLOG(RkISP1, Debug) << \"ISP output pad configured with \" << format.toString();\n>  \n> -\tdata->mainPathActive_ = false;\n> -\tdata->selfPathActive_ = false;\n>  \tfor (const StreamConfiguration &cfg : *config) {\n> -\t\tif (cfg.stream() == &data->mainPathStream_) {\n> +\t\tif (cfg.stream() == &data->mainPathStream_)\n>  \t\t\tret = mainPath_.configure(cfg, format);\n> -\t\t\tif (ret)\n> -\t\t\t\treturn ret;\n> -\t\t\tdata->mainPathActive_ = true;\n> -\t\t} else {\n> +\t\telse\n>  \t\t\tret = selfPath_.configure(cfg, format);\n> -\t\t\tif (ret)\n> -\t\t\t\treturn ret;\n> -\t\t\tdata->selfPathActive_ = true;\n> -\t\t}\n> +\n> +\t\tif (ret)\n> +\t\t\treturn ret;\n>  \t}\n>  \n>  \tV4L2DeviceFormat paramFormat = {};\n> @@ -868,7 +858,7 @@ int PipelineHandlerRkISP1::start(Camera *camera)\n>  \n>  \tstd::map<unsigned int, IPAStream> streamConfig;\n>  \n> -\tif (data->mainPathActive_) {\n> +\tif (data->mainPath_->isEnabled()) {\n>  \t\tret = mainPath_.start();\n>  \t\tif (ret) {\n>  \t\t\tparam_->streamOff();\n> @@ -884,7 +874,7 @@ int PipelineHandlerRkISP1::start(Camera *camera)\n>  \t\t};\n>  \t}\n>  \n> -\tif (data->selfPathActive_) {\n> +\tif (data->selfPath_->isEnabled()) {\n>  \t\tret = selfPath_.start();\n>  \t\tif (ret) {\n>  \t\t\tmainPath_.stop();\n> diff --git a/src/libcamera/pipeline/rkisp1/rkisp1_path.h b/src/libcamera/pipeline/rkisp1/rkisp1_path.h\n> index 98863a2e693729be..f34d6bacd49c8f02 100644\n> --- a/src/libcamera/pipeline/rkisp1/rkisp1_path.h\n> +++ b/src/libcamera/pipeline/rkisp1/rkisp1_path.h\n> @@ -35,6 +35,7 @@ public:\n>  \tbool init(MediaDevice *media);\n>  \n>  \tint setEnabled(bool enable) { return link_->setEnabled(enable); }\n> +\tbool isEnabled() { return link_->flags() & MEDIA_LNK_FL_ENABLED; }\n\n\tbool isEnabled() const\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\n>  \n>  \tStreamConfiguration generateConfiguration(const Size &resolution);\n>  \tCameraConfiguration::Status validate(StreamConfiguration *cfg);","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 BBB76C3B5C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 29 Sep 2020 02:02:02 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 8950660367;\n\tTue, 29 Sep 2020 04:02:02 +0200 (CEST)","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 8B54660365\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 29 Sep 2020 04:02:00 +0200 (CEST)","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 DD4DF540;\n\tTue, 29 Sep 2020 04:01:59 +0200 (CEST)"],"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=\"n3/spypj\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1601344920;\n\tbh=c7MBfvbwuX1469fjy8eRoyCRB9ubCcxq2aZ1KQHmDs4=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=n3/spypjh3+B8PsqB7/VOl5FLgvjIZPReIyzHAoG5M9l6gB0WfXaG42eRfFuajAv8\n\tqFVBZtxKTKESMSp0OhixfnN6GK+drp7N7Puzcsw3SvCfQwpLT5MaUrIpUgpJYFdO54\n\tXCbKw5ZtXNI1ipo1m7GF1SLHYwy8sP3HCP8ZYfy0=","Date":"Tue, 29 Sep 2020 05:01:25 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Niklas =?utf-8?q?S=C3=B6derlund?= <niklas.soderlund@ragnatech.se>","Message-ID":"<20200929020125.GQ14614@pendragon.ideasonboard.com>","References":"<20200929014334.49719-1-niklas.soderlund@ragnatech.se>\n\t<20200929014334.49719-8-niklas.soderlund@ragnatech.se>","MIME-Version":"1.0","Content-Disposition":"inline","In-Reply-To":"<20200929014334.49719-8-niklas.soderlund@ragnatech.se>","Subject":"Re: [libcamera-devel] [PATCH v4 7/7] libcamera: pipeline: rkisp1:\n\tUse the media link to track if a path is enabled","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=\"utf-8\"","Content-Transfer-Encoding":"base64","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]