Show a patch.

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

{
    "id": 25557,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/25557/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/25557/",
    "project": {
        "id": 1,
        "url": "https://patchwork.libcamera.org/api/1.1/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": "<20251215115348.626656-1-barnabas.pocze@ideasonboard.com>",
    "date": "2025-12-15T11:53:48",
    "name": "[RFC,v1] ipa: rkisp1: Allow algorithms to update `ControlInfoMap`",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "cc6aeee30194529c92409d5708ba3bbd161efccf",
    "submitter": {
        "id": 216,
        "url": "https://patchwork.libcamera.org/api/1.1/people/216/?format=api",
        "name": "Barnabás Pőcze",
        "email": "barnabas.pocze@ideasonboard.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/25557/mbox/",
    "series": [
        {
            "id": 5663,
            "url": "https://patchwork.libcamera.org/api/1.1/series/5663/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=5663",
            "date": "2025-12-15T11:53:48",
            "name": "[RFC,v1] ipa: rkisp1: Allow algorithms to update `ControlInfoMap`",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/5663/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/25557/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/25557/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 74CB6BD7D8\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 15 Dec 2025 11:53:53 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 660DC61977;\n\tMon, 15 Dec 2025 12:53:52 +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 23A88615B2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 15 Dec 2025 12:53:51 +0100 (CET)",
            "from pb-laptop.local (185.221.143.114.nat.pool.zt.hu\n\t[185.221.143.114])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 3B788C66;\n\tMon, 15 Dec 2025 12:53:46 +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=\"eJgLh7+S\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1765799626;\n\tbh=0lZdM3DiN6UbBXCCZ/LjCk3cp+WkrMO96zn8DujjapE=;\n\th=From:To:Subject:Date:From;\n\tb=eJgLh7+S2LZa3BIKden2X9n1BVc1pte9Aoqy34USVSrGTa7CmmGRXUnZID8Zzcx5h\n\tKa7Om6pc7xwBtm0h+qveLcPFZ/dll/7a70KcQaQn1elqaVpOUdO852ZFzpK3ls0Ku3\n\tNCjaswFZ6vZDN6r3UAzH4JD6mGD3IkU2AHOuwEKI=",
        "From": "=?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= <barnabas.pocze@ideasonboard.com>",
        "To": "libcamera-devel@lists.libcamera.org,\n\tStefan Klug <stefan.klug@ideasonboard.com>",
        "Subject": "[RFC PATCH v1] ipa: rkisp1: Allow algorithms to update\n\t`ControlInfoMap`",
        "Date": "Mon, 15 Dec 2025 12:53:48 +0100",
        "Message-ID": "<20251215115348.626656-1-barnabas.pocze@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.52.0",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=UTF-8",
        "Content-Transfer-Encoding": "8bit",
        "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": "In `IPARkISP1::init()`, the `ControlInfoMap` that will be returned\nto the pipeline handler is updated after creating the algorithms;\nnaturally, since otherwise no algorithm could register its own controls.\n\nHowever, in `IPARkISP1::configure()`, the update is done before the\nalgorithms are configured. This is not ideal because this prevents\nalgorithms from correctly updating e.g. the `ControlInfo`s of their\ncontrols.\n\nWhile no algorithm is affected today, during development, it is useful\nfor various debug related controls, whose ranges depend on the exact\nconfiguration.\n\nHowever, `updateControls()` cannot simply be moved to be after the loop\nbecause it updates the limits of `FrameDurationLimits`, which `Agc::configure()`\nneeds to access. Moving it after the loop would lead to stale data\nbeing used.\n\nSo move the updating of `ipaControls` out of `updateControls()`.\n\nSigned-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>\n---\n src/ipa/rkisp1/rkisp1.cpp | 29 +++++++++++++++++------------\n 1 file changed, 17 insertions(+), 12 deletions(-)",
    "diff": "diff --git a/src/ipa/rkisp1/rkisp1.cpp b/src/ipa/rkisp1/rkisp1.cpp\nindex 61d3d1f6f..6c9ff306d 100644\n--- a/src/ipa/rkisp1/rkisp1.cpp\n+++ b/src/ipa/rkisp1/rkisp1.cpp\n@@ -76,7 +76,7 @@ protected:\n private:\n \tvoid updateControls(const IPACameraSensorInfo &sensorInfo,\n \t\t\t    const ControlInfoMap &sensorControls,\n-\t\t\t    ControlInfoMap *ipaControls);\n+\t\t\t    ControlInfoMap::Map &ctrlMap);\n \tvoid setControls(unsigned int frame);\n \n \tstd::map<unsigned int, FrameBuffer> buffers_;\n@@ -202,12 +202,17 @@ int IPARkISP1::init(const IPASettings &settings, unsigned int hwRevision,\n \t\treturn -EINVAL;\n \t}\n \n+\tControlInfoMap::Map ctrlMap = rkisp1Controls;\n+\n+\t/* Initialize controls. */\n+\tupdateControls(sensorInfo, sensorControls, ctrlMap);\n+\n \tint ret = createAlgorithms(context_, (*data)[\"algorithms\"]);\n \tif (ret)\n \t\treturn ret;\n \n-\t/* Initialize controls. */\n-\tupdateControls(sensorInfo, sensorControls, ipaControls);\n+\tctrlMap.insert(context_.ctrlMap.begin(), context_.ctrlMap.end());\n+\t*ipaControls = ControlInfoMap(std::move(ctrlMap), controls::controls);\n \n \treturn 0;\n }\n@@ -254,9 +259,6 @@ int IPARkISP1::configure(const IPAConfigInfo &ipaConfig,\n \tcontext_.configuration.sensor.size = info.outputSize;\n \tcontext_.configuration.sensor.lineDuration = info.minLineLength * 1.0s / info.pixelRate;\n \n-\t/* Update the camera controls using the new sensor settings. */\n-\tupdateControls(info, sensorControls_, ipaControls);\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 exposure time and analogue gain. As it depends\n@@ -280,6 +282,11 @@ int IPARkISP1::configure(const IPAConfigInfo &ipaConfig,\n \t\t\treturn format.colourEncoding == PixelFormatInfo::ColourEncodingRAW;\n \t\t});\n \n+\tControlInfoMap::Map ctrlMap = rkisp1Controls;\n+\n+\t/* Update the camera controls using the new sensor settings. */\n+\tupdateControls(info, sensorControls_, ctrlMap);\n+\n \tfor (auto const &a : algorithms()) {\n \t\tAlgorithm *algo = static_cast<Algorithm *>(a.get());\n \n@@ -293,6 +300,9 @@ int IPARkISP1::configure(const IPAConfigInfo &ipaConfig,\n \t\t\treturn ret;\n \t}\n \n+\tctrlMap.insert(context_.ctrlMap.begin(), context_.ctrlMap.end());\n+\t*ipaControls = ControlInfoMap(std::move(ctrlMap), controls::controls);\n+\n \treturn 0;\n }\n \n@@ -388,10 +398,8 @@ void IPARkISP1::processStats(const uint32_t frame, const uint32_t bufferId,\n \n void IPARkISP1::updateControls(const IPACameraSensorInfo &sensorInfo,\n \t\t\t       const ControlInfoMap &sensorControls,\n-\t\t\t       ControlInfoMap *ipaControls)\n+\t\t\t       ControlInfoMap::Map &ctrlMap)\n {\n-\tControlInfoMap::Map ctrlMap = rkisp1Controls;\n-\n \t/*\n \t * Compute exposure time limits from the V4L2_CID_EXPOSURE control\n \t * limits and the line duration.\n@@ -441,9 +449,6 @@ void IPARkISP1::updateControls(const IPACameraSensorInfo &sensorInfo,\n \tcontext_.ctrlMap[&controls::FrameDurationLimits] =\n \t\tControlInfo(frameDurations[0], frameDurations[1],\n \t\t\t    ControlValue(Span<const int64_t, 2>{ { frameDurations[2], frameDurations[2] } }));\n-\n-\tctrlMap.insert(context_.ctrlMap.begin(), context_.ctrlMap.end());\n-\t*ipaControls = ControlInfoMap(std::move(ctrlMap), controls::controls);\n }\n \n void IPARkISP1::setControls(unsigned int frame)\n",
    "prefixes": [
        "RFC",
        "v1"
    ]
}