{"id":9682,"url":"https://patchwork.libcamera.org/api/1.1/patches/9682/?format=json","web_url":"https://patchwork.libcamera.org/patch/9682/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20200921183205.2516132-1-niklas.soderlund@ragnatech.se>","date":"2020-09-21T18:32:05","name":"[libcamera-devel,RFC] libcamera: buffer: Remove copyFrom()","commit_ref":"f999ee85faacb097b7ce173a8704816e388dbfe9","pull_url":null,"state":"accepted","archived":false,"hash":"4bc545b14b02e5edafde0b5178248e327fd5c550","submitter":{"id":5,"url":"https://patchwork.libcamera.org/api/1.1/people/5/?format=json","name":"Niklas Söderlund","email":"niklas.soderlund@ragnatech.se"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/9682/mbox/","series":[{"id":1304,"url":"https://patchwork.libcamera.org/api/1.1/series/1304/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=1304","date":"2020-09-21T18:32:05","name":"[libcamera-devel,RFC] libcamera: buffer: Remove copyFrom()","version":1,"mbox":"https://patchwork.libcamera.org/series/1304/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/9682/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/9682/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 C7FADBF01C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 21 Sep 2020 18:32:13 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 514D962FD3;\n\tMon, 21 Sep 2020 20:32:13 +0200 (CEST)","from bin-mail-out-06.binero.net (bin-mail-out-06.binero.net\n\t[195.74.38.229])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 5E5AC62B90\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 21 Sep 2020 20:32:12 +0200 (CEST)","from bismarck.berto.se (p54ac52a8.dip0.t-ipconnect.de\n\t[84.172.82.168]) by bin-vsp-out-01.atm.binero.net (Halon) with ESMTPA\n\tid c01a0436-fc38-11ea-92dc-005056917a89;\n\tMon, 21 Sep 2020 20:32:10 +0200 (CEST)"],"X-Halon-ID":"c01a0436-fc38-11ea-92dc-005056917a89","Authorized-sender":"niklas.soderlund@fsdn.se","From":"=?utf-8?q?Niklas_S=C3=B6derlund?= <niklas.soderlund@ragnatech.se>","To":"libcamera-devel@lists.libcamera.org","Date":"Mon, 21 Sep 2020 20:32:05 +0200","Message-Id":"<20200921183205.2516132-1-niklas.soderlund@ragnatech.se>","X-Mailer":"git-send-email 2.28.0","MIME-Version":"1.0","Subject":"[libcamera-devel] [RFC] libcamera: buffer: Remove copyFrom()","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=\"utf-8\"","Content-Transfer-Encoding":"base64","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"There are no user left of the copyFrom() operation, remove it.\n\nSigned-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n---\n include/libcamera/buffer.h |  2 --\n src/libcamera/buffer.cpp   | 59 --------------------------------------\n 2 files changed, 61 deletions(-)\n---\n\nHello,\n\nI'm not sure it's wise to leave this operation in the code while we have \nno users. But I do fear we might need it the future, but as we don't use \nor test it I'm sure we will have modified FrameBuffer enough to make \nthis incomplete at that that so I think it's best to remove it. What do \nyou guys think?\n\nRegards\nNiklas","diff":"diff --git a/include/libcamera/buffer.h b/include/libcamera/buffer.h\nindex 6bb2e4f8558f03ac..a26c8927d37a812e 100644\n--- a/include/libcamera/buffer.h\n+++ b/include/libcamera/buffer.h\n@@ -57,8 +57,6 @@ public:\n \n \tunsigned int cookie() const { return cookie_; }\n \tvoid setCookie(unsigned int cookie) { cookie_ = cookie; }\n-\n-\tint copyFrom(const FrameBuffer *src);\n private:\n \tfriend class Request; /* Needed to update request_. */\n \tfriend class V4L2VideoDevice; /* Needed to update metadata_. */\ndiff --git a/src/libcamera/buffer.cpp b/src/libcamera/buffer.cpp\nindex 03f628e8b585a1f9..75b2693281a74cdc 100644\n--- a/src/libcamera/buffer.cpp\n+++ b/src/libcamera/buffer.cpp\n@@ -226,65 +226,6 @@ FrameBuffer::FrameBuffer(const std::vector<Plane> &planes, unsigned int cookie)\n  * core never modifies the buffer cookie.\n  */\n \n-/**\n- * \\brief Copy the contents from another buffer\n- * \\param[in] src FrameBuffer to copy\n- *\n- * Copy the buffer contents and metadata from \\a src to this buffer. The\n- * destination FrameBuffer shall have the same number of planes as the source\n- * buffer, and each destination plane shall be larger than or equal to the\n- * corresponding source plane.\n- *\n- * The complete metadata of the source buffer is copied to the destination\n- * buffer. If an error occurs during the copy, the destination buffer's metadata\n- * status is set to FrameMetadata::FrameError, and other metadata fields are not\n- * modified.\n- *\n- * The operation is performed using memcpy() so is very slow, users needs to\n- * consider this before copying buffers.\n- *\n- * \\return 0 on success or a negative error code otherwise\n- */\n-int FrameBuffer::copyFrom(const FrameBuffer *src)\n-{\n-\tif (planes_.size() != src->planes_.size()) {\n-\t\tLOG(Buffer, Error) << \"Different number of planes\";\n-\t\tmetadata_.status = FrameMetadata::FrameError;\n-\t\treturn -EINVAL;\n-\t}\n-\n-\tfor (unsigned int i = 0; i < planes_.size(); i++) {\n-\t\tif (planes_[i].length < src->planes_[i].length) {\n-\t\t\tLOG(Buffer, Error) << \"Plane \" << i << \" is too small\";\n-\t\t\tmetadata_.status = FrameMetadata::FrameError;\n-\t\t\treturn -EINVAL;\n-\t\t}\n-\t}\n-\n-\tMappedFrameBuffer source(src, PROT_READ);\n-\tMappedFrameBuffer destination(this, PROT_WRITE);\n-\n-\tif (!source.isValid()) {\n-\t\tLOG(Buffer, Error) << \"Failed to map source planes\";\n-\t\treturn -EINVAL;\n-\t}\n-\n-\tif (!destination.isValid()) {\n-\t\tLOG(Buffer, Error) << \"Failed to map destination planes\";\n-\t\treturn -EINVAL;\n-\t}\n-\n-\tfor (unsigned int i = 0; i < planes_.size(); i++) {\n-\t\tmemcpy(destination.maps()[i].data(),\n-\t\t       source.maps()[i].data(),\n-\t\t       source.maps()[i].size());\n-\t}\n-\n-\tmetadata_ = src->metadata_;\n-\n-\treturn 0;\n-}\n-\n /**\n  * \\class MappedBuffer\n  * \\brief Provide an interface to support managing memory mapped buffers\n","prefixes":["libcamera-devel","RFC"]}