From 85befa816e5a01372b52ecbd345f34815d1b9bc6 Mon Sep 17 00:00:00 2001 From: Jacopo Mondi Date: Mon, 6 Feb 2023 19:21:32 +0100 Subject: libcamera: Remove transform from V4L2SubdeviceFormat Commit 6f6e1bf704fe ("libcamera: camera_sensor: Apply flips at setFormat()") extended the CameraSensor::setFormat() function to apply vertical/horizontal flips on the sensor based on the supplied Transform. To pass the Transform to the function the V4L2SubdeviceFormat structure has been augmented with a Transform member. However as the newly added Transform is not used at all in the V4L2Subdevice class, it should not be part of V4L2SubdeviceFormat. Fix that by removing the transform field from V4L2SubdeviceFormat and pass it as an explicit parameter to CameraSensor::setFormat(). Fixes: 6f6e1bf704fe ("libcamera: camera_sensor: Apply flips at setFormat()) Signed-off-by: Jacopo Mondi Reviewed-by: Laurent Pinchart --- src/libcamera/camera_sensor.cpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'src/libcamera/camera_sensor.cpp') diff --git a/src/libcamera/camera_sensor.cpp b/src/libcamera/camera_sensor.cpp index 274ed419..e442b89d 100644 --- a/src/libcamera/camera_sensor.cpp +++ b/src/libcamera/camera_sensor.cpp @@ -16,7 +16,6 @@ #include #include -#include #include @@ -751,7 +750,6 @@ V4L2SubdeviceFormat CameraSensor::getFormat(const std::vector &mbu .mbus_code = bestCode, .size = *bestSize, .colorSpace = ColorSpace::Raw, - .transform = Transform::Identity, }; return format; @@ -760,6 +758,8 @@ V4L2SubdeviceFormat CameraSensor::getFormat(const std::vector &mbu /** * \brief Set the sensor output format * \param[in] format The desired sensor output format + * \param[in] transform The transform to be applied on the sensor. + * Defaults to Identity. * * If flips are writable they are configured according to the desired Transform. * Transform::Identity always corresponds to H/V flip being disabled if the @@ -770,18 +770,16 @@ V4L2SubdeviceFormat CameraSensor::getFormat(const std::vector &mbu * * \return 0 on success or a negative error code otherwise */ -int CameraSensor::setFormat(V4L2SubdeviceFormat *format) +int CameraSensor::setFormat(V4L2SubdeviceFormat *format, Transform transform) { /* Configure flips if the sensor supports that. */ if (supportFlips_) { ControlList flipCtrls(subdev_->controls()); flipCtrls.set(V4L2_CID_HFLIP, - static_cast(!!(format->transform & - Transform::HFlip))); + static_cast(!!(transform & Transform::HFlip))); flipCtrls.set(V4L2_CID_VFLIP, - static_cast(!!(format->transform & - Transform::VFlip))); + static_cast(!!(transform & Transform::VFlip))); int ret = subdev_->setControls(&flipCtrls); if (ret) -- cgit v1.2.1