-
Notifications
You must be signed in to change notification settings - Fork 8.1k
drivers: video: ov7670: Set default format to RGB565 QVGA #90282
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
drivers: video: ov7670: Set default format to RGB565 QVGA #90282
Conversation
The default format for ov7670 is currently VGA YUYV and it counts on the smartdma to reset the format to RGB565 QVGA when get_format() is called. Recently, set_format() is decoupled from get_format() so this assumption is nolonger correct. Set the default format to RGB565 QVGA instead. Signed-off-by: Phi Bang Nguyen <[email protected]>
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SmartDMA seems like the main user of this sensor so far.
Maybe other users will want a different default format at some point but RGB565 makes it work with most displays out of the box, and a small resolution is a good starting point too try to get it to work in most case (low memory requirement).
|
Thanks for the patch. I understand that this seems to be done so that the smartdma interface get_format will not return -ENOTSUP when being requested by the application. Is that right ? Maybe it would be better to open an issue to clean this get_fmt, get_caps mechanism and have sample apps be doing state of the art configuration so that other applications can use them as reference. Back to this get_fmt, my understanding is that this should be reflecting the current format, which should be a valid one for that device. So, considering from the interface point of view, it means that whenever the interface is being requested for a format, it should return something actually feasible. Normally a format setting is always validated, hence upon a set_format the format returned by get_fmt is always going to be valid. Regarding the caps, currently it is done by sharing const table of formats, which is ok for interface which does not impact the format, but don't really work for device able to transform data (ex: dcmipp). Maybe another approach, similar to the frmival, index based retrieval of a caps would be more appropriate since it would allow to modify or even skip the entry given by the sensor if it is not applicable on that interface. Probably I could propose some patches in those area. |
Right
Well, normally, user should query the caps of the camera pipeline, choose a format supported in the caps and set the format they want between those. In Zephyr samples (in general) and the video sample in particular, we want something work "out of the box" that's why we set a default format that is supported for a "chosen" board (chosen "by default" in the video sample, e.g. ov5640 for rt1170). Then in the sample, we get this default format and set it again to the pipeline. This is just for convenience. We only have one default format and cannot satisfy everyone, so if there are other boards that want other formats from the same sensor, we can set the format (and resolution) in the board config file in the sample with
This is simple and working currently. In Linux, there are try_format() (and try_frmival, etc.) mechanism looks like what you said. It's fine to me too (but more complicated) |
|
For ov7670, since there is no other boards (in the sample) that wants to set the default format other than RGB565 QVGA, I took this. If not, I can set it in the board config file. Anyways, the frdm mcxn947 needs this format otherwise, the camera feature is nolonger working on this board with the video sample. |
|
I understand and this is fine to do it that way (changing the default) now. For me, the CONFIG_VIDEO_PIXEL_FORMAT is related to what the application is trying to capture. Here the main issue is related to what is returned (or not in the current case) when we request a format to the interface (smartdma in this example). In such situation, either we say that:
or
Yet another approach would be to say in the doc that depending on the configuration / capabilities of the sensor and interfaces, the get_format, at startup might return an error but even in such situation the application should not give up and try to set a format via set_fmt (well, in fact this is kind of the 1 case) |
|
Yes, this is the weak point of the current get/set_fotmat(). It is weird that get_fmt() return an error. That's why I think the 2nd approach should be implemented, as in Linux, format should be "tried" and negotiated along the pipeline to return a valid format for the whole pipeline.
Nice to see this :-) |
|
Good, thanks, I also think the same. |
|
@iabdalkader I do not mean to spam, but I noticed you committed to that sensor. |
Thanks! I only used it for testing, it was never enabled by default for the Giga as far as I know. Even if it is used in the future, I think the user should set the format explicitly. |



The default format for ov7670 is currently VGA YUYV and it counts on the smartdma to reset the format to RGB565 QVGA when get_format() is called.
Recently, set_format() is decoupled from get_format() so this assumption is nolonger correct.
Set the default format to RGB565 QVGA instead.