Show a patch.

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

{
    "id": 19748,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/19748/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/19748/",
    "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-9-stefan.klug@ideasonboard.com>",
    "date": "2024-03-19T12:05:09",
    "name": "[v3,08/16] libcamera: delayed_controls: Add ctrls list parameter to reset() function",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "38474f85a02489c067b171c1cb1a944df3d92590",
    "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/19748/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/19748/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/19748/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 86653BD160\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 19 Mar 2024 12:05:42 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 12CDB62D3C;\n\tTue, 19 Mar 2024 13:05:39 +0100 (CET)",
            "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 75D0262D27\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 BBACAF02;\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=\"wkrwpne/\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1710849902;\n\tbh=kyRJ45pWGO4NCh/fbdEU9zKRDng0jLzHN++IvImihv8=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=wkrwpne/dFq1nmvWoek1KSwQWRW7nNfwnZUaHE8/eXR9Om4TYQ9ODLOrlOzsBh+o4\n\tPOJ81MskCLbXWTROuduTaaM/zBf+j2T85oSs3h07RDYsp9aZdiKLXE9ySgPrUsHjDB\n\tPPj50bMFDiBr8xXXnrLc14drLgaIcb7wEYQaCG68=",
        "From": "Stefan Klug <stefan.klug@ideasonboard.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Cc": "Stefan Klug <stefan.klug@ideasonboard.com>",
        "Subject": "[PATCH v3 08/16] libcamera: delayed_controls: Add ctrls list\n\tparameter to reset() function",
        "Date": "Tue, 19 Mar 2024 13:05:09 +0100",
        "Message-Id": "<20240319120517.362082-9-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 makes it easier for the caller. There is often this pattern\n\n  sensor_->setControls(controls);\n  delayedControls_->reset();\n\nwhich can then be reduced to\n\n  delayedControls_->reset(controls);\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            | 22 +++++++++++++++----\n 2 files changed, 19 insertions(+), 5 deletions(-)",
    "diff": "diff --git a/include/libcamera/internal/delayed_controls.h b/include/libcamera/internal/delayed_controls.h\nindex ccbe7239..224c1f7e 100644\n--- a/include/libcamera/internal/delayed_controls.h\n+++ b/include/libcamera/internal/delayed_controls.h\n@@ -27,7 +27,7 @@ public:\n \tDelayedControls(V4L2Device *device,\n \t\t\tconst std::unordered_map<uint32_t, ControlParams> &controlParams);\n \n-\tvoid reset();\n+\tvoid reset(ControlList *controls = nullptr);\n \n \tbool push(const ControlList &controls);\n \tControlList get(uint32_t sequence);\ndiff --git a/src/libcamera/delayed_controls.cpp b/src/libcamera/delayed_controls.cpp\nindex 6c766ede..6f06950e 100644\n--- a/src/libcamera/delayed_controls.cpp\n+++ b/src/libcamera/delayed_controls.cpp\n@@ -109,11 +109,13 @@ DelayedControls::DelayedControls(V4L2Device *device,\n \n /**\n  * \\brief Reset state machine\n+ * \\param[in,out] controls The controls to apply to the device\n  *\n  * Resets the state machine to a starting position based on control values\n- * retrieved from the device.\n+ * retrieved from the device. If \\a controls is given, these controls are set\n+ * on the device before retrieving the reset values.\n  */\n-void DelayedControls::reset()\n+void DelayedControls::reset(ControlList *controls)\n {\n \tqueueIndex_ = 1;\n \twriteIndex_ = 0;\n@@ -123,11 +125,23 @@ void DelayedControls::reset()\n \tfor (auto const &param : controlParams_)\n \t\tids.push_back(param.first->id());\n \n-\tControlList controls = device_->getControls(ids);\n+\tif (controls) {\n+\t\tdevice_->setControls(controls);\n+\n+\t\tLOG(DelayedControls, Debug) << \"reset:\";\n+\t\tauto idMap = controls->idMap();\n+\t\tif (idMap) {\n+\t\t\tfor (const auto &[id, value] : *controls)\n+\t\t\t\tLOG(DelayedControls, Debug) << \"  \" << idMap->at(id)->name()\n+\t\t\t\t\t\t\t    << \" : \" << value.toString();\n+\t\t}\n+\t}\n+\n+\tControlList ctrls = device_->getControls(ids);\n \n \t/* Seed the control queue with the controls reported by the device. */\n \tvalues_.clear();\n-\tfor (const auto &ctrl : controls) {\n+\tfor (const auto &ctrl : ctrls) {\n \t\tconst ControlId *id = device_->controls().idmap().at(ctrl.first);\n \t\t/*\n \t\t * Do not mark this control value as updated, it does not need\n",
    "prefixes": [
        "v3",
        "08/16"
    ]
}