Morning Hans On 28/01/2024 20:58, Hans de Goede wrote:
Hi All, While adding vblank ctrl support to the ov2680 driver I was looking at the vblank ctrl code in the ov5693 and I noticed something which I believe is weird / undesirable. When setting a new mode the ov5693 driver does not keep the current vts value (adjusting vblank to keep vts and thus the framerare and exposure unchanged). Instead it calculates a new vts value, resetting the framerate to 30 fps; or 60 fps for smaller resolutions and then sets vblank to the new (vts - new_mode->height) and adjusts the exposure control-range to fit within the new vts, potentially also changing the exposure value. This behavior of the ov5693 code means that switching resolution also changes the framerate and the exposure value which seems undesirable.
I think I did it that way because I was hitting problems when changing the framesize exceeded the current VTS and it seemed cleaner to just reset it to a known situation. Really though the only thing it would affect would be the framerate; that would have to reduce if the VTS increased but exposure could stay the same (though the maximum would change). So probably it ought to work like:
* if we change from a larger to a smaller framesize then we can just increase blanking to keep the same VTS and that should be fine
* if we're going from a smaller to a larger framesize that fits within the currently configured VTS with minimum blanking, we can just reduce the blanking to keep the same VTS and that should be fine
* if we're going from a smaller to a larger framesize that exceeds the currently configured VTS we drop blanking to a minimum so that the new framerate is as close to the old one as it can be
Does that sound like more reasonable behaviour? If so, shall I patch it? Thanks Dan
The vblank and hblank control values changes on setting a mode is unavoidable but the framerate and exposure value changing at the same time seems undesirable. Note that this also halves the max supported exposure value when going to a lower-res mode even when userspace never touches the vblank control. Regards, Hans