<div dir="ltr"><div dir="ltr">Hi Kieran,<div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, 20 Apr 2021 at 14:07, Kieran Bingham <<a href="mailto:kieran.bingham@ideasonboard.com">kieran.bingham@ideasonboard.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">When the CIO2 returns a cancelled buffer, we will not queue buffers<br>
to the IMGU.<br>
<br>
These buffers should be explicitly marked as cancelled to ensure<br>
the application knows there is no valid metadata or frame data<br>
provided in the buffer.<br>
<br>
Provide a cancel() method on the FrameBuffer to allow explicitly<br>
cancelling a buffer.<br>
<br>
Signed-off-by: Kieran Bingham <<a href="mailto:kieran.bingham@ideasonboard.com" target="_blank">kieran.bingham@ideasonboard.com</a>><br>
---<br>
include/libcamera/buffer.h | 2 ++<br>
src/libcamera/buffer.cpp | 8 ++++++++<br>
src/libcamera/pipeline/ipu3/ipu3.cpp | 7 +++++--<br>
3 files changed, 15 insertions(+), 2 deletions(-)<br>
<br>
diff --git a/include/libcamera/buffer.h b/include/libcamera/buffer.h<br>
index 620f8a66f6a2..e0af00900409 100644<br>
--- a/include/libcamera/buffer.h<br>
+++ b/include/libcamera/buffer.h<br>
@@ -53,6 +53,8 @@ public:<br>
unsigned int cookie() const { return cookie_; }<br>
void setCookie(unsigned int cookie) { cookie_ = cookie; }<br>
<br>
+ void cancel() { metadata_.status = FrameMetadata::FrameCancelled; }<br>
+<br>
private:<br>
LIBCAMERA_DISABLE_COPY_AND_MOVE(FrameBuffer)<br>
<br>
diff --git a/src/libcamera/buffer.cpp b/src/libcamera/buffer.cpp<br>
index 75b2693281a7..7635226b9045 100644<br>
--- a/src/libcamera/buffer.cpp<br>
+++ b/src/libcamera/buffer.cpp<br>
@@ -226,6 +226,14 @@ FrameBuffer::FrameBuffer(const std::vector<Plane> &planes, unsigned int cookie)<br>
* core never modifies the buffer cookie.<br>
*/<br>
<br>
+/**<br>
+ * \fn FrameBuffer::cancel()<br>
+ * \brief Marks the buffer as cancelled<br>
+ *<br>
+ * If a buffer is not used by a request, it shall be marked as cancelled to<br>
+ * indicate that the metadata is invalid.<br>
+ */<br>
+<br>
/**<br>
* \class MappedBuffer<br>
* \brief Provide an interface to support managing memory mapped buffers<br>
diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp<br>
index 51446fcf5bc1..73306cea6b37 100644<br>
--- a/src/libcamera/pipeline/ipu3/ipu3.cpp<br>
+++ b/src/libcamera/pipeline/ipu3/ipu3.cpp<br>
@@ -1257,8 +1257,11 @@ void IPU3CameraData::cio2BufferReady(FrameBuffer *buffer)<br>
<br>
/* If the buffer is cancelled force a complete of the whole request. */<br>
if (buffer->metadata().status == FrameMetadata::FrameCancelled) {<br>
- for (auto it : request->buffers())<br>
- pipe_->completeBuffer(request, it.second);<br>
+ for (auto it : request->buffers()) {<br>
+ FrameBuffer *b = it.second;<br>
+ b->cancel();<br>
+ pipe_->completeBuffer(request, b);<br>
+ }<br></blockquote><div><br></div><div>Would you consider adding a Request::cancel() method to the API that pipeline</div><div>handlers can invoke to essentially perform the above logic? I found it a bit</div><div>confusing having to call completeBuffer on a cancelled buffer, and completeRequest</div><div>to complete cancelling the request if you see what I mean? This is probably a bit</div><div>more relevant to the Raspberry Pi pipeline handler where we queue up requests</div><div>if required.</div><div><br></div><div>Regards,</div><div>Naush</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
frameInfos_.remove(info);<br>
pipe_->completeRequest(request);<br>
-- <br>
2.25.1<br>
<br>
_______________________________________________<br>
libcamera-devel mailing list<br>
<a href="mailto:libcamera-devel@lists.libcamera.org" target="_blank">libcamera-devel@lists.libcamera.org</a><br>
<a href="https://lists.libcamera.org/listinfo/libcamera-devel" rel="noreferrer" target="_blank">https://lists.libcamera.org/listinfo/libcamera-devel</a><br>
</blockquote></div></div>