summaryrefslogtreecommitdiff
path: root/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
diff options
context:
space:
mode:
authorNaushir Patuck <naush@raspberrypi.com>2022-02-01 09:27:38 +0000
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2022-02-01 14:20:37 +0200
commite96d02015c3a2322ad0335b969d9cb6ee83e83d0 (patch)
treecac0f409e0cdeafd631feedcd3cb1c36e12953ae /src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
parent355f4145b87e9fcbdd908fc65d2ef8b9f0d7ddf1 (diff)
pipeline: raspberrypi: Fix the buffer count calculation for the ISP input stream
The ISP input stream currently only allocates a single slot in the V4L2VideoDevice cache as it follows the number of buffers allocated for use. However, this is wrong as the ISP input stream imports buffers from Unicam image stream. As a consequence of this, only one cache slot was used during runtime for the ISP input stream, and if multiple buffers were to be queued simultaneously, the queue operation would return a failure. Fix this by passing the same number of RAW buffers available from the Unicam image stream. Additionally, double this count in the cases where buffers could be allocated externally from the application. Bug: https://github.com/raspberrypi/libcamera-apps/issues/236 Bug: https://github.com/raspberrypi/libcamera-apps/issues/238 Bug: https://github.com/raspberrypi/libcamera-apps/issues/240 Signed-off-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: David Plowman <david.plowman@raspberrypi.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'src/libcamera/pipeline/raspberrypi/raspberrypi.cpp')
-rw-r--r--src/libcamera/pipeline/raspberrypi/raspberrypi.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
index 38bbb8be..f920c8de 100644
--- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
+++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
@@ -1391,6 +1391,14 @@ int PipelineHandlerRPi::prepareBuffers(Camera *camera)
* minimise frame drops.
*/
numBuffers = std::max<int>(2, minBuffers - numRawBuffers);
+ } else if (stream == &data->isp_[Isp::Input]) {
+ /*
+ * ISP input buffers are imported from Unicam, so follow
+ * similar logic as above to count all the RAW buffers
+ * available.
+ */
+ numBuffers = numRawBuffers + std::max<int>(2, minBuffers - numRawBuffers);
+
} else if (stream == &data->unicam_[Unicam::Embedded]) {
/*
* Embedded data buffers are (currently) for internal use,