diff options
author | Niklas Söderlund <niklas.soderlund@ragnatech.se> | 2020-03-20 00:31:13 +0100 |
---|---|---|
committer | Niklas Söderlund <niklas.soderlund@ragnatech.se> | 2020-03-20 01:44:45 +0100 |
commit | a118b1a49110b43f4bff5616a5072ade41f8b684 (patch) | |
tree | 0d8013ca6a923b23d1111a6d2e81d795e600d728 /src | |
parent | 1b8ac8473c948ee7f5956ea0a71ad264a4485db4 (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>
Diffstat (limited to 'src')
-rw-r--r-- | src/libcamera/pipeline/rkisp1/rkisp1.cpp | 15 |
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, ¶mBuffers_); + ret = param_->allocateBuffers(count, ¶mBuffers_); 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()); |