Show a patch.

GET /api/patches/14724/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 14724,
    "url": "https://patchwork.libcamera.org/api/patches/14724/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/14724/",
    "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": "<20211123150423.125524-12-jeanmichel.hautbois@ideasonboard.com>",
    "date": "2021-11-23T15:04:23",
    "name": "[libcamera-devel,v3,11/11] ipa: rkisp1: agc: Configure the number of cells used by HW",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "07eab7a9e9b9e0df72c53bf0592f29f15e1e41aa",
    "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/14724/mbox/",
    "series": [
        {
            "id": 2746,
            "url": "https://patchwork.libcamera.org/api/series/2746/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=2746",
            "date": "2021-11-23T15:04:12",
            "name": "Introduce AGC for RkISP1",
            "version": 3,
            "mbox": "https://patchwork.libcamera.org/series/2746/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/14724/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/14724/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 8EA0FC3250\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 23 Nov 2021 15:04:43 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 3B2A86048E;\n\tTue, 23 Nov 2021 16:04:43 +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 CAF55603BE\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 23 Nov 2021 16:04:29 +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 905F7993;\n\tTue, 23 Nov 2021 16:04:29 +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=\"XwC19jWC\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1637679869;\n\tbh=EDLV191SXoMZhbH/vUYEizKVGiT+5OxmrFvAKXWOJSo=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=XwC19jWCwb2o8KyCa2lYDDZg7BZ6+n80rwV6Pk9o1B50dzBh0XSzHPLbasbwbNDpM\n\t4ZWiIxpOsNBEzBfuCFcrC5LAMA2JnoV6NBcmRC5UuZ0yl89nhBz9vjznzVS3ZtDmBi\n\ta+JkOlIHnWbr77FcYWH31b8nVWHzLA3zNUC5h16k=",
        "From": "Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Tue, 23 Nov 2021 16:04:23 +0100",
        "Message-Id": "<20211123150423.125524-12-jeanmichel.hautbois@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.32.0",
        "In-Reply-To": "<20211123150423.125524-1-jeanmichel.hautbois@ideasonboard.com>",
        "References": "<20211123150423.125524-1-jeanmichel.hautbois@ideasonboard.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH v3 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---\nv3: - 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(-)",
    "diff": "diff --git a/src/ipa/rkisp1/algorithms/agc.cpp b/src/ipa/rkisp1/algorithms/agc.cpp\nindex 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 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+\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 \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..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+\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..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 {\ndiff --git a/src/ipa/rkisp1/rkisp1.cpp b/src/ipa/rkisp1/rkisp1.cpp\nindex 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",
    "prefixes": [
        "libcamera-devel",
        "v3",
        "11/11"
    ]
}