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: 33fedea818 ("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>
This commit is contained in:
Niklas Söderlund
2020-03-20 01:44:45 +01:00
parent 1b8ac8473c
commit a118b1a491
+6 -9
View File
@@ -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());