Show a patch.

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

{
    "id": 12055,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/12055/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/12055/",
    "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": "<20210422021809.520675-2-hiroh@chromium.org>",
    "date": "2021-04-22T02:18:06",
    "name": "[libcamera-devel,v4,1/4] libcamera: V4L2Device: Remove the controls order assumption in updateControls()",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "0c68d2419f4466068591a329c3c6885a5dad4f8b",
    "submitter": {
        "id": 63,
        "url": "https://patchwork.libcamera.org/api/1.1/people/63/?format=api",
        "name": "Hirokazu Honda",
        "email": "hiroh@chromium.org"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/12055/mbox/",
    "series": [
        {
            "id": 1959,
            "url": "https://patchwork.libcamera.org/api/1.1/series/1959/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=1959",
            "date": "2021-04-22T02:18:05",
            "name": "Clean up V4L2Device code",
            "version": 4,
            "mbox": "https://patchwork.libcamera.org/series/1959/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/12055/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/12055/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 9F247BDB15\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 22 Apr 2021 02:18:19 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 61E0268854;\n\tThu, 22 Apr 2021 04:18:19 +0200 (CEST)",
            "from mail-pf1-x433.google.com (mail-pf1-x433.google.com\n\t[IPv6:2607:f8b0:4864:20::433])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 98DF468849\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 22 Apr 2021 04:18:17 +0200 (CEST)",
            "by mail-pf1-x433.google.com with SMTP id y62so6812589pfg.4\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 21 Apr 2021 19:18:17 -0700 (PDT)",
            "from hiroh2.tok.corp.google.com\n\t([2401:fa00:8f:2:f88:d5a0:ebc4:5b76])\n\tby smtp.gmail.com with ESMTPSA id\n\tlt11sm3352480pjb.23.2021.04.21.19.18.14\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tWed, 21 Apr 2021 19:18:15 -0700 (PDT)"
        ],
        "Authentication-Results": "lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=chromium.org header.i=@chromium.org\n\theader.b=\"Olj2K9RY\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org;\n\ts=google; \n\th=from:to:cc:subject:date:message-id:in-reply-to:references\n\t:mime-version:content-transfer-encoding;\n\tbh=Lu978gzqbTWIUvxflQvmctS/NAPkbdXXF8n35Kel5w8=;\n\tb=Olj2K9RYpewwcVglFIaiDq0Fys6aHxDjxq/RUBDbpLqPZLlxU6zK2koF9BBIKxEBvf\n\t32k4ZxvB3v70UZPqCfjuEBnY4Z+sCA8XhaVIs6cKFnEkjIHlF+zwQAJj/JPAdDTatGvu\n\tOrSRkT4xGipBjGZKAUJC9rhCrNe+AisX1twJY=",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references:mime-version:content-transfer-encoding;\n\tbh=Lu978gzqbTWIUvxflQvmctS/NAPkbdXXF8n35Kel5w8=;\n\tb=l3qNwJ8GMAn26UzfET6qwQIGc//0NJIsQIggOZS6nbfZpw/iAj8Z6EAO0uMhDxNYtO\n\tESpU8TZtZCjMCe2MuoZ2FsGANb3IzJXvEBY6zI3NAMtftyHXJp1SPHPSuJeM0ATCWet9\n\tR/sCLfea3pYbh7d7+xqkdGtcndIO1XD5hNyjnRTiV58P7aqFIZmiqMklHZhIAs3s0hL7\n\til+JRPj3i4zJPMT0emWH3Z/y4FSoQhfc5m6/vp6t42M1CwcI6zmQiUxy9zP8iFdoLJkJ\n\tQIruQzvTHtEIVf5QQQvUQxJlDZZQzDRCrAMUeRFbYZ/wfyxUfp3XerZzglididQF7Y4b\n\tTgmw==",
        "X-Gm-Message-State": "AOAM531Y94PobMVVUfn0MrIMLsCts/ezt6KH8QyBTHLfie7rcMwrxVAd\n\tA8n+WkAi2jxAIDvmV/LtsaWhD3kpl6nuGg==",
        "X-Google-Smtp-Source": "ABdhPJzaGWGTKKsIueqm8sFYDerY/Kx8hygfQm4bOdcFfQ/Fdw3MBSuBwjuFtPGRwBGfoEv0cbzujw==",
        "X-Received": "by 2002:a65:6184:: with SMTP id c4mr1160742pgv.200.1619057895755;\n\tWed, 21 Apr 2021 19:18:15 -0700 (PDT)",
        "From": "Hirokazu Honda <hiroh@chromium.org>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Thu, 22 Apr 2021 11:18:06 +0900",
        "Message-Id": "<20210422021809.520675-2-hiroh@chromium.org>",
        "X-Mailer": "git-send-email 2.31.1.368.gbe11c130af-goog",
        "In-Reply-To": "<20210422021809.520675-1-hiroh@chromium.org>",
        "References": "<20210422021809.520675-1-hiroh@chromium.org>",
        "MIME-Version": "1.0",
        "Subject": "[libcamera-devel] [PATCH v4 1/4] libcamera: V4L2Device: Remove the\n\tcontrols order assumption in updateControls()",
        "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>",
        "Content-Type": "text/plain; charset=\"us-ascii\"",
        "Content-Transfer-Encoding": "7bit",
        "Errors-To": "libcamera-devel-bounces@lists.libcamera.org",
        "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"
    },
    "content": "The original updateControls() has the assumption that ctrls and\nv4l2Ctrls lists in the same order. It is dependent on the caller\nimplementation though. This changes updateControls()\nimplementation so that it works without the assumption.\n\nSigned-off-by: Hirokazu Honda <hiroh@chromium.org>\n---\n src/libcamera/v4l2_device.cpp | 32 +++++++++++++-------------------\n 1 file changed, 13 insertions(+), 19 deletions(-)",
    "diff": "diff --git a/src/libcamera/v4l2_device.cpp b/src/libcamera/v4l2_device.cpp\nindex decd19ef..3c32d682 100644\n--- a/src/libcamera/v4l2_device.cpp\n+++ b/src/libcamera/v4l2_device.cpp\n@@ -179,12 +179,6 @@ ControlList V4L2Device::getControls(const std::vector<uint32_t> &ids)\n \n \tControlList ctrls{ controls_ };\n \n-\t/*\n-\t * Start by filling the ControlList. This can't be combined with filling\n-\t * v4l2Ctrls, as updateControls() relies on both containers having the\n-\t * same order, and the control list is based on a map, which is not\n-\t * sorted by insertion order.\n-\t */\n \tfor (uint32_t id : ids) {\n \t\tconst auto iter = controls_.find(id);\n \t\tif (iter == controls_.end()) {\n@@ -525,19 +519,19 @@ void V4L2Device::updateControls(ControlList *ctrls,\n \t\t\t\tconst struct v4l2_ext_control *v4l2Ctrls,\n \t\t\t\tunsigned int count)\n {\n-\tunsigned int i = 0;\n-\tfor (auto &ctrl : *ctrls) {\n-\t\tif (i == count)\n-\t\t\tbreak;\n-\n-\t\tconst struct v4l2_ext_control *v4l2Ctrl = &v4l2Ctrls[i];\n-\t\tunsigned int id = ctrl.first;\n-\t\tControlValue &value = ctrl.second;\n+\tfor (unsigned int i = 0; i < count; i++) {\n+\t\tconst struct v4l2_ext_control &v4l2Ctrl = v4l2Ctrls[i];\n+\t\tconst unsigned int id = v4l2Ctrl.id;\n+\t\tif (!ctrls->contains(id)) {\n+\t\t\tLOG(V4L2, Error) << \"ControlList doesn't contain id: \"\n+\t\t\t\t\t << id;\n+\t\t\treturn;\n+\t\t}\n \n-\t\tconst auto iter = controls_.find(id);\n-\t\tswitch (iter->first->type()) {\n+\t\tControlValue value = ctrls->get(id);\n+\t\tswitch (value.type()) {\n \t\tcase ControlTypeInteger64:\n-\t\t\tvalue.set<int64_t>(v4l2Ctrl->value64);\n+\t\t\tvalue.set<int64_t>(v4l2Ctrl.value64);\n \t\t\tbreak;\n \n \t\tcase ControlTypeByte:\n@@ -552,11 +546,11 @@ void V4L2Device::updateControls(ControlList *ctrls,\n \t\t\t * \\todo To be changed when support for string controls\n \t\t\t * will be added.\n \t\t\t */\n-\t\t\tvalue.set<int32_t>(v4l2Ctrl->value);\n+\t\t\tvalue.set<int32_t>(v4l2Ctrl.value);\n \t\t\tbreak;\n \t\t}\n \n-\t\ti++;\n+\t\tctrls->set(id, value);\n \t}\n }\n \n",
    "prefixes": [
        "libcamera-devel",
        "v4",
        "1/4"
    ]
}