[{"id":21142,"web_url":"https://patchwork.libcamera.org/comment/21142/","msgid":"<YZ0FFeS6TM4QNf74@pendragon.ideasonboard.com>","date":"2021-11-23T15:13:25","subject":"Re: [libcamera-devel] [PATCH v3 11/11] ipa: rkisp1: agc: Configure\n\tthe number of cells used by HW","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Jean-Michel,\n\nThank you for the patch.\n\nOn Tue, Nov 23, 2021 at 04:04:23PM +0100, Jean-Michel Hautbois wrote:\n> The ISP can use 25 or 81 cells depending on its revision. Remove the\n> cached value in IPARkISP1 and use IPASessionConfiguration to store it\n> and pass it to AGC.\n> \n> Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>\n> ---\n> v3: - Use the rkisp1 enum for the HW revision\n> \n> ---\n>  src/ipa/rkisp1/algorithms/agc.cpp | 12 +++++++++++-\n>  src/ipa/rkisp1/algorithms/agc.h   |  2 ++\n>  src/ipa/rkisp1/ipa_context.cpp    |  8 ++++++++\n>  src/ipa/rkisp1/ipa_context.h      |  6 ++++++\n>  src/ipa/rkisp1/rkisp1.cpp         | 10 +++++++---\n>  5 files changed, 34 insertions(+), 4 deletions(-)\n> \n> diff --git a/src/ipa/rkisp1/algorithms/agc.cpp b/src/ipa/rkisp1/algorithms/agc.cpp\n> index 0433813a..16966b16 100644\n> --- a/src/ipa/rkisp1/algorithms/agc.cpp\n> +++ b/src/ipa/rkisp1/algorithms/agc.cpp\n> @@ -61,7 +61,7 @@ Agc::Agc()\n>   * \\param[in] context The shared IPA context\n>   * \\param[in] configInfo The IPA configuration data\n>   *\n> - * \\return 0\n> + * \\return 0 on success or a negative error code otherwise\n\nYou can drop this.\n\n>   */\n>  int Agc::configure(IPAContext &context, const IPACameraSensorInfo &configInfo)\n>  {\n> @@ -79,6 +79,16 @@ int Agc::configure(IPAContext &context, const IPACameraSensorInfo &configInfo)\n>  \tcontext.frameContext.agc.gain = minAnalogueGain_;\n>  \tcontext.frameContext.agc.exposure = 10ms / lineDuration_;\n>  \n> +\t/*\n> +\t * According to the RkISP1 documentation:\n> +\t * - versions <= V11 have RKISP1_CIF_ISP_AE_MEAN_MAX_V10 entries,\n\nI would have gone for < V12 here and in the condition below, given that\nthe macro is named RKISP1_CIF_ISP_AE_MEAN_MAX_V12.\n\n> +\t * - versions >= V12 have RKISP1_CIF_ISP_AE_MEAN_MAX_V12 entries.\n> +\t */\n> +\tif (context.configuration.hw.revision <= RKISP1_V11)\n> +\t\tnumCells_ = RKISP1_CIF_ISP_AE_MEAN_MAX_V10;\n> +\telse\n> +\t\tnumCells_ = RKISP1_CIF_ISP_AE_MEAN_MAX_V12;\n> +\n>  \treturn 0;\n>  }\n>  \n> diff --git a/src/ipa/rkisp1/algorithms/agc.h b/src/ipa/rkisp1/algorithms/agc.h\n> index ac95dea5..3ab3f347 100644\n> --- a/src/ipa/rkisp1/algorithms/agc.h\n> +++ b/src/ipa/rkisp1/algorithms/agc.h\n> @@ -45,6 +45,8 @@ private:\n>  \tdouble minAnalogueGain_;\n>  \tdouble maxAnalogueGain_;\n>  \n> +\tuint32_t numCells_;\n> +\n>  \tutils::Duration filteredExposure_;\n>  \tutils::Duration currentExposure_;\n>  };\n> diff --git a/src/ipa/rkisp1/ipa_context.cpp b/src/ipa/rkisp1/ipa_context.cpp\n> index 16fc248f..faa002d1 100644\n> --- a/src/ipa/rkisp1/ipa_context.cpp\n> +++ b/src/ipa/rkisp1/ipa_context.cpp\n> @@ -72,6 +72,14 @@ namespace libcamera::ipa::rkisp1 {\n>   * \\brief Maximum analogue gain supported with the configured sensor\n>   */\n>  \n> +/**\n> + * \\var IPASessionConfiguration::hw\n> + * \\brief RkISP1-specific hardware information\n> + *\n> + * \\var IPASessionConfiguration::hw.revision\n> + * \\brief Hardware revision of the ISP (RKISP1_V*)\n\nI know I've proposed adding (RKISP1_V*), but that was before the enum.\nYou can drop it now if you prefer.\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\n> + */\n> +\n>  /**\n>   * \\var IPAFrameContext::agc\n>   * \\brief Context for the Automatic Gain Control algorithm\n> diff --git a/src/ipa/rkisp1/ipa_context.h b/src/ipa/rkisp1/ipa_context.h\n> index 8e756fb1..e526a0d3 100644\n> --- a/src/ipa/rkisp1/ipa_context.h\n> +++ b/src/ipa/rkisp1/ipa_context.h\n> @@ -8,6 +8,8 @@\n>  #ifndef __LIBCAMERA_RKISP1_IPA_CONTEXT_H__\n>  #define __LIBCAMERA_RKISP1_IPA_CONTEXT_H__\n>  \n> +#include <linux/rkisp1-config.h>\n> +\n>  #include <libcamera/base/utils.h>\n>  \n>  namespace libcamera {\n> @@ -21,6 +23,10 @@ struct IPASessionConfiguration {\n>  \t\tdouble minAnalogueGain;\n>  \t\tdouble maxAnalogueGain;\n>  \t} agc;\n> +\n> +\tstruct {\n> +\t\trkisp1_cif_isp_version revision;\n> +\t} hw;\n>  };\n>  \n>  struct IPAFrameContext {\n> diff --git a/src/ipa/rkisp1/rkisp1.cpp b/src/ipa/rkisp1/rkisp1.cpp\n> index 59e868ff..99ccd596 100644\n> --- a/src/ipa/rkisp1/rkisp1.cpp\n> +++ b/src/ipa/rkisp1/rkisp1.cpp\n> @@ -75,7 +75,7 @@ private:\n>  \tuint32_t maxGain_;\n>  \n>  \t/* revision-specific data */\n> -\tunsigned int hwAeMeanMax_;\n> +\trkisp1_cif_isp_version hwRevision_;\n>  \tunsigned int hwHistBinNMax_;\n>  \tunsigned int hwGammaOutMaxSamples_;\n>  \tunsigned int hwHistogramWeightGridsSize_;\n> @@ -97,13 +97,11 @@ int IPARkISP1::init(const IPASettings &settings, unsigned int hwRevision)\n>  \t/* \\todo Add support for other revisions */\n>  \tswitch (hwRevision) {\n>  \tcase RKISP1_V10:\n> -\t\thwAeMeanMax_ = RKISP1_CIF_ISP_AE_MEAN_MAX_V10;\n>  \t\thwHistBinNMax_ = RKISP1_CIF_ISP_HIST_BIN_N_MAX_V10;\n>  \t\thwGammaOutMaxSamples_ = RKISP1_CIF_ISP_GAMMA_OUT_MAX_SAMPLES_V10;\n>  \t\thwHistogramWeightGridsSize_ = RKISP1_CIF_ISP_HISTOGRAM_WEIGHT_GRIDS_SIZE_V10;\n>  \t\tbreak;\n>  \tcase RKISP1_V12:\n> -\t\thwAeMeanMax_ = RKISP1_CIF_ISP_AE_MEAN_MAX_V12;\n>  \t\thwHistBinNMax_ = RKISP1_CIF_ISP_HIST_BIN_N_MAX_V12;\n>  \t\thwGammaOutMaxSamples_ = RKISP1_CIF_ISP_GAMMA_OUT_MAX_SAMPLES_V12;\n>  \t\thwHistogramWeightGridsSize_ = RKISP1_CIF_ISP_HISTOGRAM_WEIGHT_GRIDS_SIZE_V12;\n> @@ -117,6 +115,9 @@ int IPARkISP1::init(const IPASettings &settings, unsigned int hwRevision)\n>  \n>  \tLOG(IPARkISP1, Debug) << \"Hardware revision is \" << hwRevision;\n>  \n> +\t/* Cache the value to set it in configure. */\n> +\thwRevision_ = static_cast<rkisp1_cif_isp_version>(hwRevision);\n> +\n>  \tcamHelper_ = CameraSensorHelperFactory::create(settings.sensorModel);\n>  \tif (!camHelper_) {\n>  \t\tLOG(IPARkISP1, Error)\n> @@ -184,6 +185,9 @@ int IPARkISP1::configure([[maybe_unused]] const IPACameraSensorInfo &info,\n>  \t/* Clean context at configuration */\n>  \tcontext_ = {};\n>  \n> +\t/* Set the hardware revision for the algorithms. */\n> +\tcontext_.configuration.hw.revision = hwRevision_;\n> +\n>  \t/*\n>  \t * When the AGC computes the new exposure values for a frame, it needs\n>  \t * to know the limits for shutter speed and analogue gain.","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 AD73CBF415\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 23 Nov 2021 15:13:49 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id EE9F260230;\n\tTue, 23 Nov 2021 16:13:48 +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 5F6E360121\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 23 Nov 2021 16:13:48 +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 CF57E993;\n\tTue, 23 Nov 2021 16:13:47 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"ZJbDXodN\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1637680428;\n\tbh=jJVFt/j7KW3MFysWWfQUX8q5+VHk8OGcLtRu4OUBCYA=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=ZJbDXodNjYjctM0ma83m1GDoq/irdKKKDXexqvl/8stbF5uqBadR1npmrZEaZlcLx\n\tOAUMC3UzRV/KQXlcje8bLHDnLowzRGxnz0wBYkpdjh8UsLvDF4tYICctHksFjqDBvc\n\t7DQW0st3HHiL8jHE7x3otwpeHi4H1pQKFsQQs8Vo=","Date":"Tue, 23 Nov 2021 17:13:25 +0200","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>","Message-ID":"<YZ0FFeS6TM4QNf74@pendragon.ideasonboard.com>","References":"<20211123150423.125524-1-jeanmichel.hautbois@ideasonboard.com>\n\t<20211123150423.125524-12-jeanmichel.hautbois@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20211123150423.125524-12-jeanmichel.hautbois@ideasonboard.com>","Subject":"Re: [libcamera-devel] [PATCH v3 11/11] ipa: rkisp1: agc: Configure\n\tthe number of cells used by HW","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>"}},{"id":21145,"web_url":"https://patchwork.libcamera.org/comment/21145/","msgid":"<a41511dc-556f-c8a4-b540-e063dfecad17@ideasonboard.com>","date":"2021-11-23T15:20:41","subject":"Re: [libcamera-devel] [PATCH v3 11/11] ipa: rkisp1: agc: Configure\n\tthe number of cells used by HW","submitter":{"id":75,"url":"https://patchwork.libcamera.org/api/people/75/","name":"Jean-Michel Hautbois","email":"jeanmichel.hautbois@ideasonboard.com"},"content":"On 23/11/2021 16:13, Laurent Pinchart wrote:\n> Hi Jean-Michel,\n> \n> Thank you for the patch.\n> \n> On Tue, Nov 23, 2021 at 04:04:23PM +0100, Jean-Michel Hautbois wrote:\n>> The ISP can use 25 or 81 cells depending on its revision. Remove the\n>> cached value in IPARkISP1 and use IPASessionConfiguration to store it\n>> and pass it to AGC.\n>>\n>> Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>\n>> ---\n>> v3: - Use the rkisp1 enum for the HW revision\n>>\n>> ---\n>>   src/ipa/rkisp1/algorithms/agc.cpp | 12 +++++++++++-\n>>   src/ipa/rkisp1/algorithms/agc.h   |  2 ++\n>>   src/ipa/rkisp1/ipa_context.cpp    |  8 ++++++++\n>>   src/ipa/rkisp1/ipa_context.h      |  6 ++++++\n>>   src/ipa/rkisp1/rkisp1.cpp         | 10 +++++++---\n>>   5 files changed, 34 insertions(+), 4 deletions(-)\n>>\n>> diff --git a/src/ipa/rkisp1/algorithms/agc.cpp b/src/ipa/rkisp1/algorithms/agc.cpp\n>> index 0433813a..16966b16 100644\n>> --- a/src/ipa/rkisp1/algorithms/agc.cpp\n>> +++ b/src/ipa/rkisp1/algorithms/agc.cpp\n>> @@ -61,7 +61,7 @@ Agc::Agc()\n>>    * \\param[in] context The shared IPA context\n>>    * \\param[in] configInfo The IPA configuration data\n>>    *\n>> - * \\return 0\n>> + * \\return 0 on success or a negative error code otherwise\n> \n> You can drop this.\n> \n>>    */\n>>   int Agc::configure(IPAContext &context, const IPACameraSensorInfo &configInfo)\n>>   {\n>> @@ -79,6 +79,16 @@ int Agc::configure(IPAContext &context, const IPACameraSensorInfo &configInfo)\n>>   \tcontext.frameContext.agc.gain = minAnalogueGain_;\n>>   \tcontext.frameContext.agc.exposure = 10ms / lineDuration_;\n>>   \n>> +\t/*\n>> +\t * According to the RkISP1 documentation:\n>> +\t * - versions <= V11 have RKISP1_CIF_ISP_AE_MEAN_MAX_V10 entries,\n> \n> I would have gone for < V12 here and in the condition below, given that\n> the macro is named RKISP1_CIF_ISP_AE_MEAN_MAX_V12.\n> \n>> +\t * - versions >= V12 have RKISP1_CIF_ISP_AE_MEAN_MAX_V12 entries.\n>> +\t */\n>> +\tif (context.configuration.hw.revision <= RKISP1_V11)\n>> +\t\tnumCells_ = RKISP1_CIF_ISP_AE_MEAN_MAX_V10;\n>> +\telse\n>> +\t\tnumCells_ = RKISP1_CIF_ISP_AE_MEAN_MAX_V12;\n>> +\n>>   \treturn 0;\n>>   }\n>>   \n>> diff --git a/src/ipa/rkisp1/algorithms/agc.h b/src/ipa/rkisp1/algorithms/agc.h\n>> index ac95dea5..3ab3f347 100644\n>> --- a/src/ipa/rkisp1/algorithms/agc.h\n>> +++ b/src/ipa/rkisp1/algorithms/agc.h\n>> @@ -45,6 +45,8 @@ private:\n>>   \tdouble minAnalogueGain_;\n>>   \tdouble maxAnalogueGain_;\n>>   \n>> +\tuint32_t numCells_;\n>> +\n>>   \tutils::Duration filteredExposure_;\n>>   \tutils::Duration currentExposure_;\n>>   };\n>> diff --git a/src/ipa/rkisp1/ipa_context.cpp b/src/ipa/rkisp1/ipa_context.cpp\n>> index 16fc248f..faa002d1 100644\n>> --- a/src/ipa/rkisp1/ipa_context.cpp\n>> +++ b/src/ipa/rkisp1/ipa_context.cpp\n>> @@ -72,6 +72,14 @@ namespace libcamera::ipa::rkisp1 {\n>>    * \\brief Maximum analogue gain supported with the configured sensor\n>>    */\n>>   \n>> +/**\n>> + * \\var IPASessionConfiguration::hw\n>> + * \\brief RkISP1-specific hardware information\n>> + *\n>> + * \\var IPASessionConfiguration::hw.revision\n>> + * \\brief Hardware revision of the ISP (RKISP1_V*)\n> \n> I know I've proposed adding (RKISP1_V*), but that was before the enum.\n> You can drop it now if you prefer.\n\nAs we don't have its type here, it can help, I suppose, so I will keep \nit like this if you don't mind :-).\n\n> \n> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> \n>> + */\n>> +\n>>   /**\n>>    * \\var IPAFrameContext::agc\n>>    * \\brief Context for the Automatic Gain Control algorithm\n>> diff --git a/src/ipa/rkisp1/ipa_context.h b/src/ipa/rkisp1/ipa_context.h\n>> index 8e756fb1..e526a0d3 100644\n>> --- a/src/ipa/rkisp1/ipa_context.h\n>> +++ b/src/ipa/rkisp1/ipa_context.h\n>> @@ -8,6 +8,8 @@\n>>   #ifndef __LIBCAMERA_RKISP1_IPA_CONTEXT_H__\n>>   #define __LIBCAMERA_RKISP1_IPA_CONTEXT_H__\n>>   \n>> +#include <linux/rkisp1-config.h>\n>> +\n>>   #include <libcamera/base/utils.h>\n>>   \n>>   namespace libcamera {\n>> @@ -21,6 +23,10 @@ struct IPASessionConfiguration {\n>>   \t\tdouble minAnalogueGain;\n>>   \t\tdouble maxAnalogueGain;\n>>   \t} agc;\n>> +\n>> +\tstruct {\n>> +\t\trkisp1_cif_isp_version revision;\n>> +\t} hw;\n>>   };\n>>   \n>>   struct IPAFrameContext {\n>> diff --git a/src/ipa/rkisp1/rkisp1.cpp b/src/ipa/rkisp1/rkisp1.cpp\n>> index 59e868ff..99ccd596 100644\n>> --- a/src/ipa/rkisp1/rkisp1.cpp\n>> +++ b/src/ipa/rkisp1/rkisp1.cpp\n>> @@ -75,7 +75,7 @@ private:\n>>   \tuint32_t maxGain_;\n>>   \n>>   \t/* revision-specific data */\n>> -\tunsigned int hwAeMeanMax_;\n>> +\trkisp1_cif_isp_version hwRevision_;\n>>   \tunsigned int hwHistBinNMax_;\n>>   \tunsigned int hwGammaOutMaxSamples_;\n>>   \tunsigned int hwHistogramWeightGridsSize_;\n>> @@ -97,13 +97,11 @@ int IPARkISP1::init(const IPASettings &settings, unsigned int hwRevision)\n>>   \t/* \\todo Add support for other revisions */\n>>   \tswitch (hwRevision) {\n>>   \tcase RKISP1_V10:\n>> -\t\thwAeMeanMax_ = RKISP1_CIF_ISP_AE_MEAN_MAX_V10;\n>>   \t\thwHistBinNMax_ = RKISP1_CIF_ISP_HIST_BIN_N_MAX_V10;\n>>   \t\thwGammaOutMaxSamples_ = RKISP1_CIF_ISP_GAMMA_OUT_MAX_SAMPLES_V10;\n>>   \t\thwHistogramWeightGridsSize_ = RKISP1_CIF_ISP_HISTOGRAM_WEIGHT_GRIDS_SIZE_V10;\n>>   \t\tbreak;\n>>   \tcase RKISP1_V12:\n>> -\t\thwAeMeanMax_ = RKISP1_CIF_ISP_AE_MEAN_MAX_V12;\n>>   \t\thwHistBinNMax_ = RKISP1_CIF_ISP_HIST_BIN_N_MAX_V12;\n>>   \t\thwGammaOutMaxSamples_ = RKISP1_CIF_ISP_GAMMA_OUT_MAX_SAMPLES_V12;\n>>   \t\thwHistogramWeightGridsSize_ = RKISP1_CIF_ISP_HISTOGRAM_WEIGHT_GRIDS_SIZE_V12;\n>> @@ -117,6 +115,9 @@ int IPARkISP1::init(const IPASettings &settings, unsigned int hwRevision)\n>>   \n>>   \tLOG(IPARkISP1, Debug) << \"Hardware revision is \" << hwRevision;\n>>   \n>> +\t/* Cache the value to set it in configure. */\n>> +\thwRevision_ = static_cast<rkisp1_cif_isp_version>(hwRevision);\n>> +\n>>   \tcamHelper_ = CameraSensorHelperFactory::create(settings.sensorModel);\n>>   \tif (!camHelper_) {\n>>   \t\tLOG(IPARkISP1, Error)\n>> @@ -184,6 +185,9 @@ int IPARkISP1::configure([[maybe_unused]] const IPACameraSensorInfo &info,\n>>   \t/* Clean context at configuration */\n>>   \tcontext_ = {};\n>>   \n>> +\t/* Set the hardware revision for the algorithms. */\n>> +\tcontext_.configuration.hw.revision = hwRevision_;\n>> +\n>>   \t/*\n>>   \t * When the AGC computes the new exposure values for a frame, it needs\n>>   \t * to know the limits for shutter speed and analogue gain.\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 66F25BF415\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 23 Nov 2021 15:20:46 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id B9EDB60230;\n\tTue, 23 Nov 2021 16:20:45 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 4D3CF60121\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 23 Nov 2021 16:20:44 +0100 (CET)","from [IPV6:2a01:e0a:169:7140:3c3b:9149:b:8aa9] (unknown\n\t[IPv6:2a01:e0a:169:7140:3c3b:9149:b:8aa9])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id ECF9D993;\n\tTue, 23 Nov 2021 16:20:43 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"FDYto4pW\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1637680844;\n\tbh=l/H0znPvjc4T0yanAM37rJ68aFigmc32o15ZJthBCHk=;\n\th=Date:Subject:To:Cc:References:From:In-Reply-To:From;\n\tb=FDYto4pWy89Bcsv2mVoB59Zoaq+rUUz73fpL/AKfgoti/bc+6rFaMrL0e6Rjuj1Sf\n\toua9Azhkv53zf0ZZBSeKDuQKG0QmPBpcWa/SpGINuyRaWfhLk9Gsm0cit+nsr55Lpo\n\trO3Lxn65aI2oWqzjriMOQuW/lyU1n3rP+XyVEOpc=","Message-ID":"<a41511dc-556f-c8a4-b540-e063dfecad17@ideasonboard.com>","Date":"Tue, 23 Nov 2021 16:20:41 +0100","MIME-Version":"1.0","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101\n\tThunderbird/91.3.1","Content-Language":"en-US","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","References":"<20211123150423.125524-1-jeanmichel.hautbois@ideasonboard.com>\n\t<20211123150423.125524-12-jeanmichel.hautbois@ideasonboard.com>\n\t<YZ0FFeS6TM4QNf74@pendragon.ideasonboard.com>","From":"Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>","In-Reply-To":"<YZ0FFeS6TM4QNf74@pendragon.ideasonboard.com>","Content-Type":"text/plain; charset=UTF-8; format=flowed","Content-Transfer-Encoding":"7bit","Subject":"Re: [libcamera-devel] [PATCH v3 11/11] ipa: rkisp1: agc: Configure\n\tthe number of cells used by HW","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>"}},{"id":21148,"web_url":"https://patchwork.libcamera.org/comment/21148/","msgid":"<YZ0IZO3MBcEY0hcl@pendragon.ideasonboard.com>","date":"2021-11-23T15:27:32","subject":"Re: [libcamera-devel] [PATCH v3 11/11] ipa: rkisp1: agc: Configure\n\tthe number of cells used by HW","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Jean-Michel,\n\nOn Tue, Nov 23, 2021 at 04:20:41PM +0100, Jean-Michel Hautbois wrote:\n> On 23/11/2021 16:13, Laurent Pinchart wrote:\n> > On Tue, Nov 23, 2021 at 04:04:23PM +0100, Jean-Michel Hautbois wrote:\n> >> The ISP can use 25 or 81 cells depending on its revision. Remove the\n> >> cached value in IPARkISP1 and use IPASessionConfiguration to store it\n> >> and pass it to AGC.\n> >>\n> >> Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>\n> >> ---\n> >> v3: - Use the rkisp1 enum for the HW revision\n> >>\n> >> ---\n> >>   src/ipa/rkisp1/algorithms/agc.cpp | 12 +++++++++++-\n> >>   src/ipa/rkisp1/algorithms/agc.h   |  2 ++\n> >>   src/ipa/rkisp1/ipa_context.cpp    |  8 ++++++++\n> >>   src/ipa/rkisp1/ipa_context.h      |  6 ++++++\n> >>   src/ipa/rkisp1/rkisp1.cpp         | 10 +++++++---\n> >>   5 files changed, 34 insertions(+), 4 deletions(-)\n> >>\n> >> diff --git a/src/ipa/rkisp1/algorithms/agc.cpp b/src/ipa/rkisp1/algorithms/agc.cpp\n> >> index 0433813a..16966b16 100644\n> >> --- a/src/ipa/rkisp1/algorithms/agc.cpp\n> >> +++ b/src/ipa/rkisp1/algorithms/agc.cpp\n> >> @@ -61,7 +61,7 @@ Agc::Agc()\n> >>    * \\param[in] context The shared IPA context\n> >>    * \\param[in] configInfo The IPA configuration data\n> >>    *\n> >> - * \\return 0\n> >> + * \\return 0 on success or a negative error code otherwise\n> > \n> > You can drop this.\n> > \n> >>    */\n> >>   int Agc::configure(IPAContext &context, const IPACameraSensorInfo &configInfo)\n> >>   {\n> >> @@ -79,6 +79,16 @@ int Agc::configure(IPAContext &context, const IPACameraSensorInfo &configInfo)\n> >>   \tcontext.frameContext.agc.gain = minAnalogueGain_;\n> >>   \tcontext.frameContext.agc.exposure = 10ms / lineDuration_;\n> >>   \n> >> +\t/*\n> >> +\t * According to the RkISP1 documentation:\n> >> +\t * - versions <= V11 have RKISP1_CIF_ISP_AE_MEAN_MAX_V10 entries,\n> > \n> > I would have gone for < V12 here and in the condition below, given that\n> > the macro is named RKISP1_CIF_ISP_AE_MEAN_MAX_V12.\n> > \n> >> +\t * - versions >= V12 have RKISP1_CIF_ISP_AE_MEAN_MAX_V12 entries.\n> >> +\t */\n> >> +\tif (context.configuration.hw.revision <= RKISP1_V11)\n> >> +\t\tnumCells_ = RKISP1_CIF_ISP_AE_MEAN_MAX_V10;\n> >> +\telse\n> >> +\t\tnumCells_ = RKISP1_CIF_ISP_AE_MEAN_MAX_V12;\n> >> +\n> >>   \treturn 0;\n> >>   }\n> >>   \n> >> diff --git a/src/ipa/rkisp1/algorithms/agc.h b/src/ipa/rkisp1/algorithms/agc.h\n> >> index ac95dea5..3ab3f347 100644\n> >> --- a/src/ipa/rkisp1/algorithms/agc.h\n> >> +++ b/src/ipa/rkisp1/algorithms/agc.h\n> >> @@ -45,6 +45,8 @@ private:\n> >>   \tdouble minAnalogueGain_;\n> >>   \tdouble maxAnalogueGain_;\n> >>   \n> >> +\tuint32_t numCells_;\n> >> +\n> >>   \tutils::Duration filteredExposure_;\n> >>   \tutils::Duration currentExposure_;\n> >>   };\n> >> diff --git a/src/ipa/rkisp1/ipa_context.cpp b/src/ipa/rkisp1/ipa_context.cpp\n> >> index 16fc248f..faa002d1 100644\n> >> --- a/src/ipa/rkisp1/ipa_context.cpp\n> >> +++ b/src/ipa/rkisp1/ipa_context.cpp\n> >> @@ -72,6 +72,14 @@ namespace libcamera::ipa::rkisp1 {\n> >>    * \\brief Maximum analogue gain supported with the configured sensor\n> >>    */\n> >>   \n> >> +/**\n> >> + * \\var IPASessionConfiguration::hw\n> >> + * \\brief RkISP1-specific hardware information\n> >> + *\n> >> + * \\var IPASessionConfiguration::hw.revision\n> >> + * \\brief Hardware revision of the ISP (RKISP1_V*)\n> > \n> > I know I've proposed adding (RKISP1_V*), but that was before the enum.\n> > You can drop it now if you prefer.\n> \n> As we don't have its type here, it can help, I suppose, so I will keep \n> it like this if you don't mind :-).\n\nUp to you, but we do have the type, this documents the hw.revision\nfield. Doxygen will show the type in the HTML output.\n\n> > Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> > \n> >> + */\n> >> +\n> >>   /**\n> >>    * \\var IPAFrameContext::agc\n> >>    * \\brief Context for the Automatic Gain Control algorithm\n> >> diff --git a/src/ipa/rkisp1/ipa_context.h b/src/ipa/rkisp1/ipa_context.h\n> >> index 8e756fb1..e526a0d3 100644\n> >> --- a/src/ipa/rkisp1/ipa_context.h\n> >> +++ b/src/ipa/rkisp1/ipa_context.h\n> >> @@ -8,6 +8,8 @@\n> >>   #ifndef __LIBCAMERA_RKISP1_IPA_CONTEXT_H__\n> >>   #define __LIBCAMERA_RKISP1_IPA_CONTEXT_H__\n> >>   \n> >> +#include <linux/rkisp1-config.h>\n> >> +\n> >>   #include <libcamera/base/utils.h>\n> >>   \n> >>   namespace libcamera {\n> >> @@ -21,6 +23,10 @@ struct IPASessionConfiguration {\n> >>   \t\tdouble minAnalogueGain;\n> >>   \t\tdouble maxAnalogueGain;\n> >>   \t} agc;\n> >> +\n> >> +\tstruct {\n> >> +\t\trkisp1_cif_isp_version revision;\n> >> +\t} hw;\n> >>   };\n> >>   \n> >>   struct IPAFrameContext {\n> >> diff --git a/src/ipa/rkisp1/rkisp1.cpp b/src/ipa/rkisp1/rkisp1.cpp\n> >> index 59e868ff..99ccd596 100644\n> >> --- a/src/ipa/rkisp1/rkisp1.cpp\n> >> +++ b/src/ipa/rkisp1/rkisp1.cpp\n> >> @@ -75,7 +75,7 @@ private:\n> >>   \tuint32_t maxGain_;\n> >>   \n> >>   \t/* revision-specific data */\n> >> -\tunsigned int hwAeMeanMax_;\n> >> +\trkisp1_cif_isp_version hwRevision_;\n> >>   \tunsigned int hwHistBinNMax_;\n> >>   \tunsigned int hwGammaOutMaxSamples_;\n> >>   \tunsigned int hwHistogramWeightGridsSize_;\n> >> @@ -97,13 +97,11 @@ int IPARkISP1::init(const IPASettings &settings, unsigned int hwRevision)\n> >>   \t/* \\todo Add support for other revisions */\n> >>   \tswitch (hwRevision) {\n> >>   \tcase RKISP1_V10:\n> >> -\t\thwAeMeanMax_ = RKISP1_CIF_ISP_AE_MEAN_MAX_V10;\n> >>   \t\thwHistBinNMax_ = RKISP1_CIF_ISP_HIST_BIN_N_MAX_V10;\n> >>   \t\thwGammaOutMaxSamples_ = RKISP1_CIF_ISP_GAMMA_OUT_MAX_SAMPLES_V10;\n> >>   \t\thwHistogramWeightGridsSize_ = RKISP1_CIF_ISP_HISTOGRAM_WEIGHT_GRIDS_SIZE_V10;\n> >>   \t\tbreak;\n> >>   \tcase RKISP1_V12:\n> >> -\t\thwAeMeanMax_ = RKISP1_CIF_ISP_AE_MEAN_MAX_V12;\n> >>   \t\thwHistBinNMax_ = RKISP1_CIF_ISP_HIST_BIN_N_MAX_V12;\n> >>   \t\thwGammaOutMaxSamples_ = RKISP1_CIF_ISP_GAMMA_OUT_MAX_SAMPLES_V12;\n> >>   \t\thwHistogramWeightGridsSize_ = RKISP1_CIF_ISP_HISTOGRAM_WEIGHT_GRIDS_SIZE_V12;\n> >> @@ -117,6 +115,9 @@ int IPARkISP1::init(const IPASettings &settings, unsigned int hwRevision)\n> >>   \n> >>   \tLOG(IPARkISP1, Debug) << \"Hardware revision is \" << hwRevision;\n> >>   \n> >> +\t/* Cache the value to set it in configure. */\n> >> +\thwRevision_ = static_cast<rkisp1_cif_isp_version>(hwRevision);\n> >> +\n> >>   \tcamHelper_ = CameraSensorHelperFactory::create(settings.sensorModel);\n> >>   \tif (!camHelper_) {\n> >>   \t\tLOG(IPARkISP1, Error)\n> >> @@ -184,6 +185,9 @@ int IPARkISP1::configure([[maybe_unused]] const IPACameraSensorInfo &info,\n> >>   \t/* Clean context at configuration */\n> >>   \tcontext_ = {};\n> >>   \n> >> +\t/* Set the hardware revision for the algorithms. */\n> >> +\tcontext_.configuration.hw.revision = hwRevision_;\n> >> +\n> >>   \t/*\n> >>   \t * When the AGC computes the new exposure values for a frame, it needs\n> >>   \t * to know the limits for shutter speed and analogue gain.","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 B7459BDB13\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 23 Nov 2021 15:27:57 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 084EC6036F;\n\tTue, 23 Nov 2021 16:27:57 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id A631E60121\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 23 Nov 2021 16:27:54 +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 1F17893;\n\tTue, 23 Nov 2021 16:27:54 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"YCdRAHg9\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1637681274;\n\tbh=TQmNn0mXuXKpgUNyd8c9oJYuP9zSjrx6wRazYhgxw+w=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=YCdRAHg9nRMnnUQHSkJca9BcdUBRHKGq2AAHJ71eYRT+wNhGc+yWbGLc9Inmpdh8C\n\tu0Q4DttGRylxLtqXC8wYOMZ8vMt1diw192Bo92IS5NoQ+/gy/1FXynvxdF0n0eqFsm\n\tnCjuADbhqbDstydkGc+JIAxNl2yxxi+Gkqmc1DVE=","Date":"Tue, 23 Nov 2021 17:27:32 +0200","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>","Message-ID":"<YZ0IZO3MBcEY0hcl@pendragon.ideasonboard.com>","References":"<20211123150423.125524-1-jeanmichel.hautbois@ideasonboard.com>\n\t<20211123150423.125524-12-jeanmichel.hautbois@ideasonboard.com>\n\t<YZ0FFeS6TM4QNf74@pendragon.ideasonboard.com>\n\t<a41511dc-556f-c8a4-b540-e063dfecad17@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<a41511dc-556f-c8a4-b540-e063dfecad17@ideasonboard.com>","Subject":"Re: [libcamera-devel] [PATCH v3 11/11] ipa: rkisp1: agc: Configure\n\tthe number of cells used by HW","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>"}},{"id":21156,"web_url":"https://patchwork.libcamera.org/comment/21156/","msgid":"<163768482040.3059017.12576120081624115239@Monstersaurus>","date":"2021-11-23T16:27:00","subject":"Re: [libcamera-devel] [PATCH v3 11/11] ipa: rkisp1: agc: Configure\n\tthe number of cells used by HW","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"Quoting Laurent Pinchart (2021-11-23 15:27:32)\n> Hi Jean-Michel,\n> \n> On Tue, Nov 23, 2021 at 04:20:41PM +0100, Jean-Michel Hautbois wrote:\n> > On 23/11/2021 16:13, Laurent Pinchart wrote:\n> > > On Tue, Nov 23, 2021 at 04:04:23PM +0100, Jean-Michel Hautbois wrote:\n> > >> The ISP can use 25 or 81 cells depending on its revision. Remove the\n> > >> cached value in IPARkISP1 and use IPASessionConfiguration to store it\n> > >> and pass it to AGC.\n> > >>\n> > >> Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>\n> > >> ---\n> > >> v3: - Use the rkisp1 enum for the HW revision\n> > >>\n> > >> ---\n> > >>   src/ipa/rkisp1/algorithms/agc.cpp | 12 +++++++++++-\n> > >>   src/ipa/rkisp1/algorithms/agc.h   |  2 ++\n> > >>   src/ipa/rkisp1/ipa_context.cpp    |  8 ++++++++\n> > >>   src/ipa/rkisp1/ipa_context.h      |  6 ++++++\n> > >>   src/ipa/rkisp1/rkisp1.cpp         | 10 +++++++---\n> > >>   5 files changed, 34 insertions(+), 4 deletions(-)\n> > >>\n> > >> diff --git a/src/ipa/rkisp1/algorithms/agc.cpp b/src/ipa/rkisp1/algorithms/agc.cpp\n> > >> index 0433813a..16966b16 100644\n> > >> --- a/src/ipa/rkisp1/algorithms/agc.cpp\n> > >> +++ b/src/ipa/rkisp1/algorithms/agc.cpp\n> > >> @@ -61,7 +61,7 @@ Agc::Agc()\n> > >>    * \\param[in] context The shared IPA context\n> > >>    * \\param[in] configInfo The IPA configuration data\n> > >>    *\n> > >> - * \\return 0\n> > >> + * \\return 0 on success or a negative error code otherwise\n> > > \n> > > You can drop this.\n> > > \n> > >>    */\n> > >>   int Agc::configure(IPAContext &context, const IPACameraSensorInfo &configInfo)\n> > >>   {\n> > >> @@ -79,6 +79,16 @@ int Agc::configure(IPAContext &context, const IPACameraSensorInfo &configInfo)\n> > >>    context.frameContext.agc.gain = minAnalogueGain_;\n> > >>    context.frameContext.agc.exposure = 10ms / lineDuration_;\n> > >>   \n> > >> +  /*\n> > >> +   * According to the RkISP1 documentation:\n> > >> +   * - versions <= V11 have RKISP1_CIF_ISP_AE_MEAN_MAX_V10 entries,\n> > > \n> > > I would have gone for < V12 here and in the condition below, given that\n> > > the macro is named RKISP1_CIF_ISP_AE_MEAN_MAX_V12.\n\nSeconded here. It looks odd with the extra version mention.\n\nEither way though, it's correct, and I'm glad we're pushing these\nalgorithm specific configuration details down into the algos.\n\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\n> > > \n> > >> +   * - versions >= V12 have RKISP1_CIF_ISP_AE_MEAN_MAX_V12 entries.\n> > >> +   */\n> > >> +  if (context.configuration.hw.revision <= RKISP1_V11)\n> > >> +          numCells_ = RKISP1_CIF_ISP_AE_MEAN_MAX_V10;\n> > >> +  else\n> > >> +          numCells_ = RKISP1_CIF_ISP_AE_MEAN_MAX_V12;\n> > >> +\n> > >>    return 0;\n> > >>   }\n> > >>   \n> > >> diff --git a/src/ipa/rkisp1/algorithms/agc.h b/src/ipa/rkisp1/algorithms/agc.h\n> > >> index ac95dea5..3ab3f347 100644\n> > >> --- a/src/ipa/rkisp1/algorithms/agc.h\n> > >> +++ b/src/ipa/rkisp1/algorithms/agc.h\n> > >> @@ -45,6 +45,8 @@ private:\n> > >>    double minAnalogueGain_;\n> > >>    double maxAnalogueGain_;\n> > >>   \n> > >> +  uint32_t numCells_;\n> > >> +\n> > >>    utils::Duration filteredExposure_;\n> > >>    utils::Duration currentExposure_;\n> > >>   };\n> > >> diff --git a/src/ipa/rkisp1/ipa_context.cpp b/src/ipa/rkisp1/ipa_context.cpp\n> > >> index 16fc248f..faa002d1 100644\n> > >> --- a/src/ipa/rkisp1/ipa_context.cpp\n> > >> +++ b/src/ipa/rkisp1/ipa_context.cpp\n> > >> @@ -72,6 +72,14 @@ namespace libcamera::ipa::rkisp1 {\n> > >>    * \\brief Maximum analogue gain supported with the configured sensor\n> > >>    */\n> > >>   \n> > >> +/**\n> > >> + * \\var IPASessionConfiguration::hw\n> > >> + * \\brief RkISP1-specific hardware information\n> > >> + *\n> > >> + * \\var IPASessionConfiguration::hw.revision\n> > >> + * \\brief Hardware revision of the ISP (RKISP1_V*)\n> > > \n> > > I know I've proposed adding (RKISP1_V*), but that was before the enum.\n> > > You can drop it now if you prefer.\n> > \n> > As we don't have its type here, it can help, I suppose, so I will keep \n> > it like this if you don't mind :-).\n> \n> Up to you, but we do have the type, this documents the hw.revision\n> field. Doxygen will show the type in the HTML output.\n> \n> > > Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> > > \n> > >> + */\n> > >> +\n> > >>   /**\n> > >>    * \\var IPAFrameContext::agc\n> > >>    * \\brief Context for the Automatic Gain Control algorithm\n> > >> diff --git a/src/ipa/rkisp1/ipa_context.h b/src/ipa/rkisp1/ipa_context.h\n> > >> index 8e756fb1..e526a0d3 100644\n> > >> --- a/src/ipa/rkisp1/ipa_context.h\n> > >> +++ b/src/ipa/rkisp1/ipa_context.h\n> > >> @@ -8,6 +8,8 @@\n> > >>   #ifndef __LIBCAMERA_RKISP1_IPA_CONTEXT_H__\n> > >>   #define __LIBCAMERA_RKISP1_IPA_CONTEXT_H__\n> > >>   \n> > >> +#include <linux/rkisp1-config.h>\n> > >> +\n> > >>   #include <libcamera/base/utils.h>\n> > >>   \n> > >>   namespace libcamera {\n> > >> @@ -21,6 +23,10 @@ struct IPASessionConfiguration {\n> > >>            double minAnalogueGain;\n> > >>            double maxAnalogueGain;\n> > >>    } agc;\n> > >> +\n> > >> +  struct {\n> > >> +          rkisp1_cif_isp_version revision;\n> > >> +  } hw;\n> > >>   };\n> > >>   \n> > >>   struct IPAFrameContext {\n> > >> diff --git a/src/ipa/rkisp1/rkisp1.cpp b/src/ipa/rkisp1/rkisp1.cpp\n> > >> index 59e868ff..99ccd596 100644\n> > >> --- a/src/ipa/rkisp1/rkisp1.cpp\n> > >> +++ b/src/ipa/rkisp1/rkisp1.cpp\n> > >> @@ -75,7 +75,7 @@ private:\n> > >>    uint32_t maxGain_;\n> > >>   \n> > >>    /* revision-specific data */\n> > >> -  unsigned int hwAeMeanMax_;\n> > >> +  rkisp1_cif_isp_version hwRevision_;\n> > >>    unsigned int hwHistBinNMax_;\n> > >>    unsigned int hwGammaOutMaxSamples_;\n> > >>    unsigned int hwHistogramWeightGridsSize_;\n> > >> @@ -97,13 +97,11 @@ int IPARkISP1::init(const IPASettings &settings, unsigned int hwRevision)\n> > >>    /* \\todo Add support for other revisions */\n> > >>    switch (hwRevision) {\n> > >>    case RKISP1_V10:\n> > >> -          hwAeMeanMax_ = RKISP1_CIF_ISP_AE_MEAN_MAX_V10;\n> > >>            hwHistBinNMax_ = RKISP1_CIF_ISP_HIST_BIN_N_MAX_V10;\n> > >>            hwGammaOutMaxSamples_ = RKISP1_CIF_ISP_GAMMA_OUT_MAX_SAMPLES_V10;\n> > >>            hwHistogramWeightGridsSize_ = RKISP1_CIF_ISP_HISTOGRAM_WEIGHT_GRIDS_SIZE_V10;\n> > >>            break;\n> > >>    case RKISP1_V12:\n> > >> -          hwAeMeanMax_ = RKISP1_CIF_ISP_AE_MEAN_MAX_V12;\n> > >>            hwHistBinNMax_ = RKISP1_CIF_ISP_HIST_BIN_N_MAX_V12;\n> > >>            hwGammaOutMaxSamples_ = RKISP1_CIF_ISP_GAMMA_OUT_MAX_SAMPLES_V12;\n> > >>            hwHistogramWeightGridsSize_ = RKISP1_CIF_ISP_HISTOGRAM_WEIGHT_GRIDS_SIZE_V12;\n> > >> @@ -117,6 +115,9 @@ int IPARkISP1::init(const IPASettings &settings, unsigned int hwRevision)\n> > >>   \n> > >>    LOG(IPARkISP1, Debug) << \"Hardware revision is \" << hwRevision;\n> > >>   \n> > >> +  /* Cache the value to set it in configure. */\n> > >> +  hwRevision_ = static_cast<rkisp1_cif_isp_version>(hwRevision);\n> > >> +\n> > >>    camHelper_ = CameraSensorHelperFactory::create(settings.sensorModel);\n> > >>    if (!camHelper_) {\n> > >>            LOG(IPARkISP1, Error)\n> > >> @@ -184,6 +185,9 @@ int IPARkISP1::configure([[maybe_unused]] const IPACameraSensorInfo &info,\n> > >>    /* Clean context at configuration */\n> > >>    context_ = {};\n> > >>   \n> > >> +  /* Set the hardware revision for the algorithms. */\n> > >> +  context_.configuration.hw.revision = hwRevision_;\n> > >> +\n> > >>    /*\n> > >>     * When the AGC computes the new exposure values for a frame, it needs\n> > >>     * to know the limits for shutter speed and analogue gain.\n> \n> -- \n> Regards,\n> \n> Laurent Pinchart","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 132A9BF415\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 23 Nov 2021 16:27:05 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 460D860230;\n\tTue, 23 Nov 2021 17:27:04 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id A19E660121\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 23 Nov 2021 17:27:02 +0100 (CET)","from pendragon.ideasonboard.com\n\t(cpc89244-aztw30-2-0-cust3082.18-1.cable.virginm.net [86.31.172.11])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 3F602A1B;\n\tTue, 23 Nov 2021 17:27:02 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"OfFKmgNm\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1637684822;\n\tbh=3IsUqdn8Zfx22RO1ukk6tUA+4fJzNhNBDo68wkXCS4c=;\n\th=In-Reply-To:References:Subject:From:Cc:To:Date:From;\n\tb=OfFKmgNm5XPvTAs+S0jBrbZ8GuHo1Djqn+90kQ0WQxIlqFwD4On5P21DlfgPkqLMF\n\tU7sPEH+Vs6pDXH5KVKHKhXUW16qn1LhAcifkahtL42HnCCJEog65Hz3a5Fy7BuxiiG\n\ts3Xo5PF/NVl6JTbruu4nGxcmYbQMwqGGiybGVUgQ=","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<YZ0IZO3MBcEY0hcl@pendragon.ideasonboard.com>","References":"<20211123150423.125524-1-jeanmichel.hautbois@ideasonboard.com>\n\t<20211123150423.125524-12-jeanmichel.hautbois@ideasonboard.com>\n\t<YZ0FFeS6TM4QNf74@pendragon.ideasonboard.com>\n\t<a41511dc-556f-c8a4-b540-e063dfecad17@ideasonboard.com>\n\t<YZ0IZO3MBcEY0hcl@pendragon.ideasonboard.com>","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","To":"Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>,\n\tLaurent Pinchart <laurent.pinchart@ideasonboard.com>","Date":"Tue, 23 Nov 2021 16:27:00 +0000","Message-ID":"<163768482040.3059017.12576120081624115239@Monstersaurus>","User-Agent":"alot/0.10","Subject":"Re: [libcamera-devel] [PATCH v3 11/11] ipa: rkisp1: agc: Configure\n\tthe number of cells used by HW","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>"}}]