pipeline: raspberrypi: Reorder startup drop frame initialisation

Reorder the code such that the IPA requested startup drop frames count is
available before the pipeline handler allocates any stream buffers.

This will be used in a subsequent change to stop Unicam buffer allocations if
there are no startup drop frames required and the application has configured a
raw stream and always provides buffers for it.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
This commit is contained in:
Naushir Patuck 2023-01-27 15:43:11 +00:00 committed by Kieran Bingham
parent 375bc787f4
commit 8b267c24a0

View file

@ -1101,21 +1101,6 @@ int PipelineHandlerRPi::start(Camera *camera, const ControlList *controls)
RPiCameraData *data = cameraData(camera); RPiCameraData *data = cameraData(camera);
int ret; int ret;
for (auto const stream : data->streams_)
stream->resetBuffers();
if (!data->buffersAllocated_) {
/* Allocate buffers for internal pipeline usage. */
ret = prepareBuffers(camera);
if (ret) {
LOG(RPI, Error) << "Failed to allocate buffers";
data->freeBuffers();
stop(camera);
return ret;
}
data->buffersAllocated_ = true;
}
/* Check if a ScalerCrop control was specified. */ /* Check if a ScalerCrop control was specified. */
if (controls) if (controls)
data->applyScalerCrop(*controls); data->applyScalerCrop(*controls);
@ -1132,6 +1117,21 @@ int PipelineHandlerRPi::start(Camera *camera, const ControlList *controls)
/* Configure the number of dropped frames required on startup. */ /* Configure the number of dropped frames required on startup. */
data->dropFrameCount_ = startConfig.dropFrameCount; data->dropFrameCount_ = startConfig.dropFrameCount;
for (auto const stream : data->streams_)
stream->resetBuffers();
if (!data->buffersAllocated_) {
/* Allocate buffers for internal pipeline usage. */
ret = prepareBuffers(camera);
if (ret) {
LOG(RPI, Error) << "Failed to allocate buffers";
data->freeBuffers();
stop(camera);
return ret;
}
data->buffersAllocated_ = true;
}
/* We need to set the dropFrameCount_ before queueing buffers. */ /* We need to set the dropFrameCount_ before queueing buffers. */
ret = queueAllBuffers(camera); ret = queueAllBuffers(camera);
if (ret) { if (ret) {