<div dir="ltr"><div dir="ltr">Hi Laurent,<div><br></div><div>Thank you for your feedback!</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, 13 Mar 2022 at 16:04, Laurent Pinchart <<a href="mailto:laurent.pinchart@ideasonboard.com">laurent.pinchart@ideasonboard.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi Naush,<br>
<br>
Thank you for the patch.<br>
<br>
On Mon, Mar 07, 2022 at 12:46:31PM +0000, Naushir Patuck via libcamera-devel wrote:<br>
> Add a flag to indicate a call to PipelineHandlerRPi::configure() has taken<br>
> place. This flag signals that buffer allocations need to be done on the next<br>
> call to PipelineHandlerRPi::start().<br>
> <br>
> Signed-off-by: Naushir Patuck <<a href="mailto:naush@raspberrypi.com" target="_blank">naush@raspberrypi.com</a>><br>
> ---<br>
> .../pipeline/raspberrypi/raspberrypi.cpp | 21 ++++++++++++-------<br>
> 1 file changed, 14 insertions(+), 7 deletions(-)<br>
> <br>
> diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp<br>
> index 8bb9fc429912..b17ffa235ac7 100644<br>
> --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp<br>
> +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp<br>
> @@ -185,7 +185,7 @@ public:<br>
> RPiCameraData(PipelineHandler *pipe)<br>
> : Camera::Private(pipe), state_(State::Stopped),<br>
> supportsFlips_(false), flipsAlterBayerOrder_(false),<br>
> - dropFrameCount_(0), ispOutputCount_(0)<br>
> + dropFrameCount_(0), reconfigured_(true), ispOutputCount_(0)<br>
<br>
Given that you can't start a camera without configuring it first, this<br>
could be initialized to false.<br></blockquote><div><br></div><div>I think the value of the flag here is correct, but perhaps my naming of the variable</div><div>needs to change. This flags tells the pipeline handler that we need to allocate</div><div>buffers before starting. So perhaps a rename to something like allocateBuffers_</div><div>might be more appropriate. </div><div><br></div><div>I'll change it in the next version.</div><div><br></div><div>Regards,</div><div>Naush</div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
> {<br>
> }<br>
> <br>
> @@ -284,6 +284,9 @@ public:<br>
> */<br>
> std::optional<int32_t> notifyGainsUnity_;<br>
> <br>
> + /* Has this camera been reconfigured? */<br>
> + bool reconfigured_;<br>
> +<br>
> private:<br>
> void checkRequestCompleted();<br>
> void fillRequestMetadata(const ControlList &bufferControls,<br>
> @@ -961,6 +964,7 @@ int PipelineHandlerRPi::configure(Camera *camera, CameraConfiguration *config)<br>
> << " on pad " << sinkPad->index();<br>
> }<br>
> <br>
> + data->reconfigured_ = true;<br>
> return ret;<br>
> }<br>
> <br>
> @@ -981,12 +985,15 @@ int PipelineHandlerRPi::start(Camera *camera, const ControlList *controls)<br>
> RPiCameraData *data = cameraData(camera);<br>
> int ret;<br>
> <br>
> - /* Allocate buffers for internal pipeline usage. */<br>
> - ret = prepareBuffers(camera);<br>
> - if (ret) {<br>
> - LOG(RPI, Error) << "Failed to allocate buffers";<br>
> - stop(camera);<br>
> - return ret;<br>
> + if (data->reconfigured_) {<br>
> + /* Allocate buffers for internal pipeline usage. */<br>
> + ret = prepareBuffers(camera);<br>
> + if (ret) {<br>
> + LOG(RPI, Error) << "Failed to allocate buffers";<br>
> + stop(camera);<br>
> + return ret;<br>
> + }<br>
> + data->reconfigured_ = false;<br>
> }<br>
> <br>
> /* Check if a ScalerCrop control was specified. */<br>
<br>
-- <br>
Regards,<br>
<br>
Laurent Pinchart<br>
</blockquote></div></div>