Message ID | 20221014131846.27169-7-naush@raspberrypi.com |
---|---|
State | Superseded |
Headers | show |
Series |
|
Related | show |
Hi Naush Thanks for the patch. On Fri, 14 Oct 2022 at 14:19, Naushir Patuck via libcamera-devel <libcamera-devel@lists.libcamera.org> wrote: > > 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. > > Signed-off-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: David Plowman <david.plowman@raspberrypi.com> Thanks! David > --- > .../pipeline/raspberrypi/raspberrypi.cpp | 30 +++++++++---------- > 1 file changed, 15 insertions(+), 15 deletions(-) > > diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp > index fc674e4f5bdd..2aba0430c02e 100644 > --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp > +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp > @@ -1030,21 +1030,6 @@ int PipelineHandlerRPi::start(Camera *camera, const ControlList *controls) > RPiCameraData *data = cameraData(camera); > 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. */ > if (controls) > data->applyScalerCrop(*controls); > @@ -1061,6 +1046,21 @@ int PipelineHandlerRPi::start(Camera *camera, const ControlList *controls) > /* Configure the number of dropped frames required on startup. */ > 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. */ > ret = queueAllBuffers(camera); > if (ret) { > -- > 2.25.1 >
diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp index fc674e4f5bdd..2aba0430c02e 100644 --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp @@ -1030,21 +1030,6 @@ int PipelineHandlerRPi::start(Camera *camera, const ControlList *controls) RPiCameraData *data = cameraData(camera); 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. */ if (controls) data->applyScalerCrop(*controls); @@ -1061,6 +1046,21 @@ int PipelineHandlerRPi::start(Camera *camera, const ControlList *controls) /* Configure the number of dropped frames required on startup. */ 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. */ ret = queueAllBuffers(camera); if (ret) {
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. Signed-off-by: Naushir Patuck <naush@raspberrypi.com> --- .../pipeline/raspberrypi/raspberrypi.cpp | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-)