[libcamera-devel,RFC,3/5] libcamera: CameraSensor: Expose supported test pattern modes
diff mbox series

Message ID 20210409043208.1823330-4-hiroh@chromium.org
State RFC
Headers show
Series
  • Report available test pattern modes
Related show

Commit Message

Hirokazu Honda April 9, 2021, 4:32 a.m. UTC
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@chromium.org>
---
 include/libcamera/internal/camera_sensor.h | 6 ++++++
 src/libcamera/camera_sensor.cpp            | 8 ++++++++
 2 files changed, 14 insertions(+)

Patch
diff mbox series

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
  *