Patch Detail
Show a patch.
GET /api/patches/14695/?format=api
{ "id": 14695, "url": "https://patchwork.libcamera.org/api/patches/14695/?format=api", "web_url": "https://patchwork.libcamera.org/patch/14695/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/projects/1/?format=api", "name": "libcamera", "link_name": "libcamera", "list_id": "libcamera_core", "list_email": "libcamera-devel@lists.libcamera.org", "web_url": "", "scm_url": "", "webscm_url": "" }, "msgid": "<20211123091451.67404-12-jeanmichel.hautbois@ideasonboard.com>", "date": "2021-11-23T09:14:51", "name": "[libcamera-devel,v2,11/11] ipa: rkisp1: agc: Configure the number of cells used by HW", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "2b8abc0de3a5a7292a2cb39a1ba1d8c8f8b25749", "submitter": { "id": 75, "url": "https://patchwork.libcamera.org/api/people/75/?format=api", "name": "Jean-Michel Hautbois", "email": "jeanmichel.hautbois@ideasonboard.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/14695/mbox/", "series": [ { "id": 2741, "url": "https://patchwork.libcamera.org/api/series/2741/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=2741", "date": "2021-11-23T09:14:40", "name": "Introduce AGC for RkISP1", "version": 2, "mbox": "https://patchwork.libcamera.org/series/2741/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/14695/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/14695/checks/", "tags": {}, "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 ECAD4C3252\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 23 Nov 2021 09:15:12 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 37B47604F9;\n\tTue, 23 Nov 2021 10:15:12 +0100 (CET)", "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 03A4A6033C\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 23 Nov 2021 10:14:59 +0100 (CET)", "from tatooine.ideasonboard.com (unknown\n\t[IPv6:2a01:e0a:169:7140:3c3b:9149:b:8aa9])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id A1A07A1B;\n\tTue, 23 Nov 2021 10:14:58 +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=\"XHmjOcT8\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1637658898;\n\tbh=z+WpoiU7f87GQk8JuHzkZYHoyFljaFQAVxkZNfwQDGo=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=XHmjOcT8A0NlaG8Gy75WccK2n/GyPApfZ6W5B5o9aC9lU9vC4v9xLdRuUMscgWEBt\n\tggdIq5MU4qZsPJi/06qaSlaZhAtoeiv8CnnHCal98LmGYxsgy9Br8Fw3SIX7REtP/L\n\tWe1drFJVRHGvg7egnRLVaZlXo9GlX7z/JGV/2N3o=", "From": "Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Tue, 23 Nov 2021 10:14:51 +0100", "Message-Id": "<20211123091451.67404-12-jeanmichel.hautbois@ideasonboard.com>", "X-Mailer": "git-send-email 2.32.0", "In-Reply-To": "<20211123091451.67404-1-jeanmichel.hautbois@ideasonboard.com>", "References": "<20211123091451.67404-1-jeanmichel.hautbois@ideasonboard.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH v2 11/11] ipa: rkisp1: agc: Configure the\n\tnumber 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>", "Errors-To": "libcamera-devel-bounces@lists.libcamera.org", "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>" }, "content": "The ISP can use 25 or 81 cells depending on its revision. Remove the\ncached value in IPARkISP1 and use IPASessionConfiguration to store it\nand pass it to AGC.\n\nSigned-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>\n---\n src/ipa/rkisp1/algorithms/agc.cpp | 16 +++++++++++++++-\n src/ipa/rkisp1/algorithms/agc.h | 2 ++\n src/ipa/rkisp1/ipa_context.cpp | 8 ++++++++\n src/ipa/rkisp1/ipa_context.h | 4 ++++\n src/ipa/rkisp1/rkisp1.cpp | 10 +++++++---\n 5 files changed, 36 insertions(+), 4 deletions(-)", "diff": "diff --git a/src/ipa/rkisp1/algorithms/agc.cpp b/src/ipa/rkisp1/algorithms/agc.cpp\nindex 0433813a..e5358ca3 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 int Agc::configure(IPAContext &context, const IPACameraSensorInfo &configInfo)\n {\n@@ -79,6 +79,20 @@ int Agc::configure(IPAContext &context, const IPACameraSensorInfo &configInfo)\n \tcontext.frameContext.agc.gain = minAnalogueGain_;\n \tcontext.frameContext.agc.exposure = 10ms / lineDuration_;\n \n+\tswitch (context.configuration.hw.revision) {\n+\tcase RKISP1_V10:\n+\t\tnumCells_ = RKISP1_CIF_ISP_AE_MEAN_MAX_V10;\n+\t\tbreak;\n+\tcase RKISP1_V12:\n+\t\tnumCells_ = RKISP1_CIF_ISP_AE_MEAN_MAX_V12;\n+\t\tbreak;\n+\tdefault:\n+\t\tLOG(RkISP1Agc, Error)\n+\t\t\t<< \"Hardware revision \" << context.configuration.hw.revision\n+\t\t\t<< \" is currently not supported\";\n+\t\treturn -ENODEV;\n+\t}\n+\n \treturn 0;\n }\n \ndiff --git a/src/ipa/rkisp1/algorithms/agc.h b/src/ipa/rkisp1/algorithms/agc.h\nindex 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 };\ndiff --git a/src/ipa/rkisp1/ipa_context.cpp b/src/ipa/rkisp1/ipa_context.cpp\nindex 16fc248f..cdb952be 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 RkISP1 revision reported\n+ */\n+\n /**\n * \\var IPAFrameContext::agc\n * \\brief Context for the Automatic Gain Control algorithm\ndiff --git a/src/ipa/rkisp1/ipa_context.h b/src/ipa/rkisp1/ipa_context.h\nindex 8e756fb1..316036c6 100644\n--- a/src/ipa/rkisp1/ipa_context.h\n+++ b/src/ipa/rkisp1/ipa_context.h\n@@ -21,6 +21,10 @@ struct IPASessionConfiguration {\n \t\tdouble minAnalogueGain;\n \t\tdouble maxAnalogueGain;\n \t} agc;\n+\n+\tstruct {\n+\t\tuint32_t revision;\n+\t} hw;\n };\n \n struct IPAFrameContext {\ndiff --git a/src/ipa/rkisp1/rkisp1.cpp b/src/ipa/rkisp1/rkisp1.cpp\nindex 59e868ff..a472d111 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+\tunsigned int 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_ = 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", "prefixes": [ "libcamera-devel", "v2", "11/11" ] }