summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNiklas Söderlund <niklas.soderlund@ragnatech.se>2020-03-20 00:31:13 +0100
committerNiklas Söderlund <niklas.soderlund@ragnatech.se>2020-03-20 01:44:45 +0100
commita118b1a49110b43f4bff5616a5072ade41f8b684 (patch)
tree0d8013ca6a923b23d1111a6d2e81d795e600d728
parent1b8ac8473c948ee7f5956ea0a71ad264a4485db4 (diff)
libcamera: pipeline: rkisp1: Use correct buffer count when importing buffers
When folding buffer management with start/stop the wrong variable was passed to importBuffers() resulting in only one buffer being imported for the video node making capture impossible. Fix this by first renaming the confusingly named variable 'count' to 'ipaBufferId'. And then reusing the 'count' name for the buffer count. While at it remove the loop to find the maximum value of buffers from the single stream used by the pipeline. Once we add more stream this needs to be reworked anyhow so keep it simple for now. Fixes: 33fedea818e2b6a9 ("libcamera: pipeline_handler: Fold buffer management with start/stop") Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
-rw-r--r--src/libcamera/pipeline/rkisp1/rkisp1.cpp15
1 files changed, 6 insertions, 9 deletions
diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp
index 97bb4f72..ec54291d 100644
--- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp
+++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp
@@ -668,34 +668,31 @@ int PipelineHandlerRkISP1::exportFrameBuffers(Camera *camera, Stream *stream,
int PipelineHandlerRkISP1::allocateBuffers(Camera *camera)
{
RkISP1CameraData *data = cameraData(camera);
- unsigned int count = 1;
+ unsigned int count = data->stream_.configuration().bufferCount;
+ unsigned int ipaBufferId = 1;
int ret;
- unsigned int maxBuffers = 0;
- for (const Stream *s : camera->streams())
- maxBuffers = std::max(maxBuffers, s->configuration().bufferCount);
-
ret = video_->importBuffers(count);
if (ret < 0)
goto error;
- ret = param_->allocateBuffers(maxBuffers, &paramBuffers_);
+ ret = param_->allocateBuffers(count, &paramBuffers_);
if (ret < 0)
goto error;
- ret = stat_->allocateBuffers(maxBuffers, &statBuffers_);
+ ret = stat_->allocateBuffers(count, &statBuffers_);
if (ret < 0)
goto error;
for (std::unique_ptr<FrameBuffer> &buffer : paramBuffers_) {
- buffer->setCookie(count++);
+ buffer->setCookie(ipaBufferId++);
data->ipaBuffers_.push_back({ .id = buffer->cookie(),
.planes = buffer->planes() });
availableParamBuffers_.push(buffer.get());
}
for (std::unique_ptr<FrameBuffer> &buffer : statBuffers_) {
- buffer->setCookie(count++);
+ buffer->setCookie(ipaBufferId++);
data->ipaBuffers_.push_back({ .id = buffer->cookie(),
.planes = buffer->planes() });
availableStatBuffers_.push(buffer.get());