From f999ee85faacb097b7ce173a8704816e388dbfe9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niklas=20S=C3=B6derlund?= Date: Mon, 21 Sep 2020 20:24:36 +0200 Subject: libcamera: buffer: Remove copyFrom() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit There are no user left of the copyFrom() operation, remove it. Signed-off-by: Niklas Söderlund Reviewed-by: Laurent Pinchart Reviewed-by: Kieran Bingham --- src/libcamera/buffer.cpp | 59 ------------------------------------------------ 1 file changed, 59 deletions(-) (limited to 'src') diff --git a/src/libcamera/buffer.cpp b/src/libcamera/buffer.cpp index 03f628e8..75b26932 100644 --- a/src/libcamera/buffer.cpp +++ b/src/libcamera/buffer.cpp @@ -226,65 +226,6 @@ FrameBuffer::FrameBuffer(const std::vector &planes, unsigned int cookie) * core never modifies the buffer cookie. */ -/** - * \brief Copy the contents from another buffer - * \param[in] src FrameBuffer to copy - * - * Copy the buffer contents and metadata from \a src to this buffer. The - * destination FrameBuffer shall have the same number of planes as the source - * buffer, and each destination plane shall be larger than or equal to the - * corresponding source plane. - * - * The complete metadata of the source buffer is copied to the destination - * buffer. If an error occurs during the copy, the destination buffer's metadata - * status is set to FrameMetadata::FrameError, and other metadata fields are not - * modified. - * - * The operation is performed using memcpy() so is very slow, users needs to - * consider this before copying buffers. - * - * \return 0 on success or a negative error code otherwise - */ -int FrameBuffer::copyFrom(const FrameBuffer *src) -{ - if (planes_.size() != src->planes_.size()) { - LOG(Buffer, Error) << "Different number of planes"; - metadata_.status = FrameMetadata::FrameError; - return -EINVAL; - } - - for (unsigned int i = 0; i < planes_.size(); i++) { - if (planes_[i].length < src->planes_[i].length) { - LOG(Buffer, Error) << "Plane " << i << " is too small"; - metadata_.status = FrameMetadata::FrameError; - return -EINVAL; - } - } - - MappedFrameBuffer source(src, PROT_READ); - MappedFrameBuffer destination(this, PROT_WRITE); - - if (!source.isValid()) { - LOG(Buffer, Error) << "Failed to map source planes"; - return -EINVAL; - } - - if (!destination.isValid()) { - LOG(Buffer, Error) << "Failed to map destination planes"; - return -EINVAL; - } - - for (unsigned int i = 0; i < planes_.size(); i++) { - memcpy(destination.maps()[i].data(), - source.maps()[i].data(), - source.maps()[i].size()); - } - - metadata_ = src->metadata_; - - return 0; -} - /** * \class MappedBuffer * \brief Provide an interface to support managing memory mapped buffers -- cgit v1.2.1