Skip to content

drivers: video: switch from custom buffer to RTIO #89858

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

Open
josuah opened this issue May 12, 2025 · 4 comments
Open

drivers: video: switch from custom buffer to RTIO #89858

josuah opened this issue May 12, 2025 · 4 comments
Assignees
Labels
area: API Changes to public APIs area: RTIO area: Video Video subsystem RFC Request For Comments: want input from the community

Comments

@josuah
Copy link
Collaborator

josuah commented May 12, 2025

Introduction

Switch ad-hoc video buffers and submission/completion queues (fifo_in/fifo_out fields) + polling API to RTIO.

Problem description

The video enqueue()/dequeue()/set_signal() operations use a custom struct for video buffers and FIFO storage. Furthermore, the polling API is rarely implemented and not used in the capture example.

Proposed change

Replace the submission/completion mechanism of Video by RTIO, benefiting from reduced context switching, reduced maintenance, and provides a polling API implicitly without user requiring to implement it.

Detailed RFC

Proposed change (Detailed)

At a high-level, the modifications would be:

Dependencies

All features needed are already in Zephyr, and the switch to RTIO is a matter of progressively converting the drivers.

A "RTIO shim" strategy is frequenty used as a glue layer to cover drivers not converted yet.

Concerns and Unresolved Questions

If the migration happens, sould struct video_buffer and several other APIs be kept for compatibility or a more convenient/flexible API be exposed instead?

Alternatives

Make use of struct net_buf instead of RTIO.

@josuah josuah self-assigned this May 12, 2025
@josuah josuah added RFC Request For Comments: want input from the community area: API Changes to public APIs area: Video Video subsystem area: RTIO labels May 12, 2025
@josuah
Copy link
Collaborator Author

josuah commented May 12, 2025

Cc: @loicpoulain @ngphibang @avolmat-st

@josuah
Copy link
Collaborator Author

josuah commented May 12, 2025

@teburd
Copy link
Collaborator

teburd commented May 19, 2025

I'm very supportive of this, so anything that needs to happen to help let me know

@josuah
Copy link
Collaborator Author

josuah commented May 19, 2025

I did not put this in action yet (I plan to start this week), but some early feedback from discussions at Embedded Recipes:

  • Gstreamer developer told me their only regret with V4L2 APIs was the unability to queue a buffer in multple queues at once. For instance encoding data at multiple resolutions simultaneously to dynamicallly switch depending on the network conditions.

  • Linux video ecosystem has all sorts of facilities allowing to configure a pipeline and then let the routing happen. If there is already some kind of "splice(2)" equivalent for RTIO this can be convenient

For both it can be possible to work around on top of RTIO though!

Thank you for your support!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: API Changes to public APIs area: RTIO area: Video Video subsystem RFC Request For Comments: want input from the community
Projects
Status: No status
Development

No branches or pull requests

2 participants