Show a patch.

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

{
    "id": 24775,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/24775/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/24775/",
    "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": "<20251024085130.995967-10-stefan.klug@ideasonboard.com>",
    "date": "2025-10-24T08:50:33",
    "name": "[v1,09/35] ipa: rkisp1: Refactor setControls()",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "e18fb6d64a634c64f6376f9512cb3ed1a902f820",
    "submitter": {
        "id": 184,
        "url": "https://patchwork.libcamera.org/api/1.1/people/184/?format=api",
        "name": "Stefan Klug",
        "email": "stefan.klug@ideasonboard.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/24775/mbox/",
    "series": [
        {
            "id": 5524,
            "url": "https://patchwork.libcamera.org/api/1.1/series/5524/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=5524",
            "date": "2025-10-24T08:50:24",
            "name": "rkisp1: pipeline rework for PFC",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/5524/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/24775/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/24775/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 3B79CC3259\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 24 Oct 2025 08:52:05 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id EFB67608B9;\n\tFri, 24 Oct 2025 10:52:04 +0200 (CEST)",
            "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 111ED60871\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 24 Oct 2025 10:52:03 +0200 (CEST)",
            "from ideasonboard.com (unknown\n\t[IPv6:2a00:6020:448c:6c00:7edc:62f4:c118:1549])\n\tby perceval.ideasonboard.com (Postfix) with UTF8SMTPSA id 976301E46; \n\tFri, 24 Oct 2025 10:50:17 +0200 (CEST)"
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"ub5/9RvQ\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1761295817;\n\tbh=CVtYgOrNanjQAMna1FHGWmAogELBf/83t7UY6wCUy3s=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=ub5/9RvQCno1g8+SBAjPLTJjHQRkSbW2oPeZsMw4RYIHQMKcGIVBi0B2fzTIP+KLO\n\tLK7PB5ldjt18VAjQOJzuo7vJrHXZjwFm+xfZl2pUdvxti4G2Up6w3IkA4ZlOlr63db\n\tN8gJud3LGUFbam1nrtZzN1i90AJ8sdGvtA5JCJAM=",
        "From": "Stefan Klug <stefan.klug@ideasonboard.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Cc": "Stefan Klug <stefan.klug@ideasonboard.com>",
        "Subject": "[PATCH v1 09/35] ipa: rkisp1: Refactor setControls()",
        "Date": "Fri, 24 Oct 2025 10:50:33 +0200",
        "Message-ID": "<20251024085130.995967-10-stefan.klug@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.48.1",
        "In-Reply-To": "<20251024085130.995967-1-stefan.klug@ideasonboard.com>",
        "References": "<20251024085130.995967-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>\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 fa22bfc34904..d64c72ecaf4f 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@@ -445,28 +450,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": [
        "v1",
        "09/35"
    ]
}