summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKieran Bingham <kieran.bingham@ideasonboard.com>2021-03-10 17:44:42 +0000
committerKieran Bingham <kieran.bingham@ideasonboard.com>2021-03-29 12:18:02 +0100
commitd874b3e34173811fa89b68b4b71f22182bc5fd98 (patch)
tree585f2e4edc1e7880d5364ff9cde00dc7214428cc /src
parentdcc024760a8d4eb35b7d0ca285f566bb1b3e773b (diff)
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>
Diffstat (limited to 'src')
-rw-r--r--src/libcamera/pipeline_handler.cpp2
-rw-r--r--src/libcamera/request.cpp22
2 files changed, 22 insertions, 2 deletions
diff --git a/src/libcamera/pipeline_handler.cpp b/src/libcamera/pipeline_handler.cpp
index d22991d3..e3d4975d 100644
--- a/src/libcamera/pipeline_handler.cpp
+++ b/src/libcamera/pipeline_handler.cpp
@@ -382,6 +382,8 @@ int PipelineHandler::queueRequest(Request *request)
CameraData *data = cameraData(camera);
data->queuedRequests_.push_back(request);
+ request->sequence_ = data->requestSequence_++;
+
int ret = queueRequestDevice(camera, request);
if (ret)
data->queuedRequests_.remove(request);
diff --git a/src/libcamera/request.cpp b/src/libcamera/request.cpp
index 3ad83f3b..5280b68c 100644
--- a/src/libcamera/request.cpp
+++ b/src/libcamera/request.cpp
@@ -72,8 +72,8 @@ LOG_DEFINE_CATEGORY(Request)
*
*/
Request::Request(Camera *camera, uint64_t cookie)
- : camera_(camera), cookie_(cookie), status_(RequestPending),
- cancelled_(false)
+ : camera_(camera), sequence_(0), cookie_(cookie),
+ status_(RequestPending), cancelled_(false)
{
/**
* \todo Should the Camera expose a validator instance, to avoid
@@ -126,6 +126,7 @@ void Request::reuse(ReuseFlag flags)
bufferMap_.clear();
}
+ sequence_ = 0;
status_ = RequestPending;
cancelled_ = false;
@@ -228,6 +229,23 @@ FrameBuffer *Request::findBuffer(const Stream *stream) const
*/
/**
+ * \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()
* \brief Retrieve the cookie set when the request was created
* \return The request cookie