Patch Detail
Show a patch.
GET /api/1.1/patches/11898/?format=api
{ "id": 11898, "url": "https://patchwork.libcamera.org/api/1.1/patches/11898/?format=api", "web_url": "https://patchwork.libcamera.org/patch/11898/", "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": "<20210413061925.3054927-3-hiroh@chromium.org>", "date": "2021-04-13T06:19:25", "name": "[libcamera-devel,3/3] libcamera: V4L2Device: Use std::vector in updateControls()", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "6e1804ae5fc838c22806f28ad0345d519d409908", "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/11898/mbox/", "series": [ { "id": 1915, "url": "https://patchwork.libcamera.org/api/1.1/series/1915/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=1915", "date": "2021-04-13T06:19:23", "name": "[libcamera-devel,1/3] libcamera: V4L2Device: Use std::vector for v4l2_ext_control in getControls()", "version": 1, "mbox": "https://patchwork.libcamera.org/series/1915/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/11898/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/11898/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 165F8BD224\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 13 Apr 2021 06:19:39 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id CCA90687FF;\n\tTue, 13 Apr 2021 08:19:38 +0200 (CEST)", "from mail-pl1-x62a.google.com (mail-pl1-x62a.google.com\n\t[IPv6:2607:f8b0:4864:20::62a])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 9E0A468807\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 13 Apr 2021 08:19:36 +0200 (CEST)", "by mail-pl1-x62a.google.com with SMTP id j7so7647550plx.2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 12 Apr 2021 23:19:36 -0700 (PDT)", "from hiroh2.tok.corp.google.com\n\t([2401:fa00:8f:2:84f5:7981:dfbe:8f02])\n\tby smtp.gmail.com with ESMTPSA id\n\tn4sm11666063pfu.45.2021.04.12.23.19.33\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tMon, 12 Apr 2021 23:19:34 -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=\"gJqxOICr\"; 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=slwRzF9Gj9xvox8fzWKnDmBEEvj0hcU17A7XH1OMBAA=;\n\tb=gJqxOICrCMlHggPPocmFgdJt4OWfxH36rAmTwoIlN8mtOLBC43DHwjTMPJTpjdUfjd\n\tSJJdB+3+fSXStdbc2DI72jlD1LfaFkrVlxHtlS10nVNRbpKkaKsw+ElC0KQB8xKKByqZ\n\tMl6ySSf6LI7sGI5/PHIztsOymWt3MoFuhz7IU=", "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=slwRzF9Gj9xvox8fzWKnDmBEEvj0hcU17A7XH1OMBAA=;\n\tb=C9wzGu/6sm/arOgQ4cEP4ne8e9+BkSz7lH7OBRYjFbPs6roD7db4dBOeNpyMslTjoY\n\tdAm7/lo7IC+T/IhZoehX8gRfYCobebU9+8f7hvi8jLo4jTz+nM2xGgCU+KjPBj79BdZm\n\tEhsZ4ElMcvor86i4PEDNgESlhSDQlA8Q+2ZQwmDOUwqtm2qoRzyA0fTrGpOMDX/HTiWZ\n\te8YmxXdBlJRLONpeGfziukdBq0/cle76nu63eITENdyxyBe+bCEPVgKLU071pWPX5hDy\n\tretdteA23l4cRzeaQz7XKDF5iYN+pV8Mu5k2pl903awFTqHRHrj7YOxMGZvj0/clEdaO\n\tXD9g==", "X-Gm-Message-State": "AOAM5326P9AgVoNpv0OiSZc/lR69tISLLRu7eRtyFvN5WjlcZ6yioyMC\n\t+04M6cTI39jYdFJIddoQ3XSA4hGGVpFwIg==", "X-Google-Smtp-Source": "ABdhPJycFZeX3DqwNbkTwcnB8RL64OKpuhTAiTwtGGmdsgkyOpeA/xXWiqr0d7ZefnGLAzDQAK40+Q==", "X-Received": "by 2002:a17:902:e884:b029:e5:fece:3bb0 with SMTP id\n\tw4-20020a170902e884b02900e5fece3bb0mr31075309plg.61.1618294774860; \n\tMon, 12 Apr 2021 23:19:34 -0700 (PDT)", "From": "Hirokazu Honda <hiroh@chromium.org>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Tue, 13 Apr 2021 15:19:25 +0900", "Message-Id": "<20210413061925.3054927-3-hiroh@chromium.org>", "X-Mailer": "git-send-email 2.31.1.295.g9ea45b61b8-goog", "In-Reply-To": "<20210413061925.3054927-1-hiroh@chromium.org>", "References": "<20210413061925.3054927-1-hiroh@chromium.org>", "MIME-Version": "1.0", "Subject": "[libcamera-devel] [PATCH 3/3] libcamera: V4L2Device: Use\n\tstd::vector 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": "V4L2Device::updateControls() takes two arguments, raw array and\nits size, for the v4l2_ext_control values. This replaces it with\nstd::vector.\n\nSigned-off-by: Hirokazu Honda <hiroh@chromium.org>\n---\n include/libcamera/internal/v4l2_device.h | 3 +-\n src/libcamera/v4l2_device.cpp | 36 +++++++++++++-----------\n 2 files changed, 20 insertions(+), 19 deletions(-)", "diff": "diff --git a/include/libcamera/internal/v4l2_device.h b/include/libcamera/internal/v4l2_device.h\nindex d006bf68..4cce3840 100644\n--- a/include/libcamera/internal/v4l2_device.h\n+++ b/include/libcamera/internal/v4l2_device.h\n@@ -55,8 +55,7 @@ protected:\n private:\n \tvoid listControls();\n \tvoid updateControls(ControlList *ctrls,\n-\t\t\t const struct v4l2_ext_control *v4l2Ctrls,\n-\t\t\t unsigned int count);\n+\t\t\t const std::vector<v4l2_ext_control> &v4l2Ctrls);\n \n \tvoid eventAvailable(EventNotifier *notifier);\n \ndiff --git a/src/libcamera/v4l2_device.cpp b/src/libcamera/v4l2_device.cpp\nindex 8625dde8..8f29cd7f 100644\n--- a/src/libcamera/v4l2_device.cpp\n+++ b/src/libcamera/v4l2_device.cpp\n@@ -251,7 +251,7 @@ ControlList V4L2Device::getControls(const std::vector<uint32_t> &ids)\n \t\tv4l2Ctrls.resize(errorIdx);\n \t}\n \n-\tupdateControls(&ctrls, v4l2Ctrls.data(), v4l2Ctrls.size());\n+\tupdateControls(&ctrls, v4l2Ctrls);\n \n \treturn ctrls;\n }\n@@ -353,7 +353,7 @@ int V4L2Device::setControls(ControlList *ctrls)\n \t\tret = errorIdx;\n \t}\n \n-\tupdateControls(ctrls, v4l2Ctrls.data(), v4l2Ctrls.size());\n+\tupdateControls(ctrls, v4l2Ctrls);\n \n \treturn ret;\n }\n@@ -517,25 +517,27 @@ void V4L2Device::listControls()\n * values in \\a v4l2Ctrls\n * \\param[inout] ctrls List of V4L2 controls to update\n * \\param[in] v4l2Ctrls List of V4L2 extended controls as returned by the driver\n- * \\param[in] count The number of controls to update\n */\n void V4L2Device::updateControls(ControlList *ctrls,\n-\t\t\t\tconst struct v4l2_ext_control *v4l2Ctrls,\n-\t\t\t\tunsigned int count)\n+\t\t\t\tconst std::vector<v4l2_ext_control> &v4l2Ctrls)\n {\n-\tunsigned int i = 0;\n-\tfor (auto &ctrl : *ctrls) {\n-\t\tif (i == count)\n-\t\t\tbreak;\n+\tfor (const v4l2_ext_control &v4l2Ctrl : v4l2Ctrls) {\n+\t\tif (!ctrls->contains(v4l2Ctrl.id)) {\n+\t\t\tLOG(V4L2, Error) << \"Unknown id: \" << v4l2Ctrl.id;\n+\t\t\tcontinue;\n+\t\t}\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\tconst auto it = controls_.find(v4l2Ctrl.id);\n+\t\tif (it == controls_.end()) {\n+\t\t\tLOG(V4L2, Error) << \"Unknown id: \" << v4l2Ctrl.id;\n+\t\t\tcontinue;\n+\t\t}\n \n-\t\tconst auto iter = controls_.find(id);\n-\t\tswitch (iter->first->type()) {\n+\t\tconst ControlValue &value = ctrls->get(v4l2Ctrl.id);\n+\t\tControlValue newValue = value;\n+\t\tswitch (it->first->type()) {\n \t\tcase ControlTypeInteger64:\n-\t\t\tvalue.set<int64_t>(v4l2Ctrl->value64);\n+\t\t\tnewValue.set<int64_t>(v4l2Ctrl.value64);\n \t\t\tbreak;\n \n \t\tcase ControlTypeByte:\n@@ -550,11 +552,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\tnewValue.set<int32_t>(v4l2Ctrl.value);\n \t\t\tbreak;\n \t\t}\n \n-\t\ti++;\n+\t\tctrls->set(v4l2Ctrl.id, newValue);\n \t}\n }\n \n", "prefixes": [ "libcamera-devel", "3/3" ] }