libcamera: request: Provide a sequence number
Provide a sequence number on Requests which are added by the pipeline handler. Each pipeline handler keeps a requestSequence per CameraData and increments everytime a request is queued on that camera. The sequence number is associated with the Request and can be utilised for assisting with debugging, and printing the queueing sequence of in flight requests. Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
This commit is contained in:
parent
dcc024760a
commit
d874b3e341
4 changed files with 27 additions and 3 deletions
|
@ -38,7 +38,7 @@ class CameraData
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit CameraData(PipelineHandler *pipe)
|
explicit CameraData(PipelineHandler *pipe)
|
||||||
: pipe_(pipe)
|
: pipe_(pipe), requestSequence_(0)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
virtual ~CameraData() = default;
|
virtual ~CameraData() = default;
|
||||||
|
@ -48,6 +48,8 @@ public:
|
||||||
ControlInfoMap controlInfo_;
|
ControlInfoMap controlInfo_;
|
||||||
ControlList properties_;
|
ControlList properties_;
|
||||||
|
|
||||||
|
uint32_t requestSequence_;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
LIBCAMERA_DISABLE_COPY(CameraData)
|
LIBCAMERA_DISABLE_COPY(CameraData)
|
||||||
};
|
};
|
||||||
|
|
|
@ -50,6 +50,7 @@ public:
|
||||||
int addBuffer(const Stream *stream, FrameBuffer *buffer);
|
int addBuffer(const Stream *stream, FrameBuffer *buffer);
|
||||||
FrameBuffer *findBuffer(const Stream *stream) const;
|
FrameBuffer *findBuffer(const Stream *stream) const;
|
||||||
|
|
||||||
|
uint32_t sequence() const { return sequence_; }
|
||||||
uint64_t cookie() const { return cookie_; }
|
uint64_t cookie() const { return cookie_; }
|
||||||
Status status() const { return status_; }
|
Status status() const { return status_; }
|
||||||
|
|
||||||
|
@ -71,6 +72,7 @@ private:
|
||||||
BufferMap bufferMap_;
|
BufferMap bufferMap_;
|
||||||
std::unordered_set<FrameBuffer *> pending_;
|
std::unordered_set<FrameBuffer *> pending_;
|
||||||
|
|
||||||
|
uint32_t sequence_;
|
||||||
const uint64_t cookie_;
|
const uint64_t cookie_;
|
||||||
Status status_;
|
Status status_;
|
||||||
bool cancelled_;
|
bool cancelled_;
|
||||||
|
|
|
@ -382,6 +382,8 @@ int PipelineHandler::queueRequest(Request *request)
|
||||||
CameraData *data = cameraData(camera);
|
CameraData *data = cameraData(camera);
|
||||||
data->queuedRequests_.push_back(request);
|
data->queuedRequests_.push_back(request);
|
||||||
|
|
||||||
|
request->sequence_ = data->requestSequence_++;
|
||||||
|
|
||||||
int ret = queueRequestDevice(camera, request);
|
int ret = queueRequestDevice(camera, request);
|
||||||
if (ret)
|
if (ret)
|
||||||
data->queuedRequests_.remove(request);
|
data->queuedRequests_.remove(request);
|
||||||
|
|
|
@ -72,8 +72,8 @@ LOG_DEFINE_CATEGORY(Request)
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
Request::Request(Camera *camera, uint64_t cookie)
|
Request::Request(Camera *camera, uint64_t cookie)
|
||||||
: camera_(camera), cookie_(cookie), status_(RequestPending),
|
: camera_(camera), sequence_(0), cookie_(cookie),
|
||||||
cancelled_(false)
|
status_(RequestPending), cancelled_(false)
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* \todo Should the Camera expose a validator instance, to avoid
|
* \todo Should the Camera expose a validator instance, to avoid
|
||||||
|
@ -126,6 +126,7 @@ void Request::reuse(ReuseFlag flags)
|
||||||
bufferMap_.clear();
|
bufferMap_.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sequence_ = 0;
|
||||||
status_ = RequestPending;
|
status_ = RequestPending;
|
||||||
cancelled_ = false;
|
cancelled_ = false;
|
||||||
|
|
||||||
|
@ -227,6 +228,23 @@ FrameBuffer *Request::findBuffer(const Stream *stream) const
|
||||||
* \return The metadata associated with the request
|
* \return The metadata associated with the request
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \fn Request::sequence()
|
||||||
|
* \brief Retrieve the sequence number for the request
|
||||||
|
*
|
||||||
|
* When requests are queued, they are given a sequential number to track the
|
||||||
|
* order in which requests are queued to a camera. This number counts all
|
||||||
|
* requests given to a camera through its lifetime, and is not reset to zero
|
||||||
|
* between camera stop/start sequences.
|
||||||
|
*
|
||||||
|
* It can be used to support debugging and identifying the flow of requests
|
||||||
|
* through a pipeline, but does not guarantee to represent the sequence number
|
||||||
|
* of any images in the stream. The sequence number is stored as an unsigned
|
||||||
|
* integer and will wrap when overflowed.
|
||||||
|
*
|
||||||
|
* \return The request sequence number
|
||||||
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \fn Request::cookie()
|
* \fn Request::cookie()
|
||||||
* \brief Retrieve the cookie set when the request was created
|
* \brief Retrieve the cookie set when the request was created
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue