<div dir="ltr"><div dir="ltr">Hi Umang,<div><br></div><div>Thank you for your reviews!</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, 10 Nov 2021 at 18:35, Umang Jain <<a href="mailto:umang.jain@ideasonboard.com">umang.jain@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 11/10/21 3:38 PM, Naushir Patuck wrote:<br>
> If a stream is marked as external, double the number of V4L2BufferCache slots<br>
> that are allocated. This is to account for additional buffers that may be<br>
> allocated directly by the application.<br>
<br>
<br>
One clarification pleease, does this mean applications can still <br>
allocate more buffers on the fly (i.e. the count can increase in <br>
future), even after RPi pipeline-handler has started?<br></blockquote><div><br></div><div>My understanding is that the Android layer does exactly this.</div><div><br></div><div>As pointed out by Kieran, one issue is that we may not know</div><div>the exact number of buffers allocated by the application.  Hence</div><div>we need a mechanism where the buffer cache sizing might have</div><div>to become dynamic to account for additional buffers.  For now,</div><div>over allocating the slots in the cache will be sufficient.</div><div><br></div><div>Regards,</div><div>Naush</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>
> Signed-off-by: Naushir Patuck <<a href="mailto:naush@raspberrypi.com" target="_blank">naush@raspberrypi.com</a>><br>
<br>
Patch looks good so,<br>
<br>
Reviewed-by: Umang Jain <<a href="mailto:umang.jain@ideasonboard.com" target="_blank">umang.jain@ideasonboard.com</a>><br>
<br>
> ---<br>
>   src/libcamera/pipeline/raspberrypi/rpi_stream.cpp | 8 ++++++++<br>
>   1 file changed, 8 insertions(+)<br>
><br>
> diff --git a/src/libcamera/pipeline/raspberrypi/rpi_stream.cpp b/src/libcamera/pipeline/raspberrypi/rpi_stream.cpp<br>
> index b3265d0e8aab..67901936d6b6 100644<br>
> --- a/src/libcamera/pipeline/raspberrypi/rpi_stream.cpp<br>
> +++ b/src/libcamera/pipeline/raspberrypi/rpi_stream.cpp<br>
> @@ -107,6 +107,14 @@ int Stream::prepareBuffers(unsigned int count)<br>
>               count = bufferMap_.size();<br>
>       }<br>
>   <br>
> +     /*<br>
> +      * If this is an external stream, we must allocate slots for buffers that<br>
> +      * might be externally allocated. We have no indication of how many buffers<br>
> +      * may be used, so this might overallocate slots in the buffer cache.<br>
> +      */<br>
> +     if (isExternal())<br>
> +             count = count * 2;<br>
> +<br>
>       return dev_->importBuffers(count);<br>
>   }<br>
>   <br>
</blockquote></div></div>