<div dir="ltr"><div dir="ltr">Hi David,<div><br></div><div>Thanks for fixing this.</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, 23 Nov 2022 at 11:36, David Plowman via libcamera-devel <<a href="mailto:libcamera-devel@lists.libcamera.org">libcamera-devel@lists.libcamera.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">We no longer reset the HBLANK in init because we may not own the<br>
camera and the operation may fail. Instead, we reset it when we set<br>
the camera format so that all pipeline handlers, even ones that do not<br>
control HBLANK themselves, will have a well-defined value.<br>
<br>
Signed-off-by: David Plowman <<a href="mailto:david.plowman@raspberrypi.com" target="_blank">david.plowman@raspberrypi.com</a>><br></blockquote><div><br></div><div>Seems reasonable!</div><div><br></div><div>Reviewed-By: Naushir Patuck <<a href="mailto:naush@raspberrypi.com">naush@raspberrypi.com</a>></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
---<br>
 src/libcamera/camera_sensor.cpp | 53 ++++++++++++++++-----------------<br>
 1 file changed, 26 insertions(+), 27 deletions(-)<br>
<br>
diff --git a/src/libcamera/camera_sensor.cpp b/src/libcamera/camera_sensor.cpp<br>
index 572a313a..ec7bb0e7 100644<br>
--- a/src/libcamera/camera_sensor.cpp<br>
+++ b/src/libcamera/camera_sensor.cpp<br>
@@ -176,32 +176,6 @@ int CameraSensor::init()<br>
        if (ret)<br>
                return ret;<br>
<br>
-       /*<br>
-        * Set HBLANK to the minimum to start with a well-defined line length,<br>
-        * allowing IPA modules that do not modify HBLANK to use the sensor<br>
-        * minimum line length in their calculations.<br>
-        *<br>
-        * At present, there is no way of knowing if a control is read-only.<br>
-        * As a workaround, assume that if the minimum and maximum values of<br>
-        * the V4L2_CID_HBLANK control are the same, it implies the control<br>
-        * is read-only.<br>
-        *<br>
-        * \todo The control API ought to have a flag to specify if a control<br>
-        * is read-only which could be used below.<br>
-        */<br>
-       const ControlInfo hblank = ctrls.infoMap()->at(V4L2_CID_HBLANK);<br>
-       const int32_t hblankMin = hblank.min().get<int32_t>();<br>
-       const int32_t hblankMax = hblank.max().get<int32_t>();<br>
-<br>
-       if (hblankMin != hblankMax) {<br>
-               ControlList ctrl(subdev_->controls());<br>
-<br>
-               ctrl.set(V4L2_CID_HBLANK, hblankMin);<br>
-               ret = subdev_->setControls(&ctrl);<br>
-               if (ret)<br>
-                       return ret;<br>
-       }<br>
-<br>
        return applyTestPatternMode(controls::draft::TestPatternModeEnum::TestPatternModeOff);<br>
 }<br>
<br>
@@ -748,7 +722,32 @@ int CameraSensor::setFormat(V4L2SubdeviceFormat *format)<br>
                return ret;<br>
<br>
        updateControlInfo();<br>
-       return 0;<br>
+<br>
+       /*<br>
+        * Set HBLANK to the minimum to start with a well-defined line length,<br>
+        * allowing IPA modules that do not modify HBLANK to use the sensor<br>
+        * minimum line length in their calculations.<br>
+        *<br>
+        * At present, there is no way of knowing if a control is read-only.<br>
+        * As a workaround, assume that if the minimum and maximum values of<br>
+        * the V4L2_CID_HBLANK control are the same, it implies the control<br>
+        * is read-only.<br>
+        *<br>
+        * \todo The control API ought to have a flag to specify if a control<br>
+        * is read-only which could be used below.<br>
+        */<br>
+       const ControlInfo hblank = controls().at(V4L2_CID_HBLANK);<br>
+       const int32_t hblankMin = hblank.min().get<int32_t>();<br>
+       const int32_t hblankMax = hblank.max().get<int32_t>();<br>
+<br>
+       if (hblankMin != hblankMax) {<br>
+               ControlList ctrl(subdev_->controls());<br>
+<br>
+               ctrl.set(V4L2_CID_HBLANK, hblankMin);<br>
+               ret = subdev_->setControls(&ctrl);<br>
+       }<br>
+<br>
+       return ret;<br>
 }<br>
<br>
 /**<br>
-- <br>
2.30.2<br>
<br>
</blockquote></div></div>