<div dir="ltr"><div dir="ltr">Hi David,<div><br></div><div>Thank you for your patch.</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, 30 Nov 2021 at 11:23, David Plowman <<a href="mailto:david.plowman@raspberrypi.com">david.plowman@raspberrypi.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">The code was reducing the number of raw stream buffers allocated when<br>
the application is providing some of its own. However, it was not<br>
taking account of the fact that the application cannot supply embedded<br>
data buffers, so it must always allocate a reasonable minimum number<br>
of these buffers (possibly more than the number of raw stream buffers)<br>
to prevent frame drops.<br>
<br>
Signed-off-by: David Plowman <<a href="mailto:david.plowman@raspberrypi.com" target="_blank">david.plowman@raspberrypi.com</a>><br></blockquote><div><br></div><div>Reviewed-by: Naushir Patuck <<a href="mailto:naush@raspberrypi.com">naush@raspberrypi.com</a>> </div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
---<br>
.../pipeline/raspberrypi/raspberrypi.cpp | 25 ++++++++++++-------<br>
1 file changed, 16 insertions(+), 9 deletions(-)<br>
<br>
diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp<br>
index e31fa3b2..045725dd 100644<br>
--- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp<br>
+++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp<br>
@@ -1248,18 +1248,25 @@ int PipelineHandlerRPi::prepareBuffers(Camera *camera)<br>
/* Decide how many internal buffers to allocate. */<br>
for (auto const stream : data->streams_) {<br>
unsigned int numBuffers;<br>
-<br>
- if (stream == &data->unicam_[Unicam::Image] ||<br>
- stream == &data->unicam_[Unicam::Embedded]) {<br>
+ /*<br>
+ * For Unicam, allocate a minimum of 4 buffers as we want<br>
+ * to avoid any frame drops.<br>
+ */<br>
+ constexpr unsigned int minBuffers = 4;<br>
+ if (stream == &data->unicam_[Unicam::Image]) {<br>
/*<br>
- * For Unicam, allocate a minimum of 4 buffers as we want<br>
- * to avoid any frame drops. If an application has configured<br>
- * a RAW stream, allocate additional buffers to make up the<br>
- * minimum, but ensure we have at least 2 sets of internal<br>
- * buffers to use to minimise frame drops.<br>
+ * If an application has configured a RAW stream, allocate<br>
+ * additional buffers to make up the minimum, but ensure<br>
+ * we have at least 2 sets of internal buffers to use to<br>
+ * minimise frame drops.<br>
*/<br>
- constexpr unsigned int minBuffers = 4;<br>
numBuffers = std::max<int>(2, minBuffers - numRawBuffers);<br>
+ } else if (stream == &data->unicam_[Unicam::Embedded]) {<br>
+ /*<br>
+ * Embedded data buffers are (currently) for internal use,<br>
+ * so allocate the minimum required to avoid frame drops.<br>
+ */<br>
+ numBuffers = minBuffers;<br>
} else {<br>
/*<br>
* Since the ISP runs synchronous with the IPA and requests,<br>
-- <br>
2.30.2<br>
<br>
</blockquote></div></div>