summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKieran Bingham <kieran.bingham@ideasonboard.com>2021-03-24 16:21:46 +0000
committerKieran Bingham <kieran.bingham@ideasonboard.com>2021-04-22 16:56:07 +0100
commit883334135bb2e84b9ba9daec5a4b844b92ead897 (patch)
treef5879f2cac55d73203242281d7eca1e0dc1e2121 /src
parent0abed6484302e5dbb36f3c8e2e02c8b1f0437717 (diff)
libcamera: pipeline: ipu3: Cancel unused buffers
When the CIO2 returns a cancelled buffer, we will not queue buffers to the IMGU. These buffers should be explicitly marked as cancelled to ensure the application knows there is no valid metadata or frame data provided in the buffer. Provide a cancel() method on the FrameBuffer to allow explicitly cancelling a buffer. Reviewed-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com> Reviewed-by: Hirokazu Honda <hiroh@chromium.org> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Diffstat (limited to 'src')
-rw-r--r--src/libcamera/buffer.cpp8
-rw-r--r--src/libcamera/pipeline/ipu3/ipu3.cpp7
2 files changed, 13 insertions, 2 deletions
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);