Show a patch.

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

{
    "id": 26351,
    "url": "https://patchwork.libcamera.org/api/patches/26351/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/26351/",
    "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": "<20260325151416.2114564-10-stefan.klug@ideasonboard.com>",
    "date": "2026-03-25T15:13:41",
    "name": "[v2,09/32] ipa: rkisp1: Refactor setControls()",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "e18fb6d64a634c64f6376f9512cb3ed1a902f820",
    "submitter": {
        "id": 184,
        "url": "https://patchwork.libcamera.org/api/people/184/?format=api",
        "name": "Stefan Klug",
        "email": "stefan.klug@ideasonboard.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/26351/mbox/",
    "series": [
        {
            "id": 5849,
            "url": "https://patchwork.libcamera.org/api/series/5849/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=5849",
            "date": "2026-03-25T15:13:32",
            "name": "rkisp1: pipeline rework for PFC",
            "version": 2,
            "mbox": "https://patchwork.libcamera.org/series/5849/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/26351/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/26351/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 4C8C0C32FA\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 25 Mar 2026 15:15:09 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 6DDA662857;\n\tWed, 25 Mar 2026 16:15:08 +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 1AE426284A\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 25 Mar 2026 16:15:07 +0100 (CET)",
            "from ideasonboard.com (unknown\n\t[IPv6:2a00:6020:448c:6c00:b16a:5ed9:4ada:a95a])\n\tby perceval.ideasonboard.com (Postfix) with UTF8SMTPSA id 1E9EA121A; \n\tWed, 25 Mar 2026 16:13:49 +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=\"DdHp5oLZ\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1774451629;\n\tbh=XT8qlJr/aApRTAQ0hbgKO428Qjo9spEdkl6DAVtevbA=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=DdHp5oLZ4GXYDk+UfK9+SyrzIFS/0KoUErwj54+2e0WS4oKgyVhABqcMmvsgdbNvf\n\tu5yPpPAMlKckoyKJEgVxohRcut1f4Hi8tvLgwICmmCG4M8Jc95dQM/CDQJl3R3A62Y\n\tD1ftGzcXsxijg0cf2dVsN4Pflv7xJzEdkKXhFbhk=",
        "From": "Stefan Klug <stefan.klug@ideasonboard.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Cc": "Stefan Klug <stefan.klug@ideasonboard.com>,\n\tPaul Elder <paul.elder@ideasonboard.com>",
        "Subject": "[PATCH v2 09/32] ipa: rkisp1: Refactor setControls()",
        "Date": "Wed, 25 Mar 2026 16:13:41 +0100",
        "Message-ID": "<20260325151416.2114564-10-stefan.klug@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.51.0",
        "In-Reply-To": "<20260325151416.2114564-1-stefan.klug@ideasonboard.com>",
        "References": "<20260325151416.2114564-1-stefan.klug@ideasonboard.com>",
        "MIME-Version": "1.0",
        "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": "IPARkISP1::setControls() is called when new sensor controls shall be\nqueued to the pipeline handler. It constructs a list of sensor controls\nand then emits the setSensorControls signal.\n\nTo be able to return initial sensor controls from the IPARkISP1::start()\nfunction, similar functionality will be needed. Prepare for that by\nchanging the setControls() function to a getSensorControls() that is\npassed a frame context and by moving the setSensorControls.emit() out of\nthe function.\n\nSigned-off-by: Stefan Klug <stefan.klug@ideasonboard.com>\nReviewed-by: Paul Elder <paul.elder@ideasonboard.com>\n\n---\n\nChanges in v2:\n- Collected tag\n---\n src/ipa/libipa/fc_queue.cpp |  6 ++++++\n src/ipa/libipa/fc_queue.h   |  2 ++\n src/ipa/rkisp1/rkisp1.cpp   | 26 +++++++++++++-------------\n 3 files changed, 21 insertions(+), 13 deletions(-)",
    "diff": "diff --git a/src/ipa/libipa/fc_queue.cpp b/src/ipa/libipa/fc_queue.cpp\nindex 39222c2ed204..7ba28ed21611 100644\n--- a/src/ipa/libipa/fc_queue.cpp\n+++ b/src/ipa/libipa/fc_queue.cpp\n@@ -38,6 +38,12 @@ namespace ipa {\n  * \\brief The frame number\n  */\n \n+/**\n+ * \\fn FrameContext::frame()\n+ * \\brief Get the frame of that frame context\n+ * \\return THe frame number\n+ */\n+\n /**\n  * \\class FCQueue\n  * \\brief A support class for managing FrameContext instances in IPA modules\ndiff --git a/src/ipa/libipa/fc_queue.h b/src/ipa/libipa/fc_queue.h\nindex 1128e42f8ca6..812022c496ed 100644\n--- a/src/ipa/libipa/fc_queue.h\n+++ b/src/ipa/libipa/fc_queue.h\n@@ -22,6 +22,8 @@ template<typename FrameContext>\n class FCQueue;\n \n struct FrameContext {\n+\tuint32_t frame() const { return frame_; }\n+\n private:\n \ttemplate<typename T> friend class FCQueue;\n \tuint32_t frame_;\ndiff --git a/src/ipa/rkisp1/rkisp1.cpp b/src/ipa/rkisp1/rkisp1.cpp\nindex 373a343bddd0..991843e29a5d 100644\n--- a/src/ipa/rkisp1/rkisp1.cpp\n+++ b/src/ipa/rkisp1/rkisp1.cpp\n@@ -77,7 +77,7 @@ private:\n \tvoid updateControls(const IPACameraSensorInfo &sensorInfo,\n \t\t\t    const ControlInfoMap &sensorControls,\n \t\t\t    ControlInfoMap *ipaControls);\n-\tvoid setControls(unsigned int frame);\n+\tControlList getSensorControls(const IPAFrameContext &context);\n \n \tstd::map<unsigned int, FrameBuffer> buffers_;\n \tstd::map<unsigned int, MappedFrameBuffer> mappedBuffers_;\n@@ -380,7 +380,12 @@ void IPARkISP1::processStats(const uint32_t frame, const uint32_t bufferId,\n \t\talgo->process(context_, frame, frameContext, stats, metadata);\n \t}\n \n-\tsetControls(frame);\n+\t/*\n+\t * \\todo: Here we should do a lookahead that takes the sensor delays\n+\t * into account.\n+\t */\n+\tControlList ctrls = getSensorControls(frameContext);\n+\tsetSensorControls.emit(frame, ctrls);\n \n \tcontext_.debugMetadata.moveEntries(metadata);\n \tmetadataReady.emit(frame, metadata);\n@@ -446,28 +451,23 @@ void IPARkISP1::updateControls(const IPACameraSensorInfo &sensorInfo,\n \t*ipaControls = ControlInfoMap(std::move(ctrlMap), controls::controls);\n }\n \n-void IPARkISP1::setControls(unsigned int frame)\n+ControlList IPARkISP1::getSensorControls(const IPAFrameContext &frameContext)\n {\n-\t/*\n-\t * \\todo The frame number is most likely wrong here, we need to take\n-\t * internal sensor delays and other timing parameters into account.\n-\t */\n-\n-\tIPAFrameContext &frameContext = context_.frameContexts.get(frame);\n \tuint32_t exposure = frameContext.agc.exposure;\n \tuint32_t gain = context_.camHelper->gainCode(frameContext.agc.gain);\n \tuint32_t vblank = frameContext.agc.vblank;\n \n \tLOG(IPARkISP1, Debug)\n-\t\t<< \"Set controls for frame \" << frame << \": exposure \" << exposure\n-\t\t<< \", gain \" << frameContext.agc.gain << \", vblank \" << vblank;\n+\t\t<< \"Set controls for frame \" << frameContext.frame()\n+\t\t<< \": exposure \" << exposure\n+\t\t<< \", gain \" << frameContext.agc.gain\n+\t\t<< \", vblank \" << vblank;\n \n \tControlList ctrls(sensorControls_);\n \tctrls.set(V4L2_CID_EXPOSURE, static_cast<int32_t>(exposure));\n \tctrls.set(V4L2_CID_ANALOGUE_GAIN, static_cast<int32_t>(gain));\n \tctrls.set(V4L2_CID_VBLANK, static_cast<int32_t>(vblank));\n-\n-\tsetSensorControls.emit(frame, ctrls);\n+\treturn ctrls;\n }\n \n } /* namespace ipa::rkisp1 */\n",
    "prefixes": [
        "v2",
        "09/32"
    ]
}