Patch Detail
Show a patch.
GET /api/1.1/patches/3066/?format=api
{ "id": 3066, "url": "https://patchwork.libcamera.org/api/1.1/patches/3066/?format=api", "web_url": "https://patchwork.libcamera.org/patch/3066/", "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": "<20200309162414.720306-2-jacopo@jmondi.org>", "date": "2020-03-09T16:24:04", "name": "[libcamera-devel,01/11] libcamera: controls: Name all ControlInfoMap instance variables infoMap", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "507892a6c34e8548dd5360bee86f3c4cee305d2d", "submitter": { "id": 3, "url": "https://patchwork.libcamera.org/api/1.1/people/3/?format=api", "name": "Jacopo Mondi", "email": "jacopo@jmondi.org" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/3066/mbox/", "series": [ { "id": 716, "url": "https://patchwork.libcamera.org/api/1.1/series/716/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=716", "date": "2020-03-09T16:24:03", "name": "Adda support for V4L2 array control and strings", "version": 1, "mbox": "https://patchwork.libcamera.org/series/716/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/3066/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/3066/checks/", "tags": {}, "headers": { "Return-Path": "<jacopo@jmondi.org>", "Received": [ "from relay3-d.mail.gandi.net (relay3-d.mail.gandi.net\n\t[217.70.183.195])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 502FC628BD\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 9 Mar 2020 17:21:28 +0100 (CET)", "from uno.lan (93-34-114-233.ip49.fastwebnet.it [93.34.114.233])\n\t(Authenticated sender: jacopo@jmondi.org)\n\tby relay3-d.mail.gandi.net (Postfix) with ESMTPSA id 0820360015\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 9 Mar 2020 16:21:27 +0000 (UTC)" ], "X-Originating-IP": "93.34.114.233", "From": "Jacopo Mondi <jacopo@jmondi.org>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Mon, 9 Mar 2020 17:24:04 +0100", "Message-Id": "<20200309162414.720306-2-jacopo@jmondi.org>", "X-Mailer": "git-send-email 2.25.0", "In-Reply-To": "<20200309162414.720306-1-jacopo@jmondi.org>", "References": "<20200309162414.720306-1-jacopo@jmondi.org>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH 01/11] libcamera: controls: Name all\n\tControlInfoMap instance variables infoMap", "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": "Mon, 09 Mar 2020 16:21:28 -0000" }, "content": "From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\nTo prepare for the rename of ControlRange to ControlInfo, rename all the\nControlInfoMap instance variables currently named info to infoMap. This\nwill help avoiding namespace clashes.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n include/libcamera/controls.h | 2 +-\n src/libcamera/control_serializer.cpp | 29 ++++++++++---------\n src/libcamera/controls.cpp | 6 ++--\n src/libcamera/include/control_serializer.h | 4 +--\n ...{control_info.cpp => control_info_map.cpp} | 18 ++++++------\n test/controls/meson.build | 8 ++---\n test/v4l2_videodevice/controls.cpp | 18 ++++++------\n 7 files changed, 43 insertions(+), 42 deletions(-)\n rename test/controls/{control_info.cpp => control_info_map.cpp} (74%)", "diff": "diff --git a/include/libcamera/controls.h b/include/libcamera/controls.h\nindex 0e111ab72bce..3d2250f43f3c 100644\n--- a/include/libcamera/controls.h\n+++ b/include/libcamera/controls.h\n@@ -313,7 +313,7 @@ private:\n public:\n \tControlList();\n \tControlList(const ControlIdMap &idmap, ControlValidator *validator = nullptr);\n-\tControlList(const ControlInfoMap &info, ControlValidator *validator = nullptr);\n+\tControlList(const ControlInfoMap &infoMap, ControlValidator *validator = nullptr);\n \n \tusing iterator = ControlListMap::iterator;\n \tusing const_iterator = ControlListMap::const_iterator;\ndiff --git a/src/libcamera/control_serializer.cpp b/src/libcamera/control_serializer.cpp\nindex 004735fb2aa0..dcc63d20c06c 100644\n--- a/src/libcamera/control_serializer.cpp\n+++ b/src/libcamera/control_serializer.cpp\n@@ -106,19 +106,19 @@ size_t ControlSerializer::binarySize(const ControlRange &range)\n \n /**\n * \\brief Retrieve the size in bytes required to serialize a ControlInfoMap\n- * \\param[in] info The control info map\n+ * \\param[in] infoMap The control info map\n *\n * Compute and return the size in bytes required to store the serialized\n * ControlInfoMap.\n *\n * \\return The size in bytes required to store the serialized ControlInfoMap\n */\n-size_t ControlSerializer::binarySize(const ControlInfoMap &info)\n+size_t ControlSerializer::binarySize(const ControlInfoMap &infoMap)\n {\n \tsize_t size = sizeof(struct ipa_controls_header)\n-\t\t + info.size() * sizeof(struct ipa_control_range_entry);\n+\t\t + infoMap.size() * sizeof(struct ipa_control_range_entry);\n \n-\tfor (const auto &ctrl : info)\n+\tfor (const auto &ctrl : infoMap)\n \t\tsize += binarySize(ctrl.second);\n \n \treturn size;\n@@ -159,32 +159,33 @@ void ControlSerializer::store(const ControlRange &range,\n \n /**\n * \\brief Serialize a ControlInfoMap in a buffer\n- * \\param[in] info The control info map to serialize\n+ * \\param[in] infoMap The control info map to serialize\n * \\param[in] buffer The memory buffer where to serialize the ControlInfoMap\n *\n- * Serialize the \\a info map into the \\a buffer using the serialization format\n+ * Serialize the \\a infoMap into the \\a buffer using the serialization format\n * defined by the IPA context interface in ipa_controls.h.\n *\n- * The serializer stores a reference to the \\a info internally. The caller\n- * shall ensure that \\a info stays valid until the serializer is reset().\n+ * The serializer stores a reference to the \\a infoMap internally. The caller\n+ * shall ensure that \\a infoMap stays valid until the serializer is reset().\n *\n * \\return 0 on success, a negative error code otherwise\n * \\retval -ENOSPC Not enough space is available in the buffer\n */\n-int ControlSerializer::serialize(const ControlInfoMap &info,\n+int ControlSerializer::serialize(const ControlInfoMap &infoMap,\n \t\t\t\t ByteStreamBuffer &buffer)\n {\n \t/* Compute entries and data required sizes. */\n-\tsize_t entriesSize = info.size() * sizeof(struct ipa_control_range_entry);\n+\tsize_t entriesSize = infoMap.size()\n+\t\t\t * sizeof(struct ipa_control_range_entry);\n \tsize_t valuesSize = 0;\n-\tfor (const auto &ctrl : info)\n+\tfor (const auto &ctrl : infoMap)\n \t\tvaluesSize += binarySize(ctrl.second);\n \n \t/* Prepare the packet header, assign a handle to the ControlInfoMap. */\n \tstruct ipa_controls_header hdr;\n \thdr.version = IPA_CONTROLS_FORMAT_VERSION;\n \thdr.handle = ++serial_;\n-\thdr.entries = info.size();\n+\thdr.entries = infoMap.size();\n \thdr.size = sizeof(hdr) + entriesSize + valuesSize;\n \thdr.data_offset = sizeof(hdr) + entriesSize;\n \n@@ -197,7 +198,7 @@ int ControlSerializer::serialize(const ControlInfoMap &info,\n \tByteStreamBuffer entries = buffer.carveOut(entriesSize);\n \tByteStreamBuffer values = buffer.carveOut(valuesSize);\n \n-\tfor (const auto &ctrl : info) {\n+\tfor (const auto &ctrl : infoMap) {\n \t\tconst ControlId *id = ctrl.first;\n \t\tconst ControlRange &range = ctrl.second;\n \n@@ -217,7 +218,7 @@ int ControlSerializer::serialize(const ControlInfoMap &info,\n \t * Store the map to handle association, to be used to serialize and\n \t * deserialize control lists.\n \t */\n-\tinfoMapHandles_[&info] = hdr.handle;\n+\tinfoMapHandles_[&infoMap] = hdr.handle;\n \n \treturn 0;\n }\ndiff --git a/src/libcamera/controls.cpp b/src/libcamera/controls.cpp\nindex 4326174adf86..833a436c64df 100644\n--- a/src/libcamera/controls.cpp\n+++ b/src/libcamera/controls.cpp\n@@ -706,11 +706,11 @@ ControlList::ControlList(const ControlIdMap &idmap, ControlValidator *validator)\n \n /**\n * \\brief Construct a ControlList with the idmap of a control info map\n- * \\param[in] info The ControlInfoMap for the control list target object\n+ * \\param[in] infoMap The ControlInfoMap for the control list target object\n * \\param[in] validator The validator (may be null)\n */\n-ControlList::ControlList(const ControlInfoMap &info, ControlValidator *validator)\n-\t: validator_(validator), idmap_(&info.idmap()), infoMap_(&info)\n+ControlList::ControlList(const ControlInfoMap &infoMap, ControlValidator *validator)\n+\t: validator_(validator), idmap_(&infoMap.idmap()), infoMap_(&infoMap)\n {\n }\n \ndiff --git a/src/libcamera/include/control_serializer.h b/src/libcamera/include/control_serializer.h\nindex b91d13155f5e..026e62340328 100644\n--- a/src/libcamera/include/control_serializer.h\n+++ b/src/libcamera/include/control_serializer.h\n@@ -24,10 +24,10 @@ public:\n \n \tvoid reset();\n \n-\tstatic size_t binarySize(const ControlInfoMap &info);\n+\tstatic size_t binarySize(const ControlInfoMap &infoMap);\n \tstatic size_t binarySize(const ControlList &list);\n \n-\tint serialize(const ControlInfoMap &info, ByteStreamBuffer &buffer);\n+\tint serialize(const ControlInfoMap &infoMap, ByteStreamBuffer &buffer);\n \tint serialize(const ControlList &list, ByteStreamBuffer &buffer);\n \n \ttemplate<typename T>\ndiff --git a/test/controls/control_info.cpp b/test/controls/control_info_map.cpp\nsimilarity index 74%\nrename from test/controls/control_info.cpp\nrename to test/controls/control_info_map.cpp\nindex fa9d7bae97d0..eeb702db095b 100644\n--- a/test/controls/control_info.cpp\n+++ b/test/controls/control_info_map.cpp\n@@ -36,41 +36,41 @@ protected:\n \n \tint run() override\n \t{\n-\t\tconst ControlInfoMap &info = camera_->controls();\n+\t\tconst ControlInfoMap &infoMap = camera_->controls();\n \n \t\t/* Test looking up a valid control by ControlId. */\n-\t\tif (info.count(&controls::Brightness) != 1) {\n+\t\tif (infoMap.count(&controls::Brightness) != 1) {\n \t\t\tcerr << \"count() on valid control failed\" << endl;\n \t\t\treturn TestFail;\n \t\t}\n \n-\t\tif (info.find(&controls::Brightness) == info.end()) {\n+\t\tif (infoMap.find(&controls::Brightness) == infoMap.end()) {\n \t\t\tcerr << \"find() on valid control failed\" << endl;\n \t\t\treturn TestFail;\n \t\t}\n \n-\t\tinfo.at(&controls::Brightness);\n+\t\tinfoMap.at(&controls::Brightness);\n \n \t\t/* Test looking up a valid control by numerical ID. */\n-\t\tif (info.count(controls::Brightness.id()) != 1) {\n+\t\tif (infoMap.count(controls::Brightness.id()) != 1) {\n \t\t\tcerr << \"count() on valid ID failed\" << endl;\n \t\t\treturn TestFail;\n \t\t}\n \n-\t\tif (info.find(controls::Brightness.id()) == info.end()) {\n+\t\tif (infoMap.find(controls::Brightness.id()) == infoMap.end()) {\n \t\t\tcerr << \"find() on valid ID failed\" << endl;\n \t\t\treturn TestFail;\n \t\t}\n \n-\t\tinfo.at(controls::Brightness.id());\n+\t\tinfoMap.at(controls::Brightness.id());\n \n \t\t/* Test looking up an invalid control by numerical ID. */\n-\t\tif (info.count(12345) != 0) {\n+\t\tif (infoMap.count(12345) != 0) {\n \t\t\tcerr << \"count() on invalid ID failed\" << endl;\n \t\t\treturn TestFail;\n \t\t}\n \n-\t\tif (info.find(12345) != info.end()) {\n+\t\tif (infoMap.find(12345) != infoMap.end()) {\n \t\t\tcerr << \"find() on invalid ID failed\" << endl;\n \t\t\treturn TestFail;\n \t\t}\ndiff --git a/test/controls/meson.build b/test/controls/meson.build\nindex f0850df28c8a..16a7f33fdcc6 100644\n--- a/test/controls/meson.build\n+++ b/test/controls/meson.build\n@@ -1,8 +1,8 @@\n control_tests = [\n- [ 'control_info', 'control_info.cpp' ],\n- [ 'control_list', 'control_list.cpp' ],\n- [ 'control_range', 'control_range.cpp' ],\n- [ 'control_value', 'control_value.cpp' ],\n+ [ 'control_info_map', 'control_info_map.cpp' ],\n+ [ 'control_list', 'control_list.cpp' ],\n+ [ 'control_range', 'control_range.cpp' ],\n+ [ 'control_value', 'control_value.cpp' ],\n ]\n \n foreach t : control_tests\ndiff --git a/test/v4l2_videodevice/controls.cpp b/test/v4l2_videodevice/controls.cpp\nindex 42c653d4435a..1b71bf0633b4 100644\n--- a/test/v4l2_videodevice/controls.cpp\n+++ b/test/v4l2_videodevice/controls.cpp\n@@ -26,27 +26,27 @@ public:\n protected:\n \tint run()\n \t{\n-\t\tconst ControlInfoMap &info = capture_->controls();\n+\t\tconst ControlInfoMap &infoMap = capture_->controls();\n \n \t\t/* Test control enumeration. */\n-\t\tif (info.empty()) {\n+\t\tif (infoMap.empty()) {\n \t\t\tcerr << \"Failed to enumerate controls\" << endl;\n \t\t\treturn TestFail;\n \t\t}\n \n-\t\tif (info.find(V4L2_CID_BRIGHTNESS) == info.end() ||\n-\t\t info.find(V4L2_CID_CONTRAST) == info.end() ||\n-\t\t info.find(V4L2_CID_SATURATION) == info.end()) {\n+\t\tif (infoMap.find(V4L2_CID_BRIGHTNESS) == infoMap.end() ||\n+\t\t infoMap.find(V4L2_CID_CONTRAST) == infoMap.end() ||\n+\t\t infoMap.find(V4L2_CID_SATURATION) == infoMap.end()) {\n \t\t\tcerr << \"Missing controls\" << endl;\n \t\t\treturn TestFail;\n \t\t}\n \n-\t\tconst ControlRange &brightness = info.find(V4L2_CID_BRIGHTNESS)->second;\n-\t\tconst ControlRange &contrast = info.find(V4L2_CID_CONTRAST)->second;\n-\t\tconst ControlRange &saturation = info.find(V4L2_CID_SATURATION)->second;\n+\t\tconst ControlRange &brightness = infoMap.find(V4L2_CID_BRIGHTNESS)->second;\n+\t\tconst ControlRange &contrast = infoMap.find(V4L2_CID_CONTRAST)->second;\n+\t\tconst ControlRange &saturation = infoMap.find(V4L2_CID_SATURATION)->second;\n \n \t\t/* Test getting controls. */\n-\t\tControlList ctrls(info);\n+\t\tControlList ctrls(infoMap);\n \t\tctrls.set(V4L2_CID_BRIGHTNESS, -1);\n \t\tctrls.set(V4L2_CID_CONTRAST, -1);\n \t\tctrls.set(V4L2_CID_SATURATION, -1);\n", "prefixes": [ "libcamera-devel", "01/11" ] }