Show a patch.

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

{
    "id": 12094,
    "url": "https://patchwork.libcamera.org/api/patches/12094/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/12094/",
    "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": "<20210423093653.1726488-1-hiroh@chromium.org>",
    "date": "2021-04-23T09:36:50",
    "name": "[libcamera-devel,v5,1/4] libcamera: V4L2Device: Remove the controls order assumption in updateControls()",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "4c023575e45f5248b873a89552f4ac73bddf4507",
    "submitter": {
        "id": 63,
        "url": "https://patchwork.libcamera.org/api/people/63/?format=api",
        "name": "Hirokazu Honda",
        "email": "hiroh@chromium.org"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/12094/mbox/",
    "series": [
        {
            "id": 1970,
            "url": "https://patchwork.libcamera.org/api/series/1970/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=1970",
            "date": "2021-04-23T09:36:50",
            "name": "[libcamera-devel,v5,1/4] libcamera: V4L2Device: Remove the controls order assumption in updateControls()",
            "version": 5,
            "mbox": "https://patchwork.libcamera.org/series/1970/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/12094/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/12094/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 A10D0BDB15\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 23 Apr 2021 09:37:56 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 0EB8B6887C;\n\tFri, 23 Apr 2021 11:37:56 +0200 (CEST)",
            "from mail-pf1-x429.google.com (mail-pf1-x429.google.com\n\t[IPv6:2607:f8b0:4864:20::429])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 2E3AB6886E\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 23 Apr 2021 11:37:55 +0200 (CEST)",
            "by mail-pf1-x429.google.com with SMTP id c3so14925171pfo.3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 23 Apr 2021 02:37:55 -0700 (PDT)",
            "from hiroh2.tok.corp.google.com\n\t([2401:fa00:8f:2:8537:2d4f:8d35:5777])\n\tby smtp.gmail.com with ESMTPSA id\n\tz5sm4273660pff.191.2021.04.23.02.37.51\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tFri, 23 Apr 2021 02:37:52 -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=\"G7lxCbF+\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org;\n\ts=google; h=from:to:cc:subject:date:message-id:mime-version\n\t:content-transfer-encoding;\n\tbh=RSqDOLvLGFfx5si4xOZu5KKSSZfzCxjP22JVLy+D9C4=;\n\tb=G7lxCbF+777mSGRjyD7ykfbXQWVEkW6B/Zfh/+vcZI6dAKnIH/vflUBHJwzIG/jCzW\n\t8UNbnWhUw8zqWqy8obI3vKfXGu4ilMGDktfmqCKtruQh+WOnSet+WL1Q5pt93zGtRQ6W\n\tDGQyt5wWnfVg1CklRNUxyWATZZjRWQE2sn0GQ=",
        "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:mime-version\n\t:content-transfer-encoding;\n\tbh=RSqDOLvLGFfx5si4xOZu5KKSSZfzCxjP22JVLy+D9C4=;\n\tb=GtHbwRGV0y8Y+gvkSY5ZC7rL1E/cFRJxNVmMNibbPJ0MsVbAVJt+B1mo+2PxoaXl+A\n\tnxIXEmZYm3UtCuoKdrn2pOZKF65XhzCOzspMURGW6wcYlGkMIgF830My9/W/Cf10wS3O\n\tykUMCpFhlvYrc9TEM9RP707oSNyRV+nb3Vz6dvWj2CQZH/kCTZgCiz+cTsFFUxk7/bfW\n\tB6SNbo5NirTZo8jtr0SyYvFMCotP8SJrFuN8ot63ScUBe+53fzlOac6MZQccofVVA2cB\n\tZXDFF5LF64JKCLXLRMrmfRIRsGm91wdi3dgHDTPMmHOA9VbkM97IgP2E+YYpE8HvVlQh\n\tte6g==",
        "X-Gm-Message-State": "AOAM531qcu+sdMBm85YcPftCHBOLTdTzuBtbYIaZgsLUAc2N/zsWc4Dq\n\tBWJAHKHVIyNcf7tyDNId4KXVfM11sF18bQ==",
        "X-Google-Smtp-Source": "ABdhPJyyv6fZs+BKxOcSFWP+6T3hOWXLSEZkwDHuhqGZUGPQQRKeTpNHtuEJwx1rYPINwaUG7um6jA==",
        "X-Received": "by 2002:a63:e206:: with SMTP id q6mr2871284pgh.225.1619170673037;\n\tFri, 23 Apr 2021 02:37:53 -0700 (PDT)",
        "From": "Hirokazu Honda <hiroh@chromium.org>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Fri, 23 Apr 2021 18:36:50 +0900",
        "Message-Id": "<20210423093653.1726488-1-hiroh@chromium.org>",
        "X-Mailer": "git-send-email 2.31.1.498.g6c1eba8ee3d-goog",
        "MIME-Version": "1.0",
        "Subject": "[libcamera-devel] [PATCH v5 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 are in the same order. It is dependent on the\ncaller implementation 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 | 27 ++++++++-------------------\n 1 file changed, 8 insertions(+), 19 deletions(-)",
    "diff": "diff --git a/src/libcamera/v4l2_device.cpp b/src/libcamera/v4l2_device.cpp\nindex decd19ef..ce2860c4 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,14 @@ 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+\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 \n-\t\tconst struct v4l2_ext_control *v4l2Ctrl = &v4l2Ctrls[i];\n-\t\tunsigned int id = ctrl.first;\n-\t\tControlValue &value = ctrl.second;\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 +541,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",
        "v5",
        "1/4"
    ]
}