summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNiklas Söderlund <niklas.soderlund@ragnatech.se>2020-09-21 20:24:36 +0200
committerNiklas Söderlund <niklas.soderlund@ragnatech.se>2020-09-22 12:06:09 +0200
commitf999ee85faacb097b7ce173a8704816e388dbfe9 (patch)
treed05f914bc88f392adf87774c5998012057725e7d
parent39798e8777b553ed9ae9863da02e16e417d8307e (diff)
libcamera: buffer: Remove copyFrom()
There are no user left of the copyFrom() operation, remove it. Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
-rw-r--r--include/libcamera/buffer.h2
-rw-r--r--src/libcamera/buffer.cpp59
2 files changed, 0 insertions, 61 deletions
diff --git a/include/libcamera/buffer.h b/include/libcamera/buffer.h
index 6bb2e4f8..a26c8927 100644
--- a/include/libcamera/buffer.h
+++ b/include/libcamera/buffer.h
@@ -57,8 +57,6 @@ public:
unsigned int cookie() const { return cookie_; }
void setCookie(unsigned int cookie) { cookie_ = cookie; }
-
- int copyFrom(const FrameBuffer *src);
private:
friend class Request; /* Needed to update request_. */
friend class V4L2VideoDevice; /* Needed to update metadata_. */
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
@@ -227,65 +227,6 @@ FrameBuffer::FrameBuffer(const std::vector<Plane> &planes, unsigned int 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
*