<div dir="ltr"><div dir="ltr">Hi David,<div><br></div><div>Thank you for the patch!</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, 9 Nov 2022 at 10:16, David Plowman via libcamera-devel <<a href="mailto:libcamera-devel@lists.libcamera.org">libcamera-devel@lists.libcamera.org</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">This reverts commit 30d704732badc675f72fe73d14749669cb645c23.<br>
<br>
It turns out that this commit causes some regressions and is in fact<br>
unnecessary because the related commit "libcamera: v4l2_videodevice:<br>
Guard against releasing unallocated buffers"<br>
(a2bdff6d0b67475492ac7cf9318866b6d89a28fd) fixes the problem<br>
completely (if the buffers were never allocated, the video device<br>
avoids trying to free them even if the pipeline handler asks).<br>
<br>
The reason for the regressions is that in this new (broken) scheme we<br>
would never call clearBuffers() on all the streams if the internal<br>
buffers were never allocated (i.e. buffersAllocated_ is never<br>
set). This causes the stream's bufferMap_ list to get longer and<br>
longer if there are multiple back-to-back calls to configure, and<br>
dev_->importBuffers() will ultimately to fail.<br>
<br>
So either we need to think more carefully about how to stop the<br>
pipeline handler from freeing buffers that it doesn't own, or we just<br>
leave it as the other commit resolves the problem on its own. In the<br>
interim, simply reverting this commit certainly seems like the best<br>
solution.<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>Probably worth adding a Fixes tag here.</div><div><br></div><div>Reviewed-by: Naushir Patuck <<a href="mailto:naush@raspberrypi.com">naush@raspberrypi.com</a>></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>
 src/libcamera/pipeline/raspberrypi/raspberrypi.cpp | 3 ---<br>
 1 file changed, 3 deletions(-)<br>
<br>
diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp<br>
index 1b599fcc..343f8cb2 100644<br>
--- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp<br>
+++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp<br>
@@ -1506,9 +1506,6 @@ void PipelineHandlerRPi::mapBuffers(Camera *camera, const RPi::BufferMap &buffer<br>
<br>
 void RPiCameraData::freeBuffers()<br>
 {<br>
-       if (!buffersAllocated_)<br>
-               return;<br>
-<br>
        if (ipa_) {<br>
                /*<br>
                 * Copy the buffer ids from the unordered_set to a vector to<br>
-- <br>
2.30.2<br>
<br>
</blockquote></div></div>