[{"id":15807,"web_url":"https://patchwork.libcamera.org/comment/15807/","msgid":"<YFkLa5otJBRjAR19@pendragon.ideasonboard.com>","date":"2021-03-22T21:26:03","subject":"Re: [libcamera-devel] [PATCH 7/7] ipa: raspberrypi: Rationalise\n\tparameters to ipa::configure()","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 Wed, Mar 17, 2021 at 10:02:11AM +0000, Naushir Patuck wrote:\n> Rename ConfigInput to IPAConfig to be more consistent with the naming,\n> and remove ConfigInput::op, as it is never used.\n> \n> Replace ConfigOutput with a ControlList type, as that is the only return\n> type from ipa::configure().\n> \n> Signed-off-by: Naushir Patuck <naush@raspberrypi.com>\n> ---\n>  include/libcamera/ipa/raspberrypi.mojom          | 16 +++++-----------\n>  src/ipa/raspberrypi/raspberrypi.cpp              | 13 ++++++-------\n>  .../pipeline/raspberrypi/raspberrypi.cpp         | 13 +++++--------\n>  3 files changed, 16 insertions(+), 26 deletions(-)\n> \n> diff --git a/include/libcamera/ipa/raspberrypi.mojom b/include/libcamera/ipa/raspberrypi.mojom\n> index 7549397a27c4..f38c22611cc4 100644\n> --- a/include/libcamera/ipa/raspberrypi.mojom\n> +++ b/include/libcamera/ipa/raspberrypi.mojom\n> @@ -29,17 +29,11 @@ struct ISPConfig {\n>  \tControlList controls;\n>  };\n>  \n> -struct ConfigInput {\n> -\tuint32 op;\n> +struct IPAConfig {\n>  \tuint32 transform;\n>  \tFileDescriptor lsTableHandle;\n>  };\n>  \n> -struct ConfigOutput {\n> -\tuint32 params;\n\nRemoval of params could be squashed with 2/7.\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\n> -\tControlList controls;\n> -};\n> -\n>  struct StartConfig {\n>  \tControlList controls;\n>  \tint32 dropFrameCount;\n> @@ -57,7 +51,7 @@ interface IPARPiInterface {\n>  \t * \\param[in] streamConfig Configuration of all active streams\n>  \t * \\param[in] entityControls Controls provided by the pipeline entities\n>  \t * \\param[in] ipaConfig Pipeline-handler-specific configuration data\n> -\t * \\param[out] results Pipeline-handler-specific configuration result\n> +\t * \\param[out] controls Controls to apply by the pipeline entity\n>  \t *\n>  \t * This method shall be called when the camera is configured to inform\n>  \t * the IPA of the camera's streams and the sensor settings.\n> @@ -65,14 +59,14 @@ interface IPARPiInterface {\n>  \t * The \\a sensorInfo conveys information about the camera sensor settings that\n>  \t * the pipeline handler has selected for the configuration.\n>  \t *\n> -\t * The \\a ipaConfig and \\a results parameters carry data passed by the\n> +\t * The \\a ipaConfig and \\a controls parameters carry data passed by the\n>  \t * pipeline handler to the IPA and back.\n>  \t */\n>  \tconfigure(CameraSensorInfo sensorInfo,\n>  \t\t  map<uint32, IPAStream> streamConfig,\n>  \t\t  map<uint32, ControlInfoMap> entityControls,\n> -\t\t  ConfigInput ipaConfig)\n> -\t\t=> (int32 ret, ConfigOutput results);\n> +\t\t  IPAConfig ipaConfig)\n> +\t\t=> (int32 ret, ControlList controls);\n>  \n>  \t/**\n>  \t * \\fn mapBuffers()\n> diff --git a/src/ipa/raspberrypi/raspberrypi.cpp b/src/ipa/raspberrypi/raspberrypi.cpp\n> index 417a7922c3bd..1c928b72fbd0 100644\n> --- a/src/ipa/raspberrypi/raspberrypi.cpp\n> +++ b/src/ipa/raspberrypi/raspberrypi.cpp\n> @@ -85,8 +85,8 @@ public:\n>  \tint configure(const CameraSensorInfo &sensorInfo,\n>  \t\t      const std::map<unsigned int, IPAStream> &streamConfig,\n>  \t\t      const std::map<unsigned int, ControlInfoMap> &entityControls,\n> -\t\t      const ipa::RPi::ConfigInput &data,\n> -\t\t      ipa::RPi::ConfigOutput *response) override;\n> +\t\t      const ipa::RPi::IPAConfig &data,\n> +\t\t      ControlList *controls) override;\n>  \tvoid mapBuffers(const std::vector<IPABuffer> &buffers) override;\n>  \tvoid unmapBuffers(const std::vector<unsigned int> &ids) override;\n>  \tvoid signalStatReady(const uint32_t bufferId) override;\n> @@ -313,16 +313,14 @@ void IPARPi::setMode(const CameraSensorInfo &sensorInfo)\n>  int IPARPi::configure(const CameraSensorInfo &sensorInfo,\n>  \t\t      [[maybe_unused]] const std::map<unsigned int, IPAStream> &streamConfig,\n>  \t\t      const std::map<unsigned int, ControlInfoMap> &entityControls,\n> -\t\t      const ipa::RPi::ConfigInput &ipaConfig,\n> -\t\t      ipa::RPi::ConfigOutput *result)\n> +\t\t      const ipa::RPi::IPAConfig &ipaConfig,\n> +\t\t      ControlList *controls)\n>  {\n>  \tif (entityControls.size() != 2) {\n>  \t\tLOG(IPARPI, Error) << \"No ISP or sensor controls found.\";\n>  \t\treturn -1;\n>  \t}\n>  \n> -\tresult->params = 0;\n> -\n>  \tsensorCtrls_ = entityControls.at(0);\n>  \tispCtrls_ = entityControls.at(1);\n>  \n> @@ -379,7 +377,8 @@ int IPARPi::configure(const CameraSensorInfo &sensorInfo,\n>  \t\tagcStatus.analogue_gain = DefaultAnalogueGain;\n>  \t\tapplyAGC(&agcStatus, ctrls);\n>  \n> -\t\tresult->controls = std::move(ctrls);\n> +\t\tASSERT(controls);\n> +\t\t*controls = std::move(ctrls);\n>  \t}\n>  \n>  \treturn 0;\n> diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n> index 16568d56f31c..1f8307a3c1c5 100644\n> --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n> +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n> @@ -1240,7 +1240,7 @@ int RPiCameraData::configureIPA(const CameraConfiguration *config)\n>  \n>  \tstd::map<unsigned int, IPAStream> streamConfig;\n>  \tstd::map<unsigned int, ControlInfoMap> entityControls;\n> -\tipa::RPi::ConfigInput ipaConfig;\n> +\tipa::RPi::IPAConfig ipaConfig;\n>  \n>  \t/* Get the device format to pass to the IPA. */\n>  \tV4L2DeviceFormat sensorFormat;\n> @@ -1283,19 +1283,16 @@ int RPiCameraData::configureIPA(const CameraConfiguration *config)\n>  \t}\n>  \n>  \t/* Ready the IPA - it must know about the sensor resolution. */\n> -\tipa::RPi::ConfigOutput result;\n> -\n> +\tControlList controls;\n>  \tret = ipa_->configure(sensorInfo_, streamConfig, entityControls, ipaConfig,\n> -\t\t\t      &result);\n> +\t\t\t      &controls);\n>  \tif (ret < 0) {\n>  \t\tLOG(RPI, Error) << \"IPA configuration failed!\";\n>  \t\treturn -EPIPE;\n>  \t}\n>  \n> -\tif (!result.controls.empty()) {\n> -\t\tControlList &ctrls = result.controls;\n> -\t\tunicam_[Unicam::Image].dev()->setControls(&ctrls);\n> -\t}\n> +\tif (!controls.empty())\n> +\t\tunicam_[Unicam::Image].dev()->setControls(&controls);\n>  \n>  \t/*\n>  \t * Configure the H/V flip controls based on the combination of","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 1DFC7BD80C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 22 Mar 2021 21:26:46 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 871F368D66;\n\tMon, 22 Mar 2021 22:26:45 +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 0E99268D62\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 22 Mar 2021 22:26:45 +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 7C9BDED;\n\tMon, 22 Mar 2021 22:26:44 +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=\"UiN3DcHZ\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1616448404;\n\tbh=ZgXPyjxegWiHk2D1S041MXKyhHNrjIR4dWZue0GfKGc=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=UiN3DcHZ3HqUQMtyMHVzwzdx1N10LaKl3abFW1DvM/wX7Akd0MdkbOr1NDbrhNWiu\n\tDS9X8yskwfUVv6NSxeYTT6M2+s8GnpIJtpOizegifpDnDJ/6T5/MqJG3pQ1UEsCJ+1\n\tyx9g5Ggn9Psk2QY/tcWx4pUQ3vguiI2npEKEaTsk=","Date":"Mon, 22 Mar 2021 23:26:03 +0200","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Naushir Patuck <naush@raspberrypi.com>","Message-ID":"<YFkLa5otJBRjAR19@pendragon.ideasonboard.com>","References":"<20210317100211.1067585-1-naush@raspberrypi.com>\n\t<20210317100211.1067585-8-naush@raspberrypi.com>","MIME-Version":"1.0","Content-Disposition":"inline","In-Reply-To":"<20210317100211.1067585-8-naush@raspberrypi.com>","Subject":"Re: [libcamera-devel] [PATCH 7/7] ipa: raspberrypi: Rationalise\n\tparameters to ipa::configure()","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>"}}]