Show a patch.

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

{
    "id": 19750,
    "url": "https://patchwork.libcamera.org/api/patches/19750/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/19750/",
    "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": "<20240319120517.362082-11-stefan.klug@ideasonboard.com>",
    "date": "2024-03-19T12:05:11",
    "name": "[v3,10/16] libcamera: delayed_controls: Add fillValues() helper",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "98fa3e1bc313ecbfc520826d90e05525ca60fc12",
    "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/19750/mbox/",
    "series": [
        {
            "id": 4230,
            "url": "https://patchwork.libcamera.org/api/series/4230/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=4230",
            "date": "2024-03-19T12:05:01",
            "name": "Preparation for per-frame-controls and initial tests",
            "version": 3,
            "mbox": "https://patchwork.libcamera.org/series/4230/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/19750/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/19750/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 347C2C32C7\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 19 Mar 2024 12:05:44 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 6775D62D32;\n\tTue, 19 Mar 2024 13:05:42 +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 F41E962CA8\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 19 Mar 2024 13:05:29 +0100 (CET)",
            "from jasper.fritz.box (unknown\n\t[IPv6:2a00:6020:448c:6c00:1478:344b:8fcb:baf5])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 48304F02;\n\tTue, 19 Mar 2024 13:05:03 +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=\"wde0jtBV\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1710849903;\n\tbh=7jyWwJWbWc+w2r/bxH6jSapXRfGGacSKdC6GGq/QzNo=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=wde0jtBVq+Nk423Satk+gDeFhMWrWivGARUt6ViPJXFt3XomtUnpQt3TmOX/ZxPJQ\n\tqoaqkD7oCEh9146qoKs+Ls79agPhIwkMa8ipaU41POJciyfl+faEBt1Cu+VgZYTJmQ\n\tjCnBLeA1hf0Qk2pISDRKD2WoC0ccs3saQSTRAL0Q=",
        "From": "Stefan Klug <stefan.klug@ideasonboard.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Cc": "Stefan Klug <stefan.klug@ideasonboard.com>",
        "Subject": "[PATCH v3 10/16] libcamera: delayed_controls: Add fillValues()\n\thelper",
        "Date": "Tue, 19 Mar 2024 13:05:11 +0100",
        "Message-Id": "<20240319120517.362082-11-stefan.klug@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.40.1",
        "In-Reply-To": "<20240319120517.362082-1-stefan.klug@ideasonboard.com>",
        "References": "<20240319120517.362082-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": "In the upcoming patches the function to initialize the value in the\nringbuffer is needed at multiple places. So it makes sense to factor it\nout.\n\nSigned-off-by: Stefan Klug <stefan.klug@ideasonboard.com>\n---\n include/libcamera/internal/delayed_controls.h |  1 +\n src/libcamera/delayed_controls.cpp            | 28 +++++++++++++++----\n 2 files changed, 23 insertions(+), 6 deletions(-)",
    "diff": "diff --git a/include/libcamera/internal/delayed_controls.h b/include/libcamera/internal/delayed_controls.h\nindex 5a0428e0..db5c29e9 100644\n--- a/include/libcamera/internal/delayed_controls.h\n+++ b/include/libcamera/internal/delayed_controls.h\n@@ -70,6 +70,7 @@ private:\n \t};\n \n \tbool controlsAreQueued(unsigned int frame, const ControlList &controls);\n+\tvoid fillValues(unsigned int fromIndex, unsigned int toIndex);\n \n \tV4L2Device *device_;\n \t/* \\todo Evaluate if we should index on ControlId * or unsigned int */\ndiff --git a/src/libcamera/delayed_controls.cpp b/src/libcamera/delayed_controls.cpp\nindex 8cfa6bbb..e325b6b2 100644\n--- a/src/libcamera/delayed_controls.cpp\n+++ b/src/libcamera/delayed_controls.cpp\n@@ -185,6 +185,27 @@ bool DelayedControls::controlsAreQueued(unsigned int sequence,\n \treturn true;\n }\n \n+/**\n+ * @brief Helper function to fill the values with the data from previous entries\n+ *\n+ * @param fromIndex The index to start the copy from\n+ * @param toIndex The last index that gets filled\n+ *\n+ * The updated member of the control values is reset to false.\n+ */\n+void DelayedControls::fillValues(unsigned int fromIndex, unsigned int toIndex)\n+{\n+\t/* Copy state from previous queue. */\n+\tfor (auto &ctrl : values_) {\n+\t\tauto &ringBuffer = ctrl.second;\n+\t\tfor (auto i = fromIndex; i < toIndex; i++) {\n+\t\t\tInfo &info = ringBuffer[i + 1];\n+\t\t\tinfo = ringBuffer[i];\n+\t\t\tinfo.updated = false;\n+\t\t}\n+\t}\n+}\n+\n /**\n  * \\brief Push a set of controls on the queue\n  * \\param[in] controls List of controls to add to the device queue\n@@ -196,12 +217,7 @@ bool DelayedControls::controlsAreQueued(unsigned int sequence,\n  */\n bool DelayedControls::push(const ControlList &controls)\n {\n-\t/* Copy state from previous frame. */\n-\tfor (auto &ctrl : values_) {\n-\t\tInfo &info = ctrl.second[queueIndex_];\n-\t\tinfo = values_[ctrl.first][queueIndex_ - 1];\n-\t\tinfo.updated = false;\n-\t}\n+\tfillValues(queueIndex_ - 1, queueIndex_);\n \n \t/* Update with new controls. */\n \tconst ControlIdMap &idmap = device_->controls().idmap();\n",
    "prefixes": [
        "v3",
        "10/16"
    ]
}