diff options
author | Jacopo Mondi <jacopo.mondi@ideasonboard.com> | 2022-11-24 09:41:56 +0100 |
---|---|---|
committer | Jacopo Mondi <jacopo.mondi@ideasonboard.com> | 2023-01-30 10:49:26 +0100 |
commit | e030bac39027cc960727ec3db99a68fcb01e0b2a (patch) | |
tree | 9e2d7817855645ba51d7fc296c7e5a7d09fb0f9c /src | |
parent | 0f382a9926bff239e43bbc3098f111ebf612dc50 (diff) |
libcamera: camera_sensor: Verify flips support
During the camera sensor driver validation, verify if the sensor
supports horizontal and vertical flips and store a flag as
CameraSensor::supportFlips_ class member.
The flag will be later inspected when applying flips.
Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Reviewed-by: David Plowman <david.plowman@raspberrypi.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/libcamera/camera_sensor.cpp | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/src/libcamera/camera_sensor.cpp b/src/libcamera/camera_sensor.cpp index a210aa4f..83ac075a 100644 --- a/src/libcamera/camera_sensor.cpp +++ b/src/libcamera/camera_sensor.cpp @@ -55,7 +55,8 @@ LOG_DEFINE_CATEGORY(CameraSensor) */ CameraSensor::CameraSensor(const MediaEntity *entity) : entity_(entity), pad_(UINT_MAX), staticProps_(nullptr), - bayerFormat_(nullptr), properties_(properties::properties) + bayerFormat_(nullptr), supportFlips_(false), + properties_(properties::properties) { } @@ -248,6 +249,21 @@ int CameraSensor::validateSensorDriver() } /* + * Verify if sensor supports horizontal/vertical flips + * + * \todo Handle horizontal and vertical flips independently. + */ + const struct v4l2_query_ext_ctrl *hflipInfo = subdev_->controlInfo(V4L2_CID_HFLIP); + const struct v4l2_query_ext_ctrl *vflipInfo = subdev_->controlInfo(V4L2_CID_VFLIP); + if (hflipInfo && !(hflipInfo->flags & V4L2_CTRL_FLAG_READ_ONLY) && + vflipInfo && !(vflipInfo->flags & V4L2_CTRL_FLAG_READ_ONLY)) + supportFlips_ = true; + + if (!supportFlips_) + LOG(CameraSensor, Warning) + << "Camera sensor does not support horizontal/vertical flip"; + + /* * Make sure the required selection targets are supported. * * Failures in reading any of the targets are not deemed to be fatal, |