mirror of
https://git.libcamera.org/libcamera/libcamera.git
synced 2025-07-24 17:15:07 +03:00
libcamera: Handle request completion explicitly in pipeline handlers
Request complete by themselves when all the buffers they contain have completed, connecting the buffer's completed signal to be notified of buffer completion. While this works for now, it prevents pipelines from delaying request completion until all metadata is available, and makes it impossible to ensure that requests complete in the order they are queued. To fix this, make request completion handling explicit in pipeline handlers. The base PipelineHandler class is extended with implementations of the queueRequest() and stop() methods and gets new completeBuffer() and completeRequest() methods to help pipeline handlers tracking requests and buffers. The three existing pipeline handlers connect the bufferReady signal of their capture video node to a slot of their respective camera data instance, where they use the PipelineHandler helpers to notify buffer and request completion. Request completion is handled synchronously with buffer completion as the pipeline handlers don't need to support more advanced use cases, but this paves the road for future work. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
This commit is contained in:
parent
1accc258cc
commit
b2c06cf409
12 changed files with 194 additions and 38 deletions
|
@ -10,8 +10,6 @@
|
|||
#include <stdint.h>
|
||||
#include <vector>
|
||||
|
||||
#include <libcamera/signal.h>
|
||||
|
||||
namespace libcamera {
|
||||
|
||||
class BufferPool;
|
||||
|
@ -55,10 +53,9 @@ public:
|
|||
Status status() const { return status_; }
|
||||
std::vector<Plane> &planes() { return planes_; }
|
||||
|
||||
Signal<Buffer *> completed;
|
||||
|
||||
private:
|
||||
friend class BufferPool;
|
||||
friend class PipelineHandler;
|
||||
friend class V4L2Device;
|
||||
|
||||
void cancel();
|
||||
|
|
|
@ -35,6 +35,7 @@ public:
|
|||
|
||||
const std::string &name() const;
|
||||
|
||||
Signal<Request *, Buffer *> bufferCompleted;
|
||||
Signal<Request *, const std::map<Stream *, Buffer *> &> requestCompleted;
|
||||
Signal<Camera *> disconnected;
|
||||
|
||||
|
@ -73,6 +74,8 @@ private:
|
|||
friend class PipelineHandler;
|
||||
void disconnect();
|
||||
|
||||
void requestComplete(Request *request);
|
||||
|
||||
std::shared_ptr<PipelineHandler> pipe_;
|
||||
std::string name_;
|
||||
std::set<Stream *> streams_;
|
||||
|
|
|
@ -39,10 +39,12 @@ public:
|
|||
|
||||
private:
|
||||
friend class Camera;
|
||||
friend class PipelineHandler;
|
||||
|
||||
int prepare();
|
||||
void complete(Status status);
|
||||
void bufferCompleted(Buffer *buffer);
|
||||
|
||||
bool completeBuffer(Buffer *buffer);
|
||||
|
||||
Camera *camera_;
|
||||
std::map<Stream *, Buffer *> bufferMap_;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue