Patch Detail
Show a patch.
GET /api/patches/12421/?format=api
{ "id": 12421, "url": "https://patchwork.libcamera.org/api/patches/12421/?format=api", "web_url": "https://patchwork.libcamera.org/patch/12421/", "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": "<20210526064311.3767479-1-hiroh@chromium.org>", "date": "2021-05-26T06:43:11", "name": "[libcamera-devel] libcamera: V4L2Device: Remove the controls order assumption in updateControls()", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "446e3736b788296025df50e08efe2d741bc26b9c", "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/12421/mbox/", "series": [ { "id": 2070, "url": "https://patchwork.libcamera.org/api/series/2070/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=2070", "date": "2021-05-26T06:43:11", "name": "[libcamera-devel] libcamera: V4L2Device: Remove the controls order assumption in updateControls()", "version": 1, "mbox": "https://patchwork.libcamera.org/series/2070/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/12421/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/12421/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 CEBE8C3203\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 26 May 2021 06:43:20 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 322B668922;\n\tWed, 26 May 2021 08:43:20 +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 2814D6891B\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 26 May 2021 08:43:19 +0200 (CEST)", "by mail-pf1-x429.google.com with SMTP id d78so206869pfd.10\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 25 May 2021 23:43:19 -0700 (PDT)", "from hiroh2.tok.corp.google.com\n\t([2401:fa00:8f:2:e36c:ae58:48e5:2f8e])\n\tby smtp.gmail.com with ESMTPSA id\n\to9sm16372349pfh.217.2021.05.25.23.43.15\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tTue, 25 May 2021 23:43:16 -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=\"bg40dJpW\"; 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=umurDYwZpbLqTAmXYIB3IUlN7PC3nJKh/nRuCeVfO24=;\n\tb=bg40dJpW5koKuR2llvr7L41XQ0xUrQLT3XzngzLlQ1N46WLlQqgKCxuxn0sfe8DoCJ\n\t+ic7p/hw5VFAzK8Di+Jvm4IAch+9RaXaGDJTenlTdxpj43+5XBF/JiVwEJKoVTbrWejQ\n\tmnrzg9Kt+3p0FYKWaEb6sHc8QkXJr9rmDVxVk=", "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=umurDYwZpbLqTAmXYIB3IUlN7PC3nJKh/nRuCeVfO24=;\n\tb=lQZnSBeiI5fJS8NJGupbWSHFuNe7eH/vlvS6LsXqSQa8xkKeVTH2yrVAi2zGJxWRNh\n\tgVXm/r3oRwWFauQ/E8Mp5C9Zcv+BAWZLxryn3Q/7YG7e79v7snjfkxAnHt3d+SdAjEi6\n\tv/A/jvqA1gyc+tgrUxxTizdERtk2m125EM+IUQjXu8pxfVB1AipkASgucl+YYOwsuTLB\n\tI6htZYrouFqdUMVjEGHcy0UPBwnTeGz9p6KbrZ+8PkcQNVGdfLLYrbY23xGd4kAyvMVe\n\ta2tAi4/RTqP+MLAo0nhZZg2S1gBD+u4ZeY2G3T8xVzIzEYSA4ZoazWPPY3hkKKzI61j7\n\tdgvA==", "X-Gm-Message-State": "AOAM530vWUmzUWnQ5kX2mySNPP9atAzwYwIEXjTn3odAYve6UPSmUXRy\n\txzLg2ItVHX+j/4TqN7Wc6tHgLo5c27ySwQ==", "X-Google-Smtp-Source": "ABdhPJzh+09MDnkyi/sF2P5/botfEA18va5RrnqQ2WXgTdtwjSJ6m/SEI4uYbxQpSU3NP11vAAsoRA==", "X-Received": "by 2002:a63:ad0f:: with SMTP id\n\tg15mr23244708pgf.415.1622011397416; \n\tTue, 25 May 2021 23:43:17 -0700 (PDT)", "From": "Hirokazu Honda <hiroh@chromium.org>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Wed, 26 May 2021 15:43:11 +0900", "Message-Id": "<20210526064311.3767479-1-hiroh@chromium.org>", "X-Mailer": "git-send-email 2.31.1.818.g46aad6cb9e-goog", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH] 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>", "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 | 25 ++++++++-----------------\n 1 file changed, 8 insertions(+), 17 deletions(-)", "diff": "diff --git a/src/libcamera/v4l2_device.cpp b/src/libcamera/v4l2_device.cpp\nindex caafbc2d..aaca7171 100644\n--- a/src/libcamera/v4l2_device.cpp\n+++ b/src/libcamera/v4l2_device.cpp\n@@ -244,12 +244,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@@ -623,19 +617,16 @@ void V4L2Device::updateControlInfo()\n void V4L2Device::updateControls(ControlList *ctrls,\n \t\t\t\tSpan<const v4l2_ext_control> v4l2Ctrls)\n {\n-\tunsigned int i = 0;\n-\tfor (auto &ctrl : *ctrls) {\n-\t\tif (i == v4l2Ctrls.size())\n-\t\t\tbreak;\n+\tfor (const v4l2_ext_control &v4l2Ctrl : v4l2Ctrls) {\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+\t\tControlValue value = ctrls->get(id);\n \n-\t\tconst auto iter = controls_.find(id);\n+\t\tconst auto &iter = controls_.find(id);\n+\t\tASSERT(iter != controls_.end());\n \t\tswitch (iter->first->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@@ -650,11 +641,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" ] }