From 883334135bb2e84b9ba9daec5a4b844b92ead897 Mon Sep 17 00:00:00 2001
From: Kieran Bingham <kieran.bingham@ideasonboard.com>
Date: Wed, 24 Mar 2021 16:21:46 +0000
Subject: 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>
---
 include/libcamera/buffer.h | 2 ++
 1 file changed, 2 insertions(+)

(limited to 'include')

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)
 
-- 
cgit v1.2.1