Patch Detail
Show a patch.
GET /api/patches/12116/?format=api
{ "id": 12116, "url": "https://patchwork.libcamera.org/api/patches/12116/?format=api", "web_url": "https://patchwork.libcamera.org/patch/12116/", "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": "<20210427012150.5338-1-hiroh@chromium.org>", "date": "2021-04-27T01:21:50", "name": "[libcamera-devel] libcamera: V4L2Device: Remove the controls order assumption in updateControls()", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "253a0a8fb0367d211200311798c38c32eba281b8", "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/12116/mbox/", "series": [ { "id": 1980, "url": "https://patchwork.libcamera.org/api/series/1980/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=1980", "date": "2021-04-27T01:21:50", "name": "[libcamera-devel] libcamera: V4L2Device: Remove the controls order assumption in updateControls()", "version": 1, "mbox": "https://patchwork.libcamera.org/series/1980/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/12116/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/12116/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 DD140BDCA4\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 27 Apr 2021 01:22:00 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 1513568880;\n\tTue, 27 Apr 2021 03:22:00 +0200 (CEST)", "from mail-pj1-x1035.google.com (mail-pj1-x1035.google.com\n\t[IPv6:2607:f8b0:4864:20::1035])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 1B642605BD\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 27 Apr 2021 03:21:58 +0200 (CEST)", "by mail-pj1-x1035.google.com with SMTP id\n\tkb13-20020a17090ae7cdb02901503d67f0beso513920pjb.0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 26 Apr 2021 18:21:58 -0700 (PDT)", "from hiroh2.tok.corp.google.com\n\t([2401:fa00:8f:2:12bd:9107:566c:4682])\n\tby smtp.gmail.com with ESMTPSA id\n\tp10sm715901pfo.210.2021.04.26.18.21.54\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tMon, 26 Apr 2021 18:21:55 -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=\"hpUK8O2R\"; 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=bT/Pe1z2AFRQwP+7vmDRt+Pxfy/0+BHzUjvqrSL0yF8=;\n\tb=hpUK8O2RGfjGVBdG1pm/1Usf11EME837M7YuP6Gj6ur6kOH/6Jsf+maWL5WxZ/iru8\n\tYupeoeUMXwr/lATbG6dIoQmin5Z7BNw1CWnm5EJD9ybLy6viTV8u0M5ZITmsICg7iFO1\n\tGOhmQjvaT56T3Z2g4zgZT1T+Fm6tZugNpJdWA=", "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=bT/Pe1z2AFRQwP+7vmDRt+Pxfy/0+BHzUjvqrSL0yF8=;\n\tb=LKAs4p/K6b9uxCD1iq0iFu2YF1Y9r40RDVaw7u2coxlOyxMaeBzlvUz47Yr6j3Oicq\n\tiNHb1TQjalL1X4VQh0b2/mL6nxuGQIxc5dQebH5SmndfKOoiP98yyVgF91cpyRBsHjB6\n\tXoxBVGXzLoxKac84nbibh8XS2dzBAo/LHgefqKZD74AUwETA/fCJbWjXncuyspUVMIDI\n\tysNoUpxzcfVG2dDnuY3nOqRPooInWqYdI3ldqpRzDcgML7usffhhqzhKlhA6RlE87QuX\n\tePoUdtHJYB4fdnaT7mV3Ae4WqC/t5pGNGphJ801s+hPlLRFlv5Oa/2TDlxJCfu+BXat9\n\t62FQ==", "X-Gm-Message-State": "AOAM533eK/8TjYlKGalTbgf1oI8sGn7YGdnm9LXy1CioXp9psfcDJmnD\n\tBwMDDZN7Cyr7HgYEf7MXlH0DUEaCoY+piQ==", "X-Google-Smtp-Source": "ABdhPJwbHjn6lUPvwCEkmO51f5T4Whu8v2p8bF22IMfsbr13yIkwT/8RO78mft7uEUbiNN/JH0xa8A==", "X-Received": "by 2002:a17:902:6a88:b029:eb:3ea5:58c3 with SMTP id\n\tn8-20020a1709026a88b02900eb3ea558c3mr21794650plk.55.1619486516193; \n\tMon, 26 Apr 2021 18:21:56 -0700 (PDT)", "From": "Hirokazu Honda <hiroh@chromium.org>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Tue, 27 Apr 2021 10:21:50 +0900", "Message-Id": "<20210427012150.5338-1-hiroh@chromium.org>", "X-Mailer": "git-send-email 2.31.1.498.g6c1eba8ee3d-goog", "MIME-Version": "1.0", "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>", "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 | 26 +++++++-------------------\n 1 file changed, 7 insertions(+), 19 deletions(-)", "diff": "diff --git a/src/libcamera/v4l2_device.cpp b/src/libcamera/v4l2_device.cpp\nindex 397029ac..64501523 100644\n--- a/src/libcamera/v4l2_device.cpp\n+++ b/src/libcamera/v4l2_device.cpp\n@@ -178,12 +178,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@@ -520,19 +514,13 @@ void V4L2Device::listControls()\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-\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@@ -547,11 +535,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" ] }