Patch Detail
Show a patch.
GET /api/1.1/patches/8894/?format=api
{ "id": 8894, "url": "https://patchwork.libcamera.org/api/1.1/patches/8894/?format=api", "web_url": "https://patchwork.libcamera.org/patch/8894/", "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": "<20200720224232.153717-3-kieran.bingham@ideasonboard.com>", "date": "2020-07-20T22:42:26", "name": "[libcamera-devel,RFC,2/8] libcamera: buffer: Convert copyFrom to use MappedFrameBuffer", "commit_ref": null, "pull_url": null, "state": "rfc", "archived": false, "hash": "55472a8b09357fb97f4873c6a9b0e67c1d0e7534", "submitter": { "id": 4, "url": "https://patchwork.libcamera.org/api/1.1/people/4/?format=api", "name": "Kieran Bingham", "email": "kieran.bingham@ideasonboard.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/8894/mbox/", "series": [ { "id": 1119, "url": "https://patchwork.libcamera.org/api/1.1/series/1119/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=1119", "date": "2020-07-20T22:42:24", "name": "RFC MappedBuffers", "version": 1, "mbox": "https://patchwork.libcamera.org/series/1119/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/8894/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/8894/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 4C5BBC0109\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 20 Jul 2020 22:42:42 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id A2B4660832;\n\tTue, 21 Jul 2020 00:42:39 +0200 (CEST)", "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 9CFF0605BF\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 21 Jul 2020 00:42:37 +0200 (CEST)", "from localhost.localdomain\n\t(cpc89242-aztw30-2-0-cust488.18-1.cable.virginm.net [86.31.129.233])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 351199E7;\n\tTue, 21 Jul 2020 00:42:37 +0200 (CEST)" ], "Authentication-Results": "lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"CHnfuP0r\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1595284957;\n\tbh=CLF294+7yp0YKFvWJKqrht+70tMu+jd9WOdQcaMoClg=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=CHnfuP0rkKWuxhGLtoBgIApEbgReh4ej28Kjui9g1xnz28rRGsFGcGiqXdfR/ULAi\n\tNxindD1tUh6tOm13JQKa1KyZ5fHAApw36wgy57BkNHh7eXcGXlQ9CThz7hExz1+yga\n\tGa9/R6ovyTpR00CLwNRJjIPorgS+l5x838R0a4n4=", "From": "Kieran Bingham <kieran.bingham@ideasonboard.com>", "To": "libcamera devel <libcamera-devel@lists.libcamera.org>", "Date": "Mon, 20 Jul 2020 23:42:26 +0100", "Message-Id": "<20200720224232.153717-3-kieran.bingham@ideasonboard.com>", "X-Mailer": "git-send-email 2.25.1", "In-Reply-To": "<20200720224232.153717-1-kieran.bingham@ideasonboard.com>", "References": "<20200720224232.153717-1-kieran.bingham@ideasonboard.com>", "MIME-Version": "1.0", "Subject": "[libcamera-devel] [RFC PATCH 2/8] libcamera: buffer: Convert\n\tcopyFrom to use MappedFrameBuffer", "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": "Utilise the new MappedFrameBuffer helper to handle all mapping and\nunmapping of the copyFrom helper function.\n\nSigned-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n---\n\nThis shows how the MappedFrameBuffer can then be utilised, even though I\nbelieve this particular copyFrom() function is expected to disappear\nsometime soon.\n\n src/libcamera/buffer.cpp | 37 ++++++++++++++-----------------------\n 1 file changed, 14 insertions(+), 23 deletions(-)", "diff": "diff --git a/src/libcamera/buffer.cpp b/src/libcamera/buffer.cpp\nindex 28b43d937f57..af5345b91195 100644\n--- a/src/libcamera/buffer.cpp\n+++ b/src/libcamera/buffer.cpp\n@@ -257,32 +257,23 @@ int FrameBuffer::copyFrom(const FrameBuffer *src)\n \t\t}\n \t}\n \n-\tfor (unsigned int i = 0; i < planes_.size(); i++) {\n-\t\tvoid *dstmem = mmap(nullptr, planes_[i].length, PROT_WRITE,\n-\t\t\t\t MAP_SHARED, planes_[i].fd.fd(), 0);\n+\tMappedFrameBuffer source(src, PROT_READ);\n+\tMappedFrameBuffer destination(this, PROT_WRITE);\n \n-\t\tif (dstmem == MAP_FAILED) {\n-\t\t\tLOG(Buffer, Error)\n-\t\t\t\t<< \"Failed to map destination plane \" << i;\n-\t\t\tmetadata_.status = FrameMetadata::FrameError;\n-\t\t\treturn -EINVAL;\n-\t\t}\n-\n-\t\tvoid *srcmem = mmap(nullptr, src->planes_[i].length, PROT_READ,\n-\t\t\t\t MAP_SHARED, src->planes_[i].fd.fd(), 0);\n-\n-\t\tif (srcmem == MAP_FAILED) {\n-\t\t\tmunmap(dstmem, planes_[i].length);\n-\t\t\tLOG(Buffer, Error)\n-\t\t\t\t<< \"Failed to map source plane \" << i;\n-\t\t\tmetadata_.status = FrameMetadata::FrameError;\n-\t\t\treturn -EINVAL;\n-\t\t}\n+\tif (!source.isValid()) {\n+\t\tLOG(Buffer, Error) << \"Failed to map source planes\";\n+\t\treturn -EINVAL;\n+\t}\n \n-\t\tmemcpy(dstmem, srcmem, src->planes_[i].length);\n+\tif (!destination.isValid()) {\n+\t\tLOG(Buffer, Error) << \"Failed to map destination planes\";\n+\t\treturn -EINVAL;\n+\t}\n \n-\t\tmunmap(srcmem, src->planes_[i].length);\n-\t\tmunmap(dstmem, planes_[i].length);\n+\tfor (unsigned int i = 0; i < planes_.size(); i++) {\n+\t\tmemcpy(destination.maps()[i].address,\n+\t\t source.maps()[i].address,\n+\t\t source.maps()[i].length);\n \t}\n \n \tmetadata_ = src->metadata_;\n", "prefixes": [ "libcamera-devel", "RFC", "2/8" ] }