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 <jacopo@jmondi.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
This commit is contained in:
Jacopo Mondi 2021-11-16 14:18:40 +01:00
parent 8ac8ecb1e1
commit 7a34707bfd
3 changed files with 70 additions and 0 deletions

View file

@ -9,6 +9,7 @@
#include <assert.h>
#include <limits>
#include <memory>
#include <stdint.h>
#include <vector>
@ -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<Fence> releaseFence();
void cancel() { metadata_.status = FrameMetadata::FrameCancelled; }
private: