libcamera: camera_sensor: Test for read-only HBLANK with READ_ONLY flag
The CameraSensor class tests if the sensor HBLANK control is read-only by comparing the minimum and maximum values, and documents this as being a workaround for the lack of a read-only control flag in V4L2. This is incorrect, as the V4L2 API provides such a flag. Use it to replace the workaround. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
This commit is contained in:
parent
2a6d432457
commit
58bcddbdeb
1 changed files with 7 additions and 20 deletions
|
@ -188,29 +188,16 @@ int CameraSensor::init()
|
||||||
* Set HBLANK to the minimum to start with a well-defined line length,
|
* Set HBLANK to the minimum to start with a well-defined line length,
|
||||||
* allowing IPA modules that do not modify HBLANK to use the sensor
|
* allowing IPA modules that do not modify HBLANK to use the sensor
|
||||||
* minimum line length in their calculations.
|
* minimum line length in their calculations.
|
||||||
*
|
|
||||||
* At present, there is no way of knowing if a control is read-only.
|
|
||||||
* As a workaround, assume that if the minimum and maximum values of
|
|
||||||
* the V4L2_CID_HBLANK control are the same, it implies the control
|
|
||||||
* is read-only.
|
|
||||||
*
|
|
||||||
* \todo The control API ought to have a flag to specify if a control
|
|
||||||
* is read-only which could be used below.
|
|
||||||
*/
|
*/
|
||||||
if (ctrls.infoMap()->find(V4L2_CID_HBLANK) != ctrls.infoMap()->end()) {
|
const struct v4l2_query_ext_ctrl *hblankInfo = subdev_->controlInfo(V4L2_CID_HBLANK);
|
||||||
const ControlInfo hblank = ctrls.infoMap()->at(V4L2_CID_HBLANK);
|
if (hblankInfo && !(hblankInfo->flags & V4L2_CTRL_FLAG_READ_ONLY)) {
|
||||||
const int32_t hblankMin = hblank.min().get<int32_t>();
|
|
||||||
const int32_t hblankMax = hblank.max().get<int32_t>();
|
|
||||||
|
|
||||||
if (hblankMin != hblankMax) {
|
|
||||||
ControlList ctrl(subdev_->controls());
|
ControlList ctrl(subdev_->controls());
|
||||||
|
|
||||||
ctrl.set(V4L2_CID_HBLANK, hblankMin);
|
ctrl.set(V4L2_CID_HBLANK, static_cast<int32_t>(hblankInfo->minimum));
|
||||||
ret = subdev_->setControls(&ctrl);
|
ret = subdev_->setControls(&ctrl);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return applyTestPatternMode(controls::draft::TestPatternModeEnum::TestPatternModeOff);
|
return applyTestPatternMode(controls::draft::TestPatternModeEnum::TestPatternModeOff);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue