[{"id":15806,"web_url":"https://patchwork.libcamera.org/comment/15806/","msgid":"<YFkK0f2YuH37vQBB@pendragon.ideasonboard.com>","date":"2021-03-22T21:23:29","subject":"Re: [libcamera-devel] [PATCH 6/7] ipa: raspberrypi: Rationalise\n\tparameters to ipa::start()","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Naush,\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\nOn Wed, Mar 17, 2021 at 10:02:10AM +0000, Naushir Patuck wrote:\n> Separate out the in and out parameters in ipa::start() as they are not\n> the same. This function now takes in a ControlList and returns out a\n> struct StartConfig which holds a ControlList and drop frame count for\n> the pipeline handler to action.\n> \n> Signed-off-by: Naushir Patuck <naush@raspberrypi.com>\n> ---\n>  include/libcamera/ipa/raspberrypi.mojom          |  4 ++--\n>  src/ipa/raspberrypi/raspberrypi.cpp              | 16 +++++++---------\n>  .../pipeline/raspberrypi/raspberrypi.cpp         | 16 +++++++---------\n>  3 files changed, 16 insertions(+), 20 deletions(-)\n> \n> diff --git a/include/libcamera/ipa/raspberrypi.mojom b/include/libcamera/ipa/raspberrypi.mojom\n> index a713c88eee19..7549397a27c4 100644\n> --- a/include/libcamera/ipa/raspberrypi.mojom\n> +++ b/include/libcamera/ipa/raspberrypi.mojom\n> @@ -40,14 +40,14 @@ struct ConfigOutput {\n>  \tControlList controls;\n>  };\n>  \n> -struct StartControls {\n> +struct StartConfig {\n>  \tControlList controls;\n>  \tint32 dropFrameCount;\n>  };\n>  \n>  interface IPARPiInterface {\n>  \tinit(IPASettings settings) => (int32 ret, SensorConfig sensorConfig);\n> -\tstart(StartControls controls) => (StartControls result);\n> +\tstart(ControlList controls) => (StartConfig startConfig);\n>  \tstop();\n>  \n>  \t/**\n> diff --git a/src/ipa/raspberrypi/raspberrypi.cpp b/src/ipa/raspberrypi/raspberrypi.cpp\n> index 2ca64bcdb80a..417a7922c3bd 100644\n> --- a/src/ipa/raspberrypi/raspberrypi.cpp\n> +++ b/src/ipa/raspberrypi/raspberrypi.cpp\n> @@ -79,8 +79,7 @@ public:\n>  \t}\n>  \n>  \tint init(const IPASettings &settings, ipa::RPi::SensorConfig *sensorConfig) override;\n> -\tvoid start(const ipa::RPi::StartControls &data,\n> -\t\t   ipa::RPi::StartControls *result) override;\n> +\tvoid start(const ControlList &controls, ipa::RPi::StartConfig *startConfig) override;\n>  \tvoid stop() override {}\n>  \n>  \tint configure(const CameraSensorInfo &sensorInfo,\n> @@ -192,15 +191,14 @@ int IPARPi::init(const IPASettings &settings, ipa::RPi::SensorConfig *sensorConf\n>  \treturn 0;\n>  }\n>  \n> -void IPARPi::start(const ipa::RPi::StartControls &data,\n> -\t\t   ipa::RPi::StartControls *result)\n> +void IPARPi::start(const ControlList &controls, ipa::RPi::StartConfig *startConfig)\n>  {\n>  \tRPiController::Metadata metadata;\n>  \n> -\tASSERT(result);\n> -\tif (!data.controls.empty()) {\n> +\tASSERT(startConfig);\n> +\tif (!controls.empty()) {\n>  \t\t/* We have been given some controls to action before start. */\n> -\t\tqueueRequest(data.controls);\n> +\t\tqueueRequest(controls);\n>  \t}\n>  \n>  \tcontroller_.SwitchMode(mode_, &metadata);\n> @@ -215,7 +213,7 @@ void IPARPi::start(const ipa::RPi::StartControls &data,\n>  \tif (agcStatus.shutter_time != 0.0 && agcStatus.analogue_gain != 0.0) {\n>  \t\tControlList ctrls(sensorCtrls_);\n>  \t\tapplyAGC(&agcStatus, ctrls);\n> -\t\tresult->controls = std::move(ctrls);\n> +\t\tstartConfig->controls = std::move(ctrls);\n>  \t}\n>  \n>  \t/*\n> @@ -262,7 +260,7 @@ void IPARPi::start(const ipa::RPi::StartControls &data,\n>  \t\tmistrustCount_ = helper_->MistrustFramesModeSwitch();\n>  \t}\n>  \n> -\tresult->dropFrameCount = dropFrame;\n> +\tstartConfig->dropFrameCount = dropFrame;\n>  \n>  \tfirstStart_ = false;\n>  }\n> diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n> index cd8a10a5747f..16568d56f31c 100644\n> --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n> +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n> @@ -815,20 +815,18 @@ int PipelineHandlerRPi::start(Camera *camera, const ControlList *controls)\n>  \t\tdata->applyScalerCrop(*controls);\n>  \n>  \t/* Start the IPA. */\n> -\tipa::RPi::StartControls ipaData;\n> -\tipa::RPi::StartControls result;\n> +\tControlList startControls;\n> +\tipa::RPi::StartConfig startConfig;\n>  \tif (controls)\n> -\t\tipaData.controls = *controls;\n> -\tdata->ipa_->start(ipaData, &result);\n> +\t\tstartControls = *controls;\n> +\tdata->ipa_->start(startControls, &startConfig);\n\nI think you don't need to copy controls anymore:\n\n\tipa::RPi::StartConfig startConfig;\n\tdata->ipa_->start(controls ? *controls : ControlList{}, &startConfig);\n\nOverall this reads much better, it's a nice cleanup.\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\n>  \n>  \t/* Apply any gain/exposure settings that the IPA may have passed back. */\n> -\tif (!result.controls.empty()) {\n> -\t\tControlList &ctrls = result.controls;\n> -\t\tdata->unicam_[Unicam::Image].dev()->setControls(&ctrls);\n> -\t}\n> +\tif (!startConfig.controls.empty())\n> +\t\tdata->unicam_[Unicam::Image].dev()->setControls(&startConfig.controls);\n>  \n>  \t/* Configure the number of dropped frames required on startup. */\n> -\tdata->dropFrameCount_ = result.dropFrameCount;\n> +\tdata->dropFrameCount_ = startConfig.dropFrameCount;\n>  \n>  \t/* We need to set the dropFrameCount_ before queueing buffers. */\n>  \tret = queueAllBuffers(camera);","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 80825BD80C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 22 Mar 2021 21:24:13 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id C43A568D67;\n\tMon, 22 Mar 2021 22:24:12 +0100 (CET)","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 14D6568D62\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 22 Mar 2021 22:24:11 +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 7CD0DED;\n\tMon, 22 Mar 2021 22:24:10 +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=\"YlR+iU8J\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1616448250;\n\tbh=x4WLhRkDyWob9kdObrHJZHSGRzkXENQvnlWCOvoa3I4=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=YlR+iU8JqSP6NdTiLEkNlhqFIgvzyBjFPTY0XVih0eu56cxjVN9y0/OGWLy2xchTP\n\tDWjtVDGaKh3bqBsE3FCAw5ha+VWdl0nv2K1P79aIuDDp2LuJek1we189VfGaTrI/zb\n\tOA9aLWasLzvSGeJkl1gEuNpGG9VNFuP1iPDCYCqU=","Date":"Mon, 22 Mar 2021 23:23:29 +0200","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Naushir Patuck <naush@raspberrypi.com>","Message-ID":"<YFkK0f2YuH37vQBB@pendragon.ideasonboard.com>","References":"<20210317100211.1067585-1-naush@raspberrypi.com>\n\t<20210317100211.1067585-7-naush@raspberrypi.com>","MIME-Version":"1.0","Content-Disposition":"inline","In-Reply-To":"<20210317100211.1067585-7-naush@raspberrypi.com>","Subject":"Re: [libcamera-devel] [PATCH 6/7] ipa: raspberrypi: Rationalise\n\tparameters to ipa::start()","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>"}}]