[libcamera-devel] [PATCH v10 09/19] libcamera: pipeline: imx8-isi: Don't rely on bufferCount

Paul Elder paul.elder at ideasonboard.com
Wed Dec 28 23:29:53 CET 2022


Instead of using bufferCount as the number of V4L2 buffer slots to
reserve in the isi pipeline handler, use a reasonably high constant: 16.
Overallocating isn't a problem as buffer slots are cheap. Having too
few, on the other hand, could degrade performance. It is expected that
this number will be more than enough for most, if not all, use cases.

Signed-off-by: Paul Elder <paul.elder at ideasonboard.com>

---
New in v10
---
 src/libcamera/pipeline/imx8-isi/imx8-isi.cpp | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/libcamera/pipeline/imx8-isi/imx8-isi.cpp b/src/libcamera/pipeline/imx8-isi/imx8-isi.cpp
index 434fbd63..73eeaf0e 100644
--- a/src/libcamera/pipeline/imx8-isi/imx8-isi.cpp
+++ b/src/libcamera/pipeline/imx8-isi/imx8-isi.cpp
@@ -148,6 +148,8 @@ private:
 
 	std::unique_ptr<V4L2Subdevice> crossbar_;
 	std::vector<Pipe> pipes_;
+
+	static constexpr unsigned int kBufferSlotCount = 16;
 };
 
 /* -----------------------------------------------------------------------------
@@ -820,9 +822,8 @@ int PipelineHandlerISI::start(Camera *camera,
 
 	for (const auto &stream : data->enabledStreams_) {
 		Pipe *pipe = pipeFromStream(camera, stream);
-		const StreamConfiguration &config = stream->configuration();
 
-		int ret = pipe->capture->importBuffers(config.bufferCount);
+		int ret = pipe->capture->importBuffers(kBufferSlotCount);
 		if (ret)
 			return ret;
 
-- 
2.35.1



More information about the libcamera-devel mailing list