[libcamera-devel] [RFC PATCH 3/5] libcamera: CameraSensor: Expose supported test pattern modes

Hirokazu Honda hiroh at chromium.org
Fri Apr 9 06:32:06 CEST 2021


This adds a getter function for available test pattern modes.
The available test pattern modes are initialized one time on
CameraSensor::init().

Signed-off-by: Hirokazu Honda <hiroh at chromium.org>
---
 include/libcamera/internal/camera_sensor.h | 6 ++++++
 src/libcamera/camera_sensor.cpp            | 8 ++++++++
 2 files changed, 14 insertions(+)

diff --git a/include/libcamera/internal/camera_sensor.h b/include/libcamera/internal/camera_sensor.h
index 3e98f71b..d924ae42 100644
--- a/include/libcamera/internal/camera_sensor.h
+++ b/include/libcamera/internal/camera_sensor.h
@@ -54,6 +54,11 @@ public:
 	const std::vector<unsigned int> &mbusCodes() const { return mbusCodes_; }
 	const std::vector<Size> &sizes() const { return sizes_; }
 	Size resolution() const;
+	const std::vector<int32_t> &availableTestPatternModes() const
+	{
+		return availableTestPatternModes_;
+	}
+
 
 	V4L2SubdeviceFormat getFormat(const std::vector<unsigned int> &mbusCodes,
 				      const Size &size) const;
@@ -89,6 +94,7 @@ private:
 	V4L2Subdevice::Formats formats_;
 	std::vector<unsigned int> mbusCodes_;
 	std::vector<Size> sizes_;
+	std::vector<int32_t> availableTestPatternModes_;
 
 	Size pixelArraySize_;
 	Rectangle activeArea_;
diff --git a/src/libcamera/camera_sensor.cpp b/src/libcamera/camera_sensor.cpp
index f7ed91d9..fba6cb06 100644
--- a/src/libcamera/camera_sensor.cpp
+++ b/src/libcamera/camera_sensor.cpp
@@ -262,6 +262,8 @@ int CameraSensor::init()
 		}
 	}
 
+	availableTestPatternModes_ = subdev_->getAvailableTestPatternModes();
+
 	ret = validateSensorDriver();
 	if (ret)
 		return ret;
@@ -548,6 +550,12 @@ int CameraSensor::initProperties()
  * \return The supported frame sizes sorted in increasing order
  */
 
+/**
+ * \fn CameraSensor::availableTestPatternModes()
+ * \brief Retrieve the test pattern modes supported by the camera sensor
+ * \return The available test pattern modes.
+ */
+
 /**
  * \brief Retrieve the camera sensor resolution
  *
-- 
2.31.1.295.g9ea45b61b8-goog



More information about the libcamera-devel mailing list