summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNaushir Patuck <naush@raspberrypi.com>2021-11-18 16:42:15 +0000
committerKieran Bingham <kieran.bingham@ideasonboard.com>2021-11-23 13:46:04 +0000
commit9c246b77e4982d4fbfdbf980df0d374547d7bfcc (patch)
tree75d930094c4f2e8b9efe59d7b37d13f1b1fc5409
parenta3b0aa5511f9e7fe76ec5966a6031d3c9d02a3f2 (diff)
pipeline: raspberrypi: Increase the V4L2BufferCache slot allocations
If a stream is marked as external, double the number of V4L2BufferCache slots that are allocated. This is to account for additional buffers that may be allocated directly by the application. Signed-off-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
-rw-r--r--src/libcamera/pipeline/raspberrypi/rpi_stream.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/libcamera/pipeline/raspberrypi/rpi_stream.cpp b/src/libcamera/pipeline/raspberrypi/rpi_stream.cpp
index b3265d0e..bab80d25 100644
--- a/src/libcamera/pipeline/raspberrypi/rpi_stream.cpp
+++ b/src/libcamera/pipeline/raspberrypi/rpi_stream.cpp
@@ -107,6 +107,17 @@ int Stream::prepareBuffers(unsigned int count)
count = bufferMap_.size();
}
+ /*
+ * If this is an external stream, we must allocate slots for buffers that
+ * might be externally allocated. We have no indication of how many buffers
+ * may be used, so this might overallocate slots in the buffer cache.
+ *
+ * \todo Find a better heuristic, or, even better, an exact solution to
+ * this issue.
+ */
+ if (isExternal())
+ count = count * 2;
+
return dev_->importBuffers(count);
}