Show a patch.

GET /api/patches/2170/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 2170,
    "url": "https://patchwork.libcamera.org/api/patches/2170/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/2170/",
    "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": "<20191012184407.31684-10-laurent.pinchart@ideasonboard.com>",
    "date": "2019-10-12T18:44:02",
    "name": "[libcamera-devel,v2,09/14] libcamera: v4l2_device: Avoid copy of V4L2ControlInfo",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "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/2170/mbox/",
    "series": [
        {
            "id": 531,
            "url": "https://patchwork.libcamera.org/api/series/531/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=531",
            "date": "2019-10-12T18:43:53",
            "name": "Use ControlList for both libcamera and V4L2 controls",
            "version": 2,
            "mbox": "https://patchwork.libcamera.org/series/531/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/2170/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/2170/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 ABCBA61986\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat, 12 Oct 2019 20:44:21 +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 4BDF254C\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat, 12 Oct 2019 20:44:21 +0200 (CEST)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1570905861;\n\tbh=PHukfiupzGP473rBSTqF5QnoGbfpdJ2UyRUkSw3CLyE=;\n\th=From:To:Subject:Date:In-Reply-To:References:From;\n\tb=XngmN1uW8S1A4dATT71Rwpxhu7SfKpd3J0VOMD+y3h0siQNc1BzdLNl2JRCeULix/\n\t3BTkAS9KDMEHTBQ3vzd/dEaACOPCQqRZIawDmJ73fcrRYF9At24NtfzDgYHOcD6m7u\n\t2J+Odn9P4uikEtBn3yEJIDl3tWiSSFKCJozNzJPc=",
        "From": "Laurent Pinchart <laurent.pinchart@ideasonboard.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Sat, 12 Oct 2019 21:44:02 +0300",
        "Message-Id": "<20191012184407.31684-10-laurent.pinchart@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.21.0",
        "In-Reply-To": "<20191012184407.31684-1-laurent.pinchart@ideasonboard.com>",
        "References": "<20191012184407.31684-1-laurent.pinchart@ideasonboard.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH v2 09/14] libcamera: v4l2_device: Avoid\n\tcopy 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": "Sat, 12 Oct 2019 18:44:21 -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 in-place. 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",
        "v2",
        "09/14"
    ]
}