-
Notifications
You must be signed in to change notification settings - Fork 6.1k
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: API enhancement #72959
Comments
Extra material to investigate the rationale of the existing APIs, so that their semantics can be kept: https://static.linaro.org/connect/san19/presentations/san19-503.pdf |
Thanks to @loicpoulain I rediscovered Gstreamer, and it is great! The above is also the foundation for a zephyr-shell pipeline, as it is not possible to do it if rewriting the application every time is required. The difficulty, though, is that getting Maybe it is enough to have "gst-launch pipeline, but all devicetree-made" as a first step... |
Right you could treat an rtio_iodev as an endpoint (input or output stream), which is what sensors do today. There's effectively two output streams for sensors, one which is polled, and one which is driven by the sensor itself with an event. The sensing subsystem provides what amounts to a statically defined pipeline with fanout/fanin possibilities and builds on top of this. I could imagine video input/output endpoints being similar, though perhaps needing some additional information about image encoding and framesize to describe the metadata. Image sensors (video) are after all sensors :-) |
So let's give it a try! :) I will pick some hardware known to work first and move from here. To everyone working on a sample or a driver, I wish to avoid disturbing any ongoing effort, so in case I missed an issue, do feel free to ping me about it, I can provide a patch to merge on the PR or delay another PR so that actual driver contribution gets merged first! |
Some insightful overview of how libcamera and V4L2 APIs came-up to be: Key takeaways (from the slides):
|
Introduction
Pursue the work on the video API past the Video 4 Zephyr added to Zephyr in #17194.
Problem description
I would like to implement UVC and enable more complex video pipelines to be written without having to rewrite from scratch a new application every time the devicetree is updated.
Proposed change
Incrementally rework the devicetree and video driver API
Detailed RFC
The existing API leaves corners left for future specification.
The goal is:
Proposed change (Detailed)
remote-endpoint
is not used by Zephyr drivers. RTIO can be leveraged to replace the many FIFOs that are typically defined in each driver 1, 2, 3 and provide a way to directly connect drivers while also allowing the application to be interleaved in the pipeline. This would act as a splice(2) for Zephyr video drivers, triggered by the devicetree `remote-endpointvideo_endpoint_id
has unclear semantics in some cases (doc fix only) and can be adjusted to allow positive numbers refer an individual endpoint number or addressenum endpoint_id
#73009Following this, devicetree macros can be introduced to provide ways to refer a particular endpoint without manually coding the endpoint number from the application.
video_get_caps()
fills a struct with all the video caps filled at once. This works well, but makes it more difficult than using an enumerator-style API such as what #72254 proposes which allows drivers to be a bit more generic: a device doing software video processing can filter the format capabilities of its sources this way.video_enqueue()
: "an addition to the video API to enable streaming partial frames within one video buffer" is missing. A new API is introduced as part of Arducam Mega sensor support.Introduce a directory for the video drivers, as sensors, MIPI controllers, DMA controllers, software blocks [...] are being mixed in one same driver API. A sensor directory was the chosen way and will be merged once the ongoing PR are completed.
Add a
drivers/video_*_skeleton.c
in the same style asdrivers/usb/udc/udc_skeleton.c
that can speed-up development and help with understanding the semantics.sensor_skeleton.c
to speed-up contribution of simple sensors #73867The devicetree can be flattened to enable more uniform processing, such as DT macros used to reduce boilerplate code and homogenize drivers
Dependencies
Annotated inline above.
Concerns and Unresolved Questions
Alternatives
Leaving-up the application developer resolve these issues is the current approach, and demos and samples submitted #71463 show that it effectively works end-to-end with the current API.
For the case of RTIO, it is also possible to introduce a "genderless" interconnect between source and sinks (so that the application or another driver can use it) by replacing
enqueue()
/dequeue()
by a public FIFO integrated directly in the API.The text was updated successfully, but these errors were encountered: