Patch Detail
Show a patch.
GET /api/patches/2133/?format=api
{ "id": 2133, "url": "https://patchwork.libcamera.org/api/patches/2133/?format=api", "web_url": "https://patchwork.libcamera.org/patch/2133/", "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": "<20191007224642.6597-6-laurent.pinchart@ideasonboard.com>", "date": "2019-10-07T22:46:38", "name": "[libcamera-devel,5/9] libcamera: v4l2_device: Avoid copy of V4L2ControlInfo", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "561bca3fcff520c58e42a4526c88bd1c23f0ccb3", "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/2133/mbox/", "series": [ { "id": 526, "url": "https://patchwork.libcamera.org/api/series/526/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=526", "date": "2019-10-07T22:46:33", "name": "Use ControlList for both libcamera and V4L2 controls", "version": 1, "mbox": "https://patchwork.libcamera.org/series/526/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/2133/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/2133/checks/", "tags": {}, "headers": { "Return-Path": "<laurent.pinchart@ideasonboard.com>", "Received": [ "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id C4D176196D\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 8 Oct 2019 00:46:55 +0200 (CEST)", "from pendragon.ideasonboard.com\n\t(modemcable118.64-20-96.mc.videotron.ca [96.20.64.118])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id E91F2B2D\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 8 Oct 2019 00:46:54 +0200 (CEST)" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1570488415;\n\tbh=GvIit0LxIGNZjzEkjapDquTGQEpfBw0NxtjXXLA+hFY=;\n\th=From:To:Subject:Date:In-Reply-To:References:From;\n\tb=pSQ+wzfBsBXRR+iTPCBerDupZLJtsHbOojGqx56e447JELFNUF1SLH5NMj4EzMFLL\n\tj1Q1lleYm39mSW4SNVp+5ekrXWulDzAMSoCPsyT89pfmQRS38Mod61avANr2ynCLQN\n\tmL+ITwVOCHBAq5omFaY6t9xnQCZX/hWtorCRaeqQ=", "From": "Laurent Pinchart <laurent.pinchart@ideasonboard.com>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Tue, 8 Oct 2019 01:46:38 +0300", "Message-Id": "<20191007224642.6597-6-laurent.pinchart@ideasonboard.com>", "X-Mailer": "git-send-email 2.21.0", "In-Reply-To": "<20191007224642.6597-1-laurent.pinchart@ideasonboard.com>", "References": "<20191007224642.6597-1-laurent.pinchart@ideasonboard.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH 5/9] libcamera: v4l2_device: Avoid copy of\n\tV4L2ControlInfo", "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, 07 Oct 2019 22:46:56 -0000" }, "content": "The V4L2Device::listControls() method creates an instance of\nV4L2ControlInfo and then inserts it in the device's list of controls.\nThe insertion uses std::map::emplace(), but passes the V4L2ControlInfo,\nresulting in a copy being performed (using the copy constructor of\nV4L2ControlInfo).\n\nOptimise this by really constructing the V4L2ControlInfo emplace. The\nuse of std::piecewise_construct is required for gcc-5 that seems to have\ntrouble with std::map::emplace() on non-copyable values in this case.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n src/libcamera/v4l2_device.cpp | 9 +++++----\n 1 file changed, 5 insertions(+), 4 deletions(-)", "diff": "diff --git a/src/libcamera/v4l2_device.cpp b/src/libcamera/v4l2_device.cpp\nindex fd4b9c6d5c62..3bd82ff23212 100644\n--- a/src/libcamera/v4l2_device.cpp\n+++ b/src/libcamera/v4l2_device.cpp\n@@ -352,8 +352,7 @@ void V4L2Device::listControls()\n \t\t ctrl.flags & V4L2_CTRL_FLAG_DISABLED)\n \t\t\tcontinue;\n \n-\t\tV4L2ControlInfo info(ctrl);\n-\t\tswitch (info.type()) {\n+\t\tswitch (ctrl.type) {\n \t\tcase V4L2_CTRL_TYPE_INTEGER:\n \t\tcase V4L2_CTRL_TYPE_BOOLEAN:\n \t\tcase V4L2_CTRL_TYPE_MENU:\n@@ -364,12 +363,14 @@ void V4L2Device::listControls()\n \t\t\tbreak;\n \t\t/* \\todo Support compound controls. */\n \t\tdefault:\n-\t\t\tLOG(V4L2, Debug) << \"Control type '\" << info.type()\n+\t\t\tLOG(V4L2, Debug) << \"Control type '\" << ctrl.type\n \t\t\t\t\t << \"' not supported\";\n \t\t\tcontinue;\n \t\t}\n \n-\t\tcontrols_.emplace(ctrl.id, info);\n+\t\tcontrols_.emplace(std::piecewise_construct,\n+\t\t\t\t std::forward_as_tuple(ctrl.id),\n+\t\t\t\t std::forward_as_tuple(ctrl));\n \t}\n }\n \n", "prefixes": [ "libcamera-devel", "5/9" ] }