Show a patch.

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

{
    "id": 19747,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/19747/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/19747/",
    "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": "<20240319120517.362082-8-stefan.klug@ideasonboard.com>",
    "date": "2024-03-19T12:05:08",
    "name": "[v3,07/16] libcamera: delayed_controls: Add controlsAreQueued() helper",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "b264b3de94b82883939bb33d3ce4e946bc257053",
    "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/19747/mbox/",
    "series": [
        {
            "id": 4230,
            "url": "https://patchwork.libcamera.org/api/1.1/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/19747/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/19747/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 9BF7DC32C5\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 19 Mar 2024 12:05:41 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 3C84A62CA7;\n\tTue, 19 Mar 2024 13:05:38 +0100 (CET)",
            "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 2D21862973\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 7D640480;\n\tTue, 19 Mar 2024 13:05:02 +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=\"TkK93nuG\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1710849902;\n\tbh=CY+7rwNcPmr9tbggrYi5pB0eqv6maFoX762dCfO5dT4=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=TkK93nuG8AJ8wb1Sh3KZ9hoKK2eQJgqRisE+hjt2hRXNB5aoXAF/+pJJu4P2JvA2T\n\tGDbxxQ1twQHLaqQZ86iGjLZB5n0gcaSDm63h/UU9iWFUfSHHIaNjwz/Pt9nRFGqQUw\n\tOCg4DltFH5/1dJnm/wPvzpj0lX9kcKLNw/KiWLLE=",
        "From": "Stefan Klug <stefan.klug@ideasonboard.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Cc": "Stefan Klug <stefan.klug@ideasonboard.com>",
        "Subject": "[PATCH v3 07/16] libcamera: delayed_controls: Add\n\tcontrolsAreQueued() helper",
        "Date": "Tue, 19 Mar 2024 13:05:08 +0100",
        "Message-Id": "<20240319120517.362082-8-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": "This gets used in the upcoming patches to decide if controls need to be queued\nfor a later frame, or if the controls can be skipped because they are already\nqueued.\n\nSigned-off-by: Stefan Klug <stefan.klug@ideasonboard.com>\n---\n include/libcamera/internal/delayed_controls.h |  2 ++\n src/libcamera/delayed_controls.cpp            | 34 +++++++++++++++++++\n 2 files changed, 36 insertions(+)",
    "diff": "diff --git a/include/libcamera/internal/delayed_controls.h b/include/libcamera/internal/delayed_controls.h\nindex 0e28106a..ccbe7239 100644\n--- a/include/libcamera/internal/delayed_controls.h\n+++ b/include/libcamera/internal/delayed_controls.h\n@@ -67,6 +67,8 @@ private:\n \t\t}\n \t};\n \n+\tbool controlsAreQueued(unsigned int frame, const ControlList &controls);\n+\n \tV4L2Device *device_;\n \t/* \\todo Evaluate if we should index on ControlId * or unsigned int */\n \tstd::unordered_map<const ControlId *, ControlParams> controlParams_;\ndiff --git a/src/libcamera/delayed_controls.cpp b/src/libcamera/delayed_controls.cpp\nindex 86571cd4..6c766ede 100644\n--- a/src/libcamera/delayed_controls.cpp\n+++ b/src/libcamera/delayed_controls.cpp\n@@ -137,6 +137,40 @@ void DelayedControls::reset()\n \t}\n }\n \n+/**\n+ * \\brief Helper function to check if controls are already queued\n+ * \\param[in] sequence Sequence number to check\n+ * \\param[in] controls List of controls to compare against\n+ *\n+ * This function checks if the controls queued for frame \\a sequence\n+ * are equal to \\a controls. This is helpful in cases where a control algorithm\n+ * unconditionally queues controls for every frame, but always too late.\n+ * In that case this can be used to check if incoming controls are already\n+ * queued or need to be queued for a later frame.\n+ *\n+ * \\returns true if \\a controls are queued for the given sequence\n+ */\n+bool DelayedControls::controlsAreQueued(unsigned int sequence,\n+\t\t\t\t\tconst ControlList &controls)\n+{\n+\tconst ControlIdMap &idmap = device_->controls().idmap();\n+\tfor (const auto &[id, value] : controls) {\n+\t\tconst auto &it = idmap.find(id);\n+\t\tif (it == idmap.end()) {\n+\t\t\tLOG(DelayedControls, Warning)\n+\t\t\t\t<< \"Unknown control \" << id;\n+\t\t\treturn false;\n+\t\t}\n+\n+\t\tconst ControlId *ctrlId = it->second;\n+\n+\t\tif (values_[ctrlId][sequence] != value)\n+\t\t\treturn false;\n+\t}\n+\n+\treturn true;\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",
    "prefixes": [
        "v3",
        "07/16"
    ]
}