Patch Detail
Show a patch.
GET /api/patches/2184/?format=api
{ "id": 2184, "url": "https://patchwork.libcamera.org/api/patches/2184/?format=api", "web_url": "https://patchwork.libcamera.org/patch/2184/", "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": "<20191013232755.3292-3-laurent.pinchart@ideasonboard.com>", "date": "2019-10-13T23:27:48", "name": "[libcamera-devel,02/10] libcamera: v4l2_controls: Move V4L2ControlId out of V4L2ControlInfo", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "79a41e3837ee25eb2e36c0aa7df732e43e522806", "submitter": { "id": 2, "url": "https://patchwork.libcamera.org/api/people/2/?format=api", "name": "Laurent Pinchart", "email": "laurent.pinchart@ideasonboard.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/2184/mbox/", "series": [ { "id": 534, "url": "https://patchwork.libcamera.org/api/series/534/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=534", "date": "2019-10-13T23:27:46", "name": "Merge V4L2ControlInfoMap and ControlInfoMap", "version": 1, "mbox": "https://patchwork.libcamera.org/series/534/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/2184/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/2184/checks/", "tags": {}, "headers": { "Return-Path": "<laurent.pinchart@ideasonboard.com>", "Received": [ "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 852FE6196E\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 14 Oct 2019 01:28:03 +0200 (CEST)", "from pendragon.bb.dnainternet.fi\n\t(dfj612yhrgyx302h3jwwy-3.rev.dnainternet.fi\n\t[IPv6:2001:14ba:21f5:5b00:ce28:277f:58d7:3ca4])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 227FAA46\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 14 Oct 2019 01:28:03 +0200 (CEST)" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1571009283;\n\tbh=HMIS5efzZzpaKBFnqhQZd0FDqFMk4jydgsem8D3T9mc=;\n\th=From:To:Subject:Date:In-Reply-To:References:From;\n\tb=oU0uP15IHFyPG0I8gwsR38Qo3t8dySwzvIqCLZuAk10vWdBCcMekg0mCwLNX/eoOF\n\trt10Xq5e7taiCVsf7i82jly0EGTIIrhLTDoz9X9Nxupy/yMnIHrr000G6lbHRc5MaZ\n\tHEsGi1Isch9ux5FpJnwaavE9dg4R8eBarS+MQw2Q=", "From": "Laurent Pinchart <laurent.pinchart@ideasonboard.com>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Mon, 14 Oct 2019 02:27:48 +0300", "Message-Id": "<20191013232755.3292-3-laurent.pinchart@ideasonboard.com>", "X-Mailer": "git-send-email 2.21.0", "In-Reply-To": "<20191013232755.3292-1-laurent.pinchart@ideasonboard.com>", "References": "<20191013232755.3292-1-laurent.pinchart@ideasonboard.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH 02/10] libcamera: v4l2_controls: Move\n\tV4L2ControlId out of V4L2ControlInfo", "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>", "X-List-Received-Date": "Sun, 13 Oct 2019 23:28:03 -0000" }, "content": "From: Jacopo Mondi <jacopo@jmondi.org>\n\nIn order to reconcile the libcamera and V4L2 control info maps, we need\nto move the V4L2ControlId embedded in V4L2ControlInfo map out of the\nclass. Store the V4L2ControlId instances in the V4L2Device that creates\nthem, and only reference them from V4L2ControlInfo.\n\nSigned-off-by: Jacopo Mondi <jacopo@jmondi.org>\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n src/libcamera/include/v4l2_controls.h | 7 ++++---\n src/libcamera/include/v4l2_device.h | 4 +++-\n src/libcamera/v4l2_controls.cpp | 6 ++++--\n src/libcamera/v4l2_device.cpp | 3 ++-\n 4 files changed, 13 insertions(+), 7 deletions(-)", "diff": "diff --git a/src/libcamera/include/v4l2_controls.h b/src/libcamera/include/v4l2_controls.h\nindex 133f5262febf..4d7ac1a133c7 100644\n--- a/src/libcamera/include/v4l2_controls.h\n+++ b/src/libcamera/include/v4l2_controls.h\n@@ -28,13 +28,14 @@ public:\n class V4L2ControlInfo\n {\n public:\n-\tV4L2ControlInfo(const struct v4l2_query_ext_ctrl &ctrl);\n+\tV4L2ControlInfo(const V4L2ControlId &id,\n+\t\t\tconst struct v4l2_query_ext_ctrl &ctrl);\n \n-\tconst ControlId &id() const { return id_; }\n+\tconst ControlId &id() const { return *id_; }\n \tconst ControlRange &range() const { return range_; }\n \n private:\n-\tV4L2ControlId id_;\n+\tconst V4L2ControlId *id_;\n \tControlRange range_;\n };\n \ndiff --git a/src/libcamera/include/v4l2_device.h b/src/libcamera/include/v4l2_device.h\nindex daa762d58d2b..5a5b85827f23 100644\n--- a/src/libcamera/include/v4l2_device.h\n+++ b/src/libcamera/include/v4l2_device.h\n@@ -8,7 +8,8 @@\n #define __LIBCAMERA_V4L2_DEVICE_H__\n \n #include <map>\n-#include <string>\n+#include <memory>\n+#include <vector>\n \n #include <linux/videodev2.h>\n \n@@ -48,6 +49,7 @@ private:\n \t\t\t const struct v4l2_ext_control *v4l2Ctrls,\n \t\t\t unsigned int count);\n \n+\tstd::vector<std::unique_ptr<V4L2ControlId>> controlIds_;\n \tV4L2ControlInfoMap controls_;\n \tstd::string deviceNode_;\n \tint fd_;\ndiff --git a/src/libcamera/v4l2_controls.cpp b/src/libcamera/v4l2_controls.cpp\nindex dcf31b7a8f26..12c4fb271ba5 100644\n--- a/src/libcamera/v4l2_controls.cpp\n+++ b/src/libcamera/v4l2_controls.cpp\n@@ -122,10 +122,12 @@ V4L2ControlId::V4L2ControlId(const struct v4l2_query_ext_ctrl &ctrl)\n \n /**\n * \\brief Construct a V4L2ControlInfo from a struct v4l2_query_ext_ctrl\n+ * \\param[in] id The V4L2 control ID\n * \\param[in] ctrl The struct v4l2_query_ext_ctrl as returned by the kernel\n */\n-V4L2ControlInfo::V4L2ControlInfo(const struct v4l2_query_ext_ctrl &ctrl)\n-\t: id_(ctrl)\n+V4L2ControlInfo::V4L2ControlInfo(const V4L2ControlId &id,\n+\t\t\t\t const struct v4l2_query_ext_ctrl &ctrl)\n+\t: id_(&id)\n {\n \tif (ctrl.type == V4L2_CTRL_TYPE_INTEGER64)\n \t\trange_ = ControlRange(static_cast<int64_t>(ctrl.minimum),\ndiff --git a/src/libcamera/v4l2_device.cpp b/src/libcamera/v4l2_device.cpp\nindex 54cc214ecce9..144a60b4fe93 100644\n--- a/src/libcamera/v4l2_device.cpp\n+++ b/src/libcamera/v4l2_device.cpp\n@@ -386,9 +386,10 @@ void V4L2Device::listControls()\n \t\t\tcontinue;\n \t\t}\n \n+\t\tcontrolIds_.emplace_back(utils::make_unique<V4L2ControlId>(ctrl));\n \t\tctrls.emplace(std::piecewise_construct,\n \t\t\t std::forward_as_tuple(ctrl.id),\n-\t\t\t std::forward_as_tuple(ctrl));\n+\t\t\t std::forward_as_tuple(*controlIds_.back().get(), ctrl));\n \t}\n \n \tcontrols_ = std::move(ctrls);\n", "prefixes": [ "libcamera-devel", "02/10" ] }