[libcamera-devel] [RFC PATCH 3/3] libcamera: pipeline: rkisp1: Make fixed amount of internal buffer allocation more explicit

Nícolas F. R. A. Prado nfraprado at collabora.com
Fri Apr 9 23:38:15 CEST 2021


Now that bufferCount can be increased and there is a lc-compliance test
in place to check if the pipeline can handle more requests than it has
internal buffers, we need to be able to test it.

Make the internal buffer allocation always constant, so that by
increasing bufferCount we can simulate this scenario. Scaling the
internal buffers amount with bufferCount only hides the issue, that
should be handled by queueing the overflowing requests.

Signed-off-by: Nícolas F. R. A. Prado <nfraprado at collabora.com>
---
 src/libcamera/pipeline/rkisp1/rkisp1.cpp    | 9 ++-------
 src/libcamera/pipeline/rkisp1/rkisp1_path.h | 4 ++--
 2 files changed, 4 insertions(+), 9 deletions(-)

diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp
index c7b93b2804c7..0dc474f343fc 100644
--- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp
+++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp
@@ -685,16 +685,11 @@ int PipelineHandlerRkISP1::allocateBuffers(Camera *camera)
 	unsigned int ipaBufferId = 1;
 	int ret;
 
-	unsigned int maxCount = std::max({
-		data->mainPathStream_.configuration().bufferCount,
-		data->selfPathStream_.configuration().bufferCount,
-	});
-
-	ret = param_->allocateBuffers(maxCount, &paramBuffers_);
+	ret = param_->allocateBuffers(RKISP1_MIN_BUFFER_COUNT, &paramBuffers_);
 	if (ret < 0)
 		goto error;
 
-	ret = stat_->allocateBuffers(maxCount, &statBuffers_);
+	ret = stat_->allocateBuffers(RKISP1_MIN_BUFFER_COUNT, &statBuffers_);
 	if (ret < 0)
 		goto error;
 
diff --git a/src/libcamera/pipeline/rkisp1/rkisp1_path.h b/src/libcamera/pipeline/rkisp1/rkisp1_path.h
index 13291da89dc5..4ab4c0516ebc 100644
--- a/src/libcamera/pipeline/rkisp1/rkisp1_path.h
+++ b/src/libcamera/pipeline/rkisp1/rkisp1_path.h
@@ -21,6 +21,8 @@
 
 namespace libcamera {
 
+static constexpr unsigned int RKISP1_MIN_BUFFER_COUNT = 4;
+
 class MediaDevice;
 class V4L2Subdevice;
 struct StreamConfiguration;
@@ -56,8 +58,6 @@ public:
 	Signal<FrameBuffer *> &bufferReady() { return video_->bufferReady; }
 
 private:
-	static constexpr unsigned int RKISP1_MIN_BUFFER_COUNT = 4;
-
 	const char *name_;
 	bool running_;
 
-- 
2.31.1



More information about the libcamera-devel mailing list