From 7a34707bfdf1f5c855ce506245cc57eeae52dfff Mon Sep 17 00:00:00 2001 From: Jacopo Mondi Date: Tue, 16 Nov 2021 14:18:40 +0100 Subject: libcamera: framebuffer: Add Fence to FrameBuffer Add to the FrameBuffer::Private class a unique pointer to a Fence. The Fence will be used to signal the availability of the Framebuffer for incoming data transfer. The Fence will be associated to a FrameBuffer at Request::addBuffer() time, and if correctly signalled, reset by the core at Request queue time. If a FrameBuffer completes with errors, due to a Fence wait failure, the Fence will still be owned by the FrameBuffer and it is application responsibility to correctly reset it before reusing the buffer. Signed-off-by: Jacopo Mondi Reviewed-by: Laurent Pinchart --- include/libcamera/framebuffer.h | 4 ++++ include/libcamera/internal/framebuffer.h | 8 ++++++++ 2 files changed, 12 insertions(+) (limited to 'include/libcamera') diff --git a/include/libcamera/framebuffer.h b/include/libcamera/framebuffer.h index 502f7897..de172d97 100644 --- a/include/libcamera/framebuffer.h +++ b/include/libcamera/framebuffer.h @@ -9,6 +9,7 @@ #include #include +#include #include #include @@ -18,6 +19,7 @@ namespace libcamera { +class Fence; class Request; struct FrameMetadata { @@ -67,6 +69,8 @@ public: unsigned int cookie() const { return cookie_; } void setCookie(unsigned int cookie) { cookie_ = cookie; } + std::unique_ptr releaseFence(); + void cancel() { metadata_.status = FrameMetadata::FrameCancelled; } private: diff --git a/include/libcamera/internal/framebuffer.h b/include/libcamera/internal/framebuffer.h index 6e0d8389..97dca963 100644 --- a/include/libcamera/internal/framebuffer.h +++ b/include/libcamera/internal/framebuffer.h @@ -7,8 +7,12 @@ #pragma once +#include +#include + #include +#include #include namespace libcamera { @@ -24,7 +28,11 @@ public: void setRequest(Request *request) { request_ = request; } bool isContiguous() const { return isContiguous_; } + Fence *fence() const { return fence_.get(); } + void setFence(std::unique_ptr fence) { fence_ = std::move(fence); } + private: + std::unique_ptr fence_; Request *request_; bool isContiguous_; }; -- cgit v1.2.1