libcamera: fence: Introduce Fence

Introduce a Fence class which models a synchronization primitive that
allows to notify the availability of a resource.

The Fence is modeled as a wrapper of a UniqueFD instance where
read events are used to signal the Fence. The class can be later
extended to support additional signalling mechanisms.

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-15 19:01:56 +01:00
parent db37335ee0
commit 8ac8ecb1e1
4 changed files with 145 additions and 0 deletions
+31
View File
@@ -0,0 +1,31 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
/*
* Copyright (C) 2021, Google Inc.
*
* internal/fence.h - Synchronization fence
*/
#pragma once
#include <libcamera/base/class.h>
#include <libcamera/base/unique_fd.h>
namespace libcamera {
class Fence
{
public:
Fence(UniqueFD fd);
bool isValid() const { return fd_.isValid(); }
const UniqueFD &fd() const { return fd_; }
UniqueFD release() { return std::move(fd_); }
private:
LIBCAMERA_DISABLE_COPY_AND_MOVE(Fence)
UniqueFD fd_;
};
} /* namespace libcamera */
+1
View File
@@ -6,6 +6,7 @@ libcamera_public_headers = files([
'camera.h',
'camera_manager.h',
'controls.h',
'fence.h',
'framebuffer.h',
'framebuffer_allocator.h',
'geometry.h',