summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacopo Mondi <jacopo@jmondi.org>2022-11-24 09:41:56 +0100
committerJacopo Mondi <jacopo@jmondi.org>2022-12-09 08:57:40 +0100
commit9227deb254f6ed29837f4f8c490137be18d26056 (patch)
tree5d2abaa9b344c7119571a94fae764df8e9066275
parent30a775b82af90b02e9fe6fe9bbd20f834a55c58a (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@jmondi.org>
-rw-r--r--include/libcamera/internal/camera_sensor.h1
-rw-r--r--src/libcamera/camera_sensor.cpp15
2 files changed, 15 insertions, 1 deletions
diff --git a/include/libcamera/internal/camera_sensor.h b/include/libcamera/internal/camera_sensor.h
index b9f4d786..878f3c28 100644
--- a/include/libcamera/internal/camera_sensor.h
+++ b/include/libcamera/internal/camera_sensor.h
@@ -101,6 +101,7 @@ private:
Size pixelArraySize_;
Rectangle activeArea_;
const BayerFormat *bayerFormat_;
+ bool supportFlips_;
ControlList properties_;
diff --git a/src/libcamera/camera_sensor.cpp b/src/libcamera/camera_sensor.cpp
index e4a3684a..3ca9d1c7 100644
--- a/src/libcamera/camera_sensor.cpp
+++ b/src/libcamera/camera_sensor.cpp
@@ -57,7 +57,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)
{
}
@@ -276,6 +277,18 @@ int CameraSensor::validateSensorDriver()
}
}
+ /* Verify if sensor supports horizontal/vertical flips. */
+ 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 && vflipInfo &&
+ !(hflipInfo->flags & V4L2_CTRL_FLAG_READ_ONLY) &&
+ !(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.
*