[{"id":20237,"web_url":"https://patchwork.libcamera.org/comment/20237/","msgid":"<6d5f2cdf-a135-6fe3-1c64-bb2564155b85@ideasonboard.com>","date":"2021-10-15T07:26:10","subject":"Re: [libcamera-devel] [PATCH v3 05/16] ipa: ipu3: Update camera\n\tcontrols in configure()","submitter":{"id":75,"url":"https://patchwork.libcamera.org/api/people/75/","name":"Jean-Michel Hautbois","email":"jeanmichel.hautbois@ideasonboard.com"},"content":"Hi Jacopo,\n\nOn 11/10/2021 17:11, Jacopo Mondi wrote:\n> When a new CameraConfiguration is applied to the Camera the IPA is\n> configured as well, using the newly applied sensor configuration and its\n> updated V4L2 controls.\n> \n> Also update the Camera controls at IPA::configure() time by re-computing\n> the controls::ExposureTime and controls::FrameDurationLimits limits and\n> update the controls on the pipeline handler side after having configured\n> the IPA.\n> \n> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>\n> Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>\n> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> ---\n>  include/libcamera/ipa/ipu3.mojom     |  3 +-\n>  src/ipa/ipu3/ipu3.cpp                | 82 +++++++++++++++++++---------\n>  src/libcamera/pipeline/ipu3/ipu3.cpp |  4 +-\n>  3 files changed, 60 insertions(+), 29 deletions(-)\n> \n> diff --git a/include/libcamera/ipa/ipu3.mojom b/include/libcamera/ipa/ipu3.mojom\n> index 2045ce909a88..2f254ed4193e 100644\n> --- a/include/libcamera/ipa/ipu3.mojom\n> +++ b/include/libcamera/ipa/ipu3.mojom\n> @@ -45,7 +45,8 @@ interface IPAIPU3Interface {\n>  \tstart() => (int32 ret);\n>  \tstop();\n>  \n> -\tconfigure(IPAConfigInfo configInfo) => (int32 ret);\n> +\tconfigure(IPAConfigInfo configInfo)\n> +\t\t=> (int32 ret, libcamera.ControlInfoMap ipaControls);\n>  \n>  \tmapBuffers(array<libcamera.IPABuffer> buffers);\n>  \tunmapBuffers(array<uint32> ids);\n> diff --git a/src/ipa/ipu3/ipu3.cpp b/src/ipa/ipu3/ipu3.cpp\n> index 6d9bbf391cb2..388f1902bcab 100644\n> --- a/src/ipa/ipu3/ipu3.cpp\n> +++ b/src/ipa/ipu3/ipu3.cpp\n> @@ -171,13 +171,17 @@ public:\n>  \tint start() override;\n>  \tvoid stop() override {}\n>  \n> -\tint configure(const IPAConfigInfo &configInfo) override;\n> +\tint configure(const IPAConfigInfo &configInfo,\n> +\t\t      ControlInfoMap *ipaControls) override;\n>  \n>  \tvoid mapBuffers(const std::vector<IPABuffer> &buffers) override;\n>  \tvoid unmapBuffers(const std::vector<unsigned int> &ids) override;\n>  \tvoid processEvent(const IPU3Event &event) override;\n>  \n>  private:\n> +\tvoid updateControls(const IPACameraSensorInfo &sensorInfo,\n> +\t\t\t    const ControlInfoMap &sensorControls,\n> +\t\t\t    ControlInfoMap *ipaControls);\n>  \tvoid processControls(unsigned int frame, const ControlList &controls);\n>  \tvoid fillParams(unsigned int frame, ipu3_uapi_params *params);\n>  \tvoid parseStatistics(unsigned int frame,\n> @@ -212,36 +216,30 @@ private:\n>  \tstruct IPAContext context_;\n>  };\n>  \n> -/**\n> - * Initialize the IPA module and its controls.\n> +\n> +/*\n> + * Compute camera controls using the sensor information and the sensor\n> + * v4l2 controls.\n>   *\n> - * This function receives the camera sensor information from the pipeline\n> - * handler, computes the limits of the controls it handles and returns\n> - * them in the \\a ipaControls output parameter.\n> + * Some of the camera controls are computed by the pipeline handler, some others\n> + * by the IPA module which is in charge of handling, for example, the exposure\n> + * time and the frame duration.\n> + *\n> + * This function computes:\n> + * - controls::ExposureTime\n> + * - controls::FrameDurationLimits\n>   */\n> -int IPAIPU3::init(const IPASettings &settings,\n> -\t\t  const IPACameraSensorInfo &sensorInfo,\n> -\t\t  const ControlInfoMap &sensorControls,\n> -\t\t  ControlInfoMap *ipaControls)\n> +void IPAIPU3::updateControls(const IPACameraSensorInfo &sensorInfo,\n> +\t\t\t     const ControlInfoMap &sensorControls,\n> +\t\t\t     ControlInfoMap *ipaControls)\n>  {\n> -\tcamHelper_ = CameraSensorHelperFactory::create(settings.sensorModel);\n> -\tif (camHelper_ == nullptr) {\n> -\t\tLOG(IPAIPU3, Error)\n> -\t\t\t<< \"Failed to create camera sensor helper for \"\n> -\t\t\t<< settings.sensorModel;\n> -\t\treturn -ENODEV;\n> -\t}\n> -\n> -\t/* Initialize Controls. */\n>  \tControlInfoMap::Map controls{};\n>  \n>  \t/*\n> -\t * Compute exposure time limits.\n> -\t *\n> -\t * Initialize the control using the line length and pixel rate of the\n> -\t * current configuration converted to microseconds. Use the\n> -\t * V4L2_CID_EXPOSURE control to get exposure min, max and default and\n> -\t * convert it from lines to microseconds.\n> +\t * Compute exposure time limits by using line length and pixel rate\n> +\t * converted to microseconds. Use the V4L2_CID_EXPOSURE control to get\n> +\t * exposure min, max and default and convert it from lines to\n> +\t * microseconds.\n>  \t */\n>  \tdouble lineDuration = sensorInfo.lineLength / (sensorInfo.pixelRate / 1e6);\n>  \tconst ControlInfo &v4l2Exposure = sensorControls.find(V4L2_CID_EXPOSURE)->second;\n> @@ -279,6 +277,27 @@ int IPAIPU3::init(const IPASettings &settings,\n>  \t\t\t\t\t\t\t       frameDurations[2]);\n>  \n>  \t*ipaControls = ControlInfoMap(std::move(controls), controls::controls);\n> +}\n> +\n> +/**\n> + * Initialize the IPA module and its controls.\n> + *\n> + * This function receives the camera sensor information from the pipeline\n> + * handler, computes the limits of the controls it handles and returns\n> + * them in the \\a ipaControls output parameter.\n> + */\n> +int IPAIPU3::init(const IPASettings &settings,\n> +\t\t  const IPACameraSensorInfo &sensorInfo,\n> +\t\t  const ControlInfoMap &sensorControls,\n> +\t\t  ControlInfoMap *ipaControls)\n> +{\n> +\tcamHelper_ = CameraSensorHelperFactory::create(settings.sensorModel);\n> +\tif (camHelper_ == nullptr) {\n> +\t\tLOG(IPAIPU3, Error)\n> +\t\t\t<< \"Failed to create camera sensor helper for \"\n> +\t\t\t<< settings.sensorModel;\n> +\t\treturn -ENODEV;\n> +\t}\n>  \n>  \t/* Construct our Algorithms */\n>  \talgorithms_.push_back(std::make_unique<algorithms::Agc>());\n> @@ -286,6 +305,9 @@ int IPAIPU3::init(const IPASettings &settings,\n>  \talgorithms_.push_back(std::make_unique<algorithms::BlackLevelCorrection>());\n>  \talgorithms_.push_back(std::make_unique<algorithms::ToneMapping>());\n>  \n> +\t/* Initialize controls. */\n> +\tupdateControls(sensorInfo, sensorControls, ipaControls);\n> +\n\nThanks, I had a patch almost doing the same, I did not notice you\nalready did that... :-).\n\n>  \treturn 0;\n>  }\n>  \n> @@ -365,7 +387,8 @@ void IPAIPU3::calculateBdsGrid(const Size &bdsOutputSize)\n>  \t\t\t    << (int)bdsGrid.height << \" << \" << (int)bdsGrid.block_height_log2 << \")\";\n>  }\n>  \n> -int IPAIPU3::configure(const IPAConfigInfo &configInfo)\n> +int IPAIPU3::configure(const IPAConfigInfo &configInfo,\n> +\t\t       ControlInfoMap *ipaControls)\n>  {\n>  \tif (configInfo.sensorControls.empty()) {\n>  \t\tLOG(IPAIPU3, Error) << \"No sensor controls provided\";\n> @@ -374,6 +397,10 @@ int IPAIPU3::configure(const IPAConfigInfo &configInfo)\n>  \n>  \tsensorInfo_ = configInfo.sensorInfo;\n>  \n> +\t/*\n> +\t * Compute the sensor V4L2 controls to be used by the algorithms and\n> +\t * to be set on the sensor.\n> +\t */\n>  \tctrls_ = configInfo.sensorControls;\n>  \n>  \tconst auto itExp = ctrls_.find(V4L2_CID_EXPOSURE);\n> @@ -415,6 +442,9 @@ int IPAIPU3::configure(const IPAConfigInfo &configInfo)\n>  \t\t\treturn ret;\n>  \t}\n>  \n> +\t/* Update the camera controls using the new sensor settings. */\n> +\tupdateControls(sensorInfo_, ctrls_, ipaControls);\n> +\n\nI would have put that call before the algorithm->configure() calls, as\nwe may (wait for it) need to pass the updated values to some of them\n(AGC?) through the IPAContext.\n\nReviewed-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>\n\n>  \treturn 0;\n>  }\n>  \n> diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp\n> index 1033153360b8..e0b61deb9b47 100644\n> --- a/src/libcamera/pipeline/ipu3/ipu3.cpp\n> +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp\n> @@ -659,14 +659,14 @@ int PipelineHandlerIPU3::configure(Camera *camera, CameraConfiguration *c)\n>  \tconfigInfo.bdsOutputSize = config->imguConfig().bds;\n>  \tconfigInfo.iif = config->imguConfig().iif;\n>  \n> -\tret = data->ipa_->configure(configInfo);\n> +\tret = data->ipa_->configure(configInfo, &data->ipaControls_);\n>  \tif (ret) {\n>  \t\tLOG(IPU3, Error) << \"Failed to configure IPA: \"\n>  \t\t\t\t << strerror(-ret);\n>  \t\treturn ret;\n>  \t}\n>  \n> -\treturn 0;\n> +\treturn updateControls(data);\n>  }\n>  \n>  int PipelineHandlerIPU3::exportFrameBuffers(Camera *camera, Stream *stream,\n>","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 8FFC8C323E\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 15 Oct 2021 07:26:15 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 24DDB68F50;\n\tFri, 15 Oct 2021 09:26:15 +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 374E26023B\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 15 Oct 2021 09:26:13 +0200 (CEST)","from tatooine.ideasonboard.com (unknown\n\t[IPv6:2a01:e0a:169:7140:ae2a:a11b:484b:c825])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id C1C832E3;\n\tFri, 15 Oct 2021 09:26:12 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"YUlIRO35\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1634282772;\n\tbh=iiOzd1i6767WMYFUiVaMOiDRwqHIS//i3qCAD+Jnxls=;\n\th=Subject:To:References:From:Date:In-Reply-To:From;\n\tb=YUlIRO35X/ldTxaJpW+gp1miMO2kNNodk4TfOES6u75+wr8y74X2gnCblBvnO+bF9\n\tCgRtRQJklRzLtruWsnV0Y0urwo2NLNyxhunVlcrERK/uMd37V8db/9oYQqD5HIgtcc\n\tGc2OkcxBMCSTnJH4trsvS0tvF7Irmxqvg5RTXfuY=","To":"Jacopo Mondi <jacopo@jmondi.org>, libcamera-devel@lists.libcamera.org","References":"<20211011151154.72856-1-jacopo@jmondi.org>\n\t<20211011151154.72856-6-jacopo@jmondi.org>","From":"Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>","Message-ID":"<6d5f2cdf-a135-6fe3-1c64-bb2564155b85@ideasonboard.com>","Date":"Fri, 15 Oct 2021 09:26:10 +0200","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101\n\tThunderbird/78.13.0","MIME-Version":"1.0","In-Reply-To":"<20211011151154.72856-6-jacopo@jmondi.org>","Content-Type":"text/plain; charset=utf-8","Content-Language":"en-US","Content-Transfer-Encoding":"7bit","Subject":"Re: [libcamera-devel] [PATCH v3 05/16] ipa: ipu3: Update camera\n\tcontrols in 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>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":20239,"web_url":"https://patchwork.libcamera.org/comment/20239/","msgid":"<20211015080114.bary232tsknchoiu@uno.localdomain>","date":"2021-10-15T08:01:14","subject":"Re: [libcamera-devel] [PATCH v3 05/16] ipa: ipu3: Update camera\n\tcontrols in configure()","submitter":{"id":3,"url":"https://patchwork.libcamera.org/api/people/3/","name":"Jacopo Mondi","email":"jacopo@jmondi.org"},"content":"Hi Jean-Michel\n\nOn Fri, Oct 15, 2021 at 09:26:10AM +0200, Jean-Michel Hautbois wrote:\n> Hi Jacopo,\n>\n> On 11/10/2021 17:11, Jacopo Mondi wrote:\n> > When a new CameraConfiguration is applied to the Camera the IPA is\n> > configured as well, using the newly applied sensor configuration and its\n> > updated V4L2 controls.\n> >\n> > Also update the Camera controls at IPA::configure() time by re-computing\n> > the controls::ExposureTime and controls::FrameDurationLimits limits and\n> > update the controls on the pipeline handler side after having configured\n> > the IPA.\n> >\n> > Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n> > Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>\n> > Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>\n> > Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> > ---\n> >  include/libcamera/ipa/ipu3.mojom     |  3 +-\n> >  src/ipa/ipu3/ipu3.cpp                | 82 +++++++++++++++++++---------\n> >  src/libcamera/pipeline/ipu3/ipu3.cpp |  4 +-\n> >  3 files changed, 60 insertions(+), 29 deletions(-)\n> >\n> > diff --git a/include/libcamera/ipa/ipu3.mojom b/include/libcamera/ipa/ipu3.mojom\n> > index 2045ce909a88..2f254ed4193e 100644\n> > --- a/include/libcamera/ipa/ipu3.mojom\n> > +++ b/include/libcamera/ipa/ipu3.mojom\n> > @@ -45,7 +45,8 @@ interface IPAIPU3Interface {\n> >  \tstart() => (int32 ret);\n> >  \tstop();\n> >\n> > -\tconfigure(IPAConfigInfo configInfo) => (int32 ret);\n> > +\tconfigure(IPAConfigInfo configInfo)\n> > +\t\t=> (int32 ret, libcamera.ControlInfoMap ipaControls);\n> >\n> >  \tmapBuffers(array<libcamera.IPABuffer> buffers);\n> >  \tunmapBuffers(array<uint32> ids);\n> > diff --git a/src/ipa/ipu3/ipu3.cpp b/src/ipa/ipu3/ipu3.cpp\n> > index 6d9bbf391cb2..388f1902bcab 100644\n> > --- a/src/ipa/ipu3/ipu3.cpp\n> > +++ b/src/ipa/ipu3/ipu3.cpp\n> > @@ -171,13 +171,17 @@ public:\n> >  \tint start() override;\n> >  \tvoid stop() override {}\n> >\n> > -\tint configure(const IPAConfigInfo &configInfo) override;\n> > +\tint configure(const IPAConfigInfo &configInfo,\n> > +\t\t      ControlInfoMap *ipaControls) override;\n> >\n> >  \tvoid mapBuffers(const std::vector<IPABuffer> &buffers) override;\n> >  \tvoid unmapBuffers(const std::vector<unsigned int> &ids) override;\n> >  \tvoid processEvent(const IPU3Event &event) override;\n> >\n> >  private:\n> > +\tvoid updateControls(const IPACameraSensorInfo &sensorInfo,\n> > +\t\t\t    const ControlInfoMap &sensorControls,\n> > +\t\t\t    ControlInfoMap *ipaControls);\n> >  \tvoid processControls(unsigned int frame, const ControlList &controls);\n> >  \tvoid fillParams(unsigned int frame, ipu3_uapi_params *params);\n> >  \tvoid parseStatistics(unsigned int frame,\n> > @@ -212,36 +216,30 @@ private:\n> >  \tstruct IPAContext context_;\n> >  };\n> >\n> > -/**\n> > - * Initialize the IPA module and its controls.\n> > +\n> > +/*\n> > + * Compute camera controls using the sensor information and the sensor\n> > + * v4l2 controls.\n> >   *\n> > - * This function receives the camera sensor information from the pipeline\n> > - * handler, computes the limits of the controls it handles and returns\n> > - * them in the \\a ipaControls output parameter.\n> > + * Some of the camera controls are computed by the pipeline handler, some others\n> > + * by the IPA module which is in charge of handling, for example, the exposure\n> > + * time and the frame duration.\n> > + *\n> > + * This function computes:\n> > + * - controls::ExposureTime\n> > + * - controls::FrameDurationLimits\n> >   */\n> > -int IPAIPU3::init(const IPASettings &settings,\n> > -\t\t  const IPACameraSensorInfo &sensorInfo,\n> > -\t\t  const ControlInfoMap &sensorControls,\n> > -\t\t  ControlInfoMap *ipaControls)\n> > +void IPAIPU3::updateControls(const IPACameraSensorInfo &sensorInfo,\n> > +\t\t\t     const ControlInfoMap &sensorControls,\n> > +\t\t\t     ControlInfoMap *ipaControls)\n> >  {\n> > -\tcamHelper_ = CameraSensorHelperFactory::create(settings.sensorModel);\n> > -\tif (camHelper_ == nullptr) {\n> > -\t\tLOG(IPAIPU3, Error)\n> > -\t\t\t<< \"Failed to create camera sensor helper for \"\n> > -\t\t\t<< settings.sensorModel;\n> > -\t\treturn -ENODEV;\n> > -\t}\n> > -\n> > -\t/* Initialize Controls. */\n> >  \tControlInfoMap::Map controls{};\n> >\n> >  \t/*\n> > -\t * Compute exposure time limits.\n> > -\t *\n> > -\t * Initialize the control using the line length and pixel rate of the\n> > -\t * current configuration converted to microseconds. Use the\n> > -\t * V4L2_CID_EXPOSURE control to get exposure min, max and default and\n> > -\t * convert it from lines to microseconds.\n> > +\t * Compute exposure time limits by using line length and pixel rate\n> > +\t * converted to microseconds. Use the V4L2_CID_EXPOSURE control to get\n> > +\t * exposure min, max and default and convert it from lines to\n> > +\t * microseconds.\n> >  \t */\n> >  \tdouble lineDuration = sensorInfo.lineLength / (sensorInfo.pixelRate / 1e6);\n> >  \tconst ControlInfo &v4l2Exposure = sensorControls.find(V4L2_CID_EXPOSURE)->second;\n> > @@ -279,6 +277,27 @@ int IPAIPU3::init(const IPASettings &settings,\n> >  \t\t\t\t\t\t\t       frameDurations[2]);\n> >\n> >  \t*ipaControls = ControlInfoMap(std::move(controls), controls::controls);\n> > +}\n> > +\n> > +/**\n> > + * Initialize the IPA module and its controls.\n> > + *\n> > + * This function receives the camera sensor information from the pipeline\n> > + * handler, computes the limits of the controls it handles and returns\n> > + * them in the \\a ipaControls output parameter.\n> > + */\n> > +int IPAIPU3::init(const IPASettings &settings,\n> > +\t\t  const IPACameraSensorInfo &sensorInfo,\n> > +\t\t  const ControlInfoMap &sensorControls,\n> > +\t\t  ControlInfoMap *ipaControls)\n> > +{\n> > +\tcamHelper_ = CameraSensorHelperFactory::create(settings.sensorModel);\n> > +\tif (camHelper_ == nullptr) {\n> > +\t\tLOG(IPAIPU3, Error)\n> > +\t\t\t<< \"Failed to create camera sensor helper for \"\n> > +\t\t\t<< settings.sensorModel;\n> > +\t\treturn -ENODEV;\n> > +\t}\n> >\n> >  \t/* Construct our Algorithms */\n> >  \talgorithms_.push_back(std::make_unique<algorithms::Agc>());\n> > @@ -286,6 +305,9 @@ int IPAIPU3::init(const IPASettings &settings,\n> >  \talgorithms_.push_back(std::make_unique<algorithms::BlackLevelCorrection>());\n> >  \talgorithms_.push_back(std::make_unique<algorithms::ToneMapping>());\n> >\n> > +\t/* Initialize controls. */\n> > +\tupdateControls(sensorInfo, sensorControls, ipaControls);\n> > +\n>\n> Thanks, I had a patch almost doing the same, I did not notice you\n> already did that... :-).\n>\n> >  \treturn 0;\n> >  }\n> >\n> > @@ -365,7 +387,8 @@ void IPAIPU3::calculateBdsGrid(const Size &bdsOutputSize)\n> >  \t\t\t    << (int)bdsGrid.height << \" << \" << (int)bdsGrid.block_height_log2 << \")\";\n> >  }\n> >\n> > -int IPAIPU3::configure(const IPAConfigInfo &configInfo)\n> > +int IPAIPU3::configure(const IPAConfigInfo &configInfo,\n> > +\t\t       ControlInfoMap *ipaControls)\n> >  {\n> >  \tif (configInfo.sensorControls.empty()) {\n> >  \t\tLOG(IPAIPU3, Error) << \"No sensor controls provided\";\n> > @@ -374,6 +397,10 @@ int IPAIPU3::configure(const IPAConfigInfo &configInfo)\n> >\n> >  \tsensorInfo_ = configInfo.sensorInfo;\n> >\n> > +\t/*\n> > +\t * Compute the sensor V4L2 controls to be used by the algorithms and\n> > +\t * to be set on the sensor.\n> > +\t */\n> >  \tctrls_ = configInfo.sensorControls;\n> >\n> >  \tconst auto itExp = ctrls_.find(V4L2_CID_EXPOSURE);\n> > @@ -415,6 +442,9 @@ int IPAIPU3::configure(const IPAConfigInfo &configInfo)\n> >  \t\t\treturn ret;\n> >  \t}\n> >\n> > +\t/* Update the camera controls using the new sensor settings. */\n> > +\tupdateControls(sensorInfo_, ctrls_, ipaControls);\n> > +\n>\n> I would have put that call before the algorithm->configure() calls, as\n> we may (wait for it) need to pass the updated values to some of them\n> (AGC?) through the IPAContext.\n\nI see, updateControls() uses the sensor controls part of configInfo\nto compute the Camera's controls::controls, and it seems to me that\nalgo->configure() use the same sensor controls, and does not require\nthe newly compute controls::controls. Will this change soon ? I have\nno problem moving it, but I would do so when required.\n\nThanks\n   j\n\n>\n> Reviewed-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>\n>\n> >  \treturn 0;\n> >  }\n> >\n> > diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp\n> > index 1033153360b8..e0b61deb9b47 100644\n> > --- a/src/libcamera/pipeline/ipu3/ipu3.cpp\n> > +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp\n> > @@ -659,14 +659,14 @@ int PipelineHandlerIPU3::configure(Camera *camera, CameraConfiguration *c)\n> >  \tconfigInfo.bdsOutputSize = config->imguConfig().bds;\n> >  \tconfigInfo.iif = config->imguConfig().iif;\n> >\n> > -\tret = data->ipa_->configure(configInfo);\n> > +\tret = data->ipa_->configure(configInfo, &data->ipaControls_);\n> >  \tif (ret) {\n> >  \t\tLOG(IPU3, Error) << \"Failed to configure IPA: \"\n> >  \t\t\t\t << strerror(-ret);\n> >  \t\treturn ret;\n> >  \t}\n> >\n> > -\treturn 0;\n> > +\treturn updateControls(data);\n> >  }\n> >\n> >  int PipelineHandlerIPU3::exportFrameBuffers(Camera *camera, Stream *stream,\n> >","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 07E6BC323E\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 15 Oct 2021 08:00:28 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 9C90D68F50;\n\tFri, 15 Oct 2021 10:00:27 +0200 (CEST)","from relay2-d.mail.gandi.net (relay2-d.mail.gandi.net\n\t[217.70.183.194])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id A26846023B\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 15 Oct 2021 10:00:26 +0200 (CEST)","(Authenticated sender: jacopo@jmondi.org)\n\tby relay2-d.mail.gandi.net (Postfix) with ESMTPSA id DB53240008;\n\tFri, 15 Oct 2021 08:00:25 +0000 (UTC)"],"Date":"Fri, 15 Oct 2021 10:01:14 +0200","From":"Jacopo Mondi <jacopo@jmondi.org>","To":"Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>","Message-ID":"<20211015080114.bary232tsknchoiu@uno.localdomain>","References":"<20211011151154.72856-1-jacopo@jmondi.org>\n\t<20211011151154.72856-6-jacopo@jmondi.org>\n\t<6d5f2cdf-a135-6fe3-1c64-bb2564155b85@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<6d5f2cdf-a135-6fe3-1c64-bb2564155b85@ideasonboard.com>","Subject":"Re: [libcamera-devel] [PATCH v3 05/16] ipa: ipu3: Update camera\n\tcontrols in 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","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]