summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMilan Zamazal <mzamazal@redhat.com>2024-11-06 21:17:20 +0100
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2024-11-08 03:45:49 +0200
commit2cc52d68352b9729c8c285805bcbe8313e505ddb (patch)
tree8f0c2d114a82ace904510681a1cb3637ff06ead5 /src
parentfe68cd0d7d504f9edb7fd98d9888f10fb21aeb13 (diff)
libcamera: simple: Track requests in conversionQueue_
Simple pipeline retrieves the requests to complete from the conversionQueue_. This patch stores the requests in conversionQueue_ explicitly. This explicit tracking is supposed to be preferred to implicit retrieval and it simplifies the completion code a bit here and in the followup patch that adds request cleanup on stop. The change as implemented assumes that all the buffers in each of the conversionQueue_ elements point to the same request, the one specified. Signed-off-by: Milan Zamazal <mzamazal@redhat.com> Tested-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Hans de Goede <hdegoede@redhat.com> Tested-by: Stanislaw Gruszka <stanislaw.gruszka@linux.intel.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'src')
-rw-r--r--src/libcamera/pipeline/simple/simple.cpp26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp
index 67f583b8..13c0a189 100644
--- a/src/libcamera/pipeline/simple/simple.cpp
+++ b/src/libcamera/pipeline/simple/simple.cpp
@@ -282,7 +282,11 @@ public:
std::unique_ptr<DelayedControls> delayedCtrls_;
std::vector<std::unique_ptr<FrameBuffer>> conversionBuffers_;
- std::queue<std::map<const Stream *, FrameBuffer *>> conversionQueue_;
+ struct RequestOutputs {
+ Request *request;
+ std::map<const Stream *, FrameBuffer *> outputs;
+ };
+ std::queue<RequestOutputs> conversionQueue_;
bool useConversion_;
std::unique_ptr<Converter> converter_;
@@ -808,16 +812,12 @@ void SimpleCameraData::bufferReady(FrameBuffer *buffer)
if (conversionQueue_.empty())
return;
- Request *request = nullptr;
- for (auto &item : conversionQueue_.front()) {
- FrameBuffer *outputBuffer = item.second;
- request = outputBuffer->request();
- pipe->completeBuffer(request, outputBuffer);
- }
+ const RequestOutputs &outputs = conversionQueue_.front();
+ for (auto &[stream, buf] : outputs.outputs)
+ pipe->completeBuffer(outputs.request, buf);
+ pipe->completeRequest(outputs.request);
conversionQueue_.pop();
- if (request)
- pipe->completeRequest(request);
return;
}
@@ -833,7 +833,7 @@ void SimpleCameraData::bufferReady(FrameBuffer *buffer)
if (useConversion_ && !conversionQueue_.empty()) {
const std::map<const Stream *, FrameBuffer *> &outputs =
- conversionQueue_.front();
+ conversionQueue_.front().outputs;
if (!outputs.empty()) {
FrameBuffer *outputBuffer = outputs.begin()->second;
if (outputBuffer)
@@ -857,7 +857,7 @@ void SimpleCameraData::bufferReady(FrameBuffer *buffer)
}
if (converter_)
- converter_->queueBuffers(buffer, conversionQueue_.front());
+ converter_->queueBuffers(buffer, conversionQueue_.front().outputs);
else
/*
* request->sequence() cannot be retrieved from `buffer' inside
@@ -865,7 +865,7 @@ void SimpleCameraData::bufferReady(FrameBuffer *buffer)
* already here.
*/
swIsp_->queueBuffers(request->sequence(), buffer,
- conversionQueue_.front());
+ conversionQueue_.front().outputs);
conversionQueue_.pop();
return;
@@ -1429,7 +1429,7 @@ int SimplePipelineHandler::queueRequestDevice(Camera *camera, Request *request)
}
if (data->useConversion_) {
- data->conversionQueue_.push(std::move(buffers));
+ data->conversionQueue_.push({ request, std::move(buffers) });
if (data->swIsp_)
data->swIsp_->queueRequest(request->sequence(), request->controls());
}