summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorJacopo Mondi <jacopo@jmondi.org>2021-11-19 15:58:29 +0100
committerJacopo Mondi <jacopo@jmondi.org>2021-12-11 17:53:40 +0100
commit3fb3c0d7912987ad514b2b7dec56060358d89ded (patch)
tree8f2ff29b2a53f3d586255aca1cac8e7d84490d45 /include
parentf6b6f15b54c27c144629fec0a880c4f870815011 (diff)
libcamera: request: Add Request::Private::prepare()
Add a prepare() function to the Private Request representation. The prepare() function is used by the PipelineHandler class to prepare a Request to be queued to the hardware. The current implementation of prepare() handles the fences associated with the Framebuffers part of a Request. The function starts an event notifier for each of those and emits the Request::prepared signal when all fences have been signalled or an optional timeout has expired. The optional timeout allows to interrupt blocked waits and notify the Request as failed so that it can be cancelled. Signed-off-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'include')
-rw-r--r--include/libcamera/internal/request.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/include/libcamera/internal/request.h b/include/libcamera/internal/request.h
index 1340ffa2..1f249989 100644
--- a/include/libcamera/internal/request.h
+++ b/include/libcamera/internal/request.h
@@ -7,10 +7,17 @@
#ifndef __LIBCAMERA_INTERNAL_REQUEST_H__
#define __LIBCAMERA_INTERNAL_REQUEST_H__
+#include <chrono>
+#include <map>
#include <memory>
+#include <libcamera/base/event_notifier.h>
+#include <libcamera/base/timer.h>
+
#include <libcamera/request.h>
+using namespace std::chrono_literals;
+
namespace libcamera {
class Camera;
@@ -32,16 +39,25 @@ public:
void cancel();
void reuse();
+ void prepare(std::chrono::milliseconds timeout = 0ms);
+ Signal<> prepared;
+
private:
friend class PipelineHandler;
void doCancelRequest();
+ void emitPrepareCompleted();
+ void notifierActivated(FrameBuffer *buffer);
+ void timeout();
Camera *camera_;
bool cancelled_;
uint32_t sequence_ = 0;
+ bool prepared_ = false;
std::unordered_set<FrameBuffer *> pending_;
+ std::map<FrameBuffer *, std::unique_ptr<EventNotifier>> notifiers_;
+ std::unique_ptr<Timer> timer_;
};
} /* namespace libcamera */