diff options
-rw-r--r-- | include/libcamera/buffer.h | 2 | ||||
-rw-r--r-- | src/libcamera/buffer.cpp | 8 | ||||
-rw-r--r-- | src/libcamera/pipeline/ipu3/ipu3.cpp | 7 |
3 files changed, 15 insertions, 2 deletions
diff --git a/include/libcamera/buffer.h b/include/libcamera/buffer.h index 620f8a66..e0af0090 100644 --- a/include/libcamera/buffer.h +++ b/include/libcamera/buffer.h @@ -53,6 +53,8 @@ public: unsigned int cookie() const { return cookie_; } void setCookie(unsigned int cookie) { cookie_ = cookie; } + void cancel() { metadata_.status = FrameMetadata::FrameCancelled; } + private: LIBCAMERA_DISABLE_COPY_AND_MOVE(FrameBuffer) diff --git a/src/libcamera/buffer.cpp b/src/libcamera/buffer.cpp index 75b26932..7635226b 100644 --- a/src/libcamera/buffer.cpp +++ b/src/libcamera/buffer.cpp @@ -227,6 +227,14 @@ FrameBuffer::FrameBuffer(const std::vector<Plane> &planes, unsigned int cookie) */ /** + * \fn FrameBuffer::cancel() + * \brief Marks the buffer as cancelled + * + * If a buffer is not used by a request, it shall be marked as cancelled to + * indicate that the metadata is invalid. + */ + +/** * \class MappedBuffer * \brief Provide an interface to support managing memory mapped buffers * diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp index 51446fcf..73306cea 100644 --- a/src/libcamera/pipeline/ipu3/ipu3.cpp +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp @@ -1257,8 +1257,11 @@ void IPU3CameraData::cio2BufferReady(FrameBuffer *buffer) /* If the buffer is cancelled force a complete of the whole request. */ if (buffer->metadata().status == FrameMetadata::FrameCancelled) { - for (auto it : request->buffers()) - pipe_->completeBuffer(request, it.second); + for (auto it : request->buffers()) { + FrameBuffer *b = it.second; + b->cancel(); + pipe_->completeBuffer(request, b); + } frameInfos_.remove(info); pipe_->completeRequest(request); |