Show a patch.

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

{
    "id": 19745,
    "url": "https://patchwork.libcamera.org/api/patches/19745/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/19745/",
    "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-6-stefan.klug@ideasonboard.com>",
    "date": "2024-03-19T12:05:06",
    "name": "[v3,05/16] libcamera: delayed_controls: Rename class members",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "fb0581dca1934512c8e884c8457d375d07e16d0e",
    "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/19745/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/19745/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/19745/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 ECF1AC3274\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 19 Mar 2024 12:05:39 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id C608162D2F;\n\tTue, 19 Mar 2024 13:05:35 +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 9DF4162CAD\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 19 Mar 2024 13:05:28 +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 EBA5F480;\n\tTue, 19 Mar 2024 13:05:01 +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=\"soxGyqYm\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1710849902;\n\tbh=0fdCqsmsRjGgHyqD2+KCaAkGapqqFfm+kwHb3gyTHbo=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=soxGyqYmMaTIVE3GtClGxonkRle2RCUDArDCuGPYWjEH6QAdeHPPW9ZV0Lk7jyuB0\n\t6+/4SsZXNiKCO1Sgt+vDjEHSzxkhPio6Zf6TpGYc2omJ5xYfHGX7MlUkWyUCdXTfGO\n\tBjkccn9tm/IXE4TOovzNb9Df3pG9jutkXJc+zNQQ=",
        "From": "Stefan Klug <stefan.klug@ideasonboard.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Cc": "Stefan Klug <stefan.klug@ideasonboard.com>",
        "Subject": "[PATCH v3 05/16] libcamera: delayed_controls: Rename class members",
        "Date": "Tue, 19 Mar 2024 13:05:06 +0100",
        "Message-Id": "<20240319120517.362082-6-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 preperation for the following patch, the class members are renamed\nto better express their intent. This might be a little picky, but\nmy head is just more used to thinking of an index than a count.\n\nSigned-off-by: Stefan Klug <stefan.klug@ideasonboard.com>\n---\n include/libcamera/internal/delayed_controls.h |  6 ++++--\n src/libcamera/delayed_controls.cpp            | 20 +++++++++----------\n 2 files changed, 14 insertions(+), 12 deletions(-)",
    "diff": "diff --git a/include/libcamera/internal/delayed_controls.h b/include/libcamera/internal/delayed_controls.h\nindex aef37077..4f8d2424 100644\n--- a/include/libcamera/internal/delayed_controls.h\n+++ b/include/libcamera/internal/delayed_controls.h\n@@ -72,8 +72,10 @@ private:\n \tstd::unordered_map<const ControlId *, ControlParams> controlParams_;\n \tunsigned int maxDelay_;\n \n-\tuint32_t queueCount_;\n-\tuint32_t writeCount_;\n+\t/* Index of the next request to queue */\n+\tuint32_t queueIndex_;\n+\t/* Index of the next request that gets written and is guaranteed to be fully applied */\n+\tuint32_t writeIndex_;\n \t/* \\todo Evaluate if we should index on ControlId * or unsigned int */\n \tstd::unordered_map<const ControlId *, ControlRingBuffer> values_;\n };\ndiff --git a/src/libcamera/delayed_controls.cpp b/src/libcamera/delayed_controls.cpp\nindex 777441e8..86571cd4 100644\n--- a/src/libcamera/delayed_controls.cpp\n+++ b/src/libcamera/delayed_controls.cpp\n@@ -115,8 +115,8 @@ DelayedControls::DelayedControls(V4L2Device *device,\n  */\n void DelayedControls::reset()\n {\n-\tqueueCount_ = 1;\n-\twriteCount_ = 0;\n+\tqueueIndex_ = 1;\n+\twriteIndex_ = 0;\n \n \t/* Retrieve control as reported by the device. */\n \tstd::vector<uint32_t> ids;\n@@ -150,8 +150,8 @@ 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[queueCount_];\n-\t\tinfo = values_[ctrl.first][queueCount_ - 1];\n+\t\tInfo &info = ctrl.second[queueIndex_];\n+\t\tinfo = values_[ctrl.first][queueIndex_ - 1];\n \t\tinfo.updated = false;\n \t}\n \n@@ -170,17 +170,17 @@ bool DelayedControls::push(const ControlList &controls)\n \t\tif (controlParams_.find(id) == controlParams_.end())\n \t\t\treturn false;\n \n-\t\tInfo &info = values_[id][queueCount_];\n+\t\tInfo &info = values_[id][queueIndex_];\n \n \t\tinfo = Info(control.second);\n \n \t\tLOG(DelayedControls, Debug)\n \t\t\t<< \"Queuing \" << id->name()\n \t\t\t<< \" to \" << info.toString()\n-\t\t\t<< \" at index \" << queueCount_;\n+\t\t\t<< \" at index \" << queueIndex_;\n \t}\n \n-\tqueueCount_++;\n+\tqueueIndex_++;\n \n \treturn true;\n }\n@@ -241,7 +241,7 @@ void DelayedControls::applyControls(uint32_t sequence)\n \tfor (auto &ctrl : values_) {\n \t\tconst ControlId *id = ctrl.first;\n \t\tunsigned int delayDiff = maxDelay_ - controlParams_[id].delay;\n-\t\tunsigned int index = std::max<int>(0, writeCount_ - delayDiff);\n+\t\tunsigned int index = std::max<int>(0, writeIndex_ - delayDiff);\n \t\tInfo &info = ctrl.second[index];\n \n \t\tif (info.updated) {\n@@ -271,9 +271,9 @@ void DelayedControls::applyControls(uint32_t sequence)\n \t\t}\n \t}\n \n-\twriteCount_ = sequence + 1;\n+\twriteIndex_ = sequence + 1;\n \n-\twhile (writeCount_ > queueCount_) {\n+\twhile (writeIndex_ > queueIndex_) {\n \t\tLOG(DelayedControls, Debug)\n \t\t\t<< \"Queue is empty, auto queue no-op.\";\n \t\tpush({});\n",
    "prefixes": [
        "v3",
        "05/16"
    ]
}