[libcamera-devel] [PATCH v3 1/4] libcamera: property: Add QueueDepth property

Nícolas F. R. A. Prado nfraprado at collabora.com
Wed Apr 21 18:51:36 CEST 2021


The QueueDepth property reports the minimum amount of requests needed in
the camera pipeline.

Signed-off-by: Nícolas F. R. A. Prado <nfraprado at collabora.com>
---
 src/libcamera/pipeline/ipu3/ipu3.cpp               | 4 ++++
 src/libcamera/pipeline/raspberrypi/raspberrypi.cpp | 4 ++++
 src/libcamera/pipeline/rkisp1/rkisp1.cpp           | 2 ++
 src/libcamera/pipeline/rkisp1/rkisp1_path.h        | 4 ++--
 src/libcamera/pipeline/simple/simple.cpp           | 6 ++++--
 src/libcamera/pipeline/uvcvideo/uvcvideo.cpp       | 2 ++
 src/libcamera/pipeline/vimc/vimc.cpp               | 3 +++
 src/libcamera/property_ids.yaml                    | 5 +++++
 8 files changed, 26 insertions(+), 4 deletions(-)

diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp
index 51446fcf5bc1..6067db2f37a3 100644
--- a/src/libcamera/pipeline/ipu3/ipu3.cpp
+++ b/src/libcamera/pipeline/ipu3/ipu3.cpp
@@ -1049,6 +1049,10 @@ int PipelineHandlerIPU3::registerCameras()
 		/* Initialize the camera properties. */
 		data->properties_ = cio2->sensor()->properties();
 
+		/* TODO This can be changed to CIO2 after configuration, but
+		 * both are 4 currently */
+		data->properties_.set(properties::QueueDepth, 4);
+
 		ret = initControls(data.get());
 		if (ret)
 			continue;
diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
index 2a917455500f..8d1ade3a4352 100644
--- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
+++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
@@ -1035,6 +1035,10 @@ bool PipelineHandlerRPi::match(DeviceEnumerator *enumerator)
 	/* Initialize the camera properties. */
 	data->properties_ = data->sensor_->properties();
 
+	/* TODO Can be 1, 2 or 4 depending on configuration, for now use the max
+	 * which is 4 */
+	data->properties_.set(properties::QueueDepth, 4);
+
 	/*
 	 * Set a default value for the ScalerCropMaximum property to show
 	 * that we support its use, however, initialise it to zero because
diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp
index 549f4a4e61a8..7d876e9387d7 100644
--- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp
+++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp
@@ -21,6 +21,7 @@
 #include <libcamera/ipa/core_ipa_interface.h>
 #include <libcamera/ipa/rkisp1_ipa_interface.h>
 #include <libcamera/ipa/rkisp1_ipa_proxy.h>
+#include <libcamera/property_ids.h>
 #include <libcamera/request.h>
 #include <libcamera/stream.h>
 
@@ -940,6 +941,7 @@ int PipelineHandlerRkISP1::createCamera(MediaEntity *sensor)
 
 	/* Initialize the camera properties. */
 	data->properties_ = data->sensor_->properties();
+	data->properties_.set(properties::QueueDepth, RKISP1_BUFFER_COUNT);
 
 	/*
 	 * \todo Read dealy values from the sensor itself or from a
diff --git a/src/libcamera/pipeline/rkisp1/rkisp1_path.h b/src/libcamera/pipeline/rkisp1/rkisp1_path.h
index 3b3e37d258d0..7540dd41ad84 100644
--- a/src/libcamera/pipeline/rkisp1/rkisp1_path.h
+++ b/src/libcamera/pipeline/rkisp1/rkisp1_path.h
@@ -26,6 +26,8 @@ class V4L2Subdevice;
 struct StreamConfiguration;
 struct V4L2SubdeviceFormat;
 
+static constexpr unsigned int RKISP1_BUFFER_COUNT = 4;
+
 class RkISP1Path
 {
 public:
@@ -56,8 +58,6 @@ public:
 	Signal<FrameBuffer *> &bufferReady() { return video_->bufferReady; }
 
 private:
-	static constexpr unsigned int RKISP1_BUFFER_COUNT = 4;
-
 	const char *name_;
 	bool running_;
 
diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp
index f6095d38e97a..6ee24f2f14e8 100644
--- a/src/libcamera/pipeline/simple/simple.cpp
+++ b/src/libcamera/pipeline/simple/simple.cpp
@@ -22,6 +22,7 @@
 #include <linux/media-bus-format.h>
 
 #include <libcamera/camera.h>
+#include <libcamera/property_ids.h>
 #include <libcamera/request.h>
 #include <libcamera/stream.h>
 
@@ -141,6 +142,8 @@ static const SimplePipelineInfo supportedDevices[] = {
 
 } /* namespace */
 
+static constexpr unsigned int kNumInternalBuffers = 3;
+
 class SimpleCameraData : public CameraData
 {
 public:
@@ -238,8 +241,6 @@ protected:
 	int queueRequestDevice(Camera *camera, Request *request) override;
 
 private:
-	static constexpr unsigned int kNumInternalBuffers = 3;
-
 	SimpleCameraData *cameraData(const Camera *camera)
 	{
 		return static_cast<SimpleCameraData *>(
@@ -424,6 +425,7 @@ int SimpleCameraData::init()
 	}
 
 	properties_ = sensor_->properties();
+	properties_.set(properties::QueueDepth, kNumInternalBuffers);
 
 	return 0;
 }
diff --git a/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp b/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp
index b6c6ade5ebaf..591f46b60d23 100644
--- a/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp
+++ b/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp
@@ -525,6 +525,8 @@ int UVCCameraData::init(MediaDevice *media)
 	properties_.set(properties::PixelArraySize, resolution);
 	properties_.set(properties::PixelArrayActiveAreas, { Rectangle(resolution) });
 
+	properties_.set(properties::QueueDepth, 4);
+
 	/* Initialise the supported controls. */
 	ControlInfoMap::Map ctrls;
 
diff --git a/src/libcamera/pipeline/vimc/vimc.cpp b/src/libcamera/pipeline/vimc/vimc.cpp
index 8f5f4ba30953..605b3fe89152 100644
--- a/src/libcamera/pipeline/vimc/vimc.cpp
+++ b/src/libcamera/pipeline/vimc/vimc.cpp
@@ -20,6 +20,7 @@
 #include <libcamera/formats.h>
 #include <libcamera/ipa/ipa_interface.h>
 #include <libcamera/ipa/ipa_module_info.h>
+#include <libcamera/property_ids.h>
 #include <libcamera/request.h>
 #include <libcamera/stream.h>
 
@@ -516,6 +517,8 @@ int VimcCameraData::init()
 	/* Initialize the camera properties. */
 	properties_ = sensor_->properties();
 
+	properties_.set(properties::QueueDepth, 4);
+
 	return 0;
 }
 
diff --git a/src/libcamera/property_ids.yaml b/src/libcamera/property_ids.yaml
index 104e9aaf4fa3..0b7d1271a26b 100644
--- a/src/libcamera/property_ids.yaml
+++ b/src/libcamera/property_ids.yaml
@@ -678,6 +678,11 @@ controls:
         \todo Turn this property into a "maximum control value" for the
         ScalerCrop control once "dynamic" controls have been implemented.
 
+  - QueueDepth:
+      type: int32_t
+      description: |
+        Minimum amount of requests needed in the camera pipeline.
+
   # ----------------------------------------------------------------------------
   # Draft properties section
 
-- 
2.31.1



More information about the libcamera-devel mailing list