[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250818-v4l2-v1-0-6887e772aac2@collabora.com>
Date: Mon, 18 Aug 2025 02:49:46 -0300
From: Daniel Almeida <daniel.almeida@...labora.com>
To: Miguel Ojeda <ojeda@...nel.org>, Alex Gaynor <alex.gaynor@...il.com>,
Boqun Feng <boqun.feng@...il.com>, Gary Guo <gary@...yguo.net>,
Björn Roy Baron <bjorn3_gh@...tonmail.com>,
Benno Lossin <lossin@...nel.org>, Andreas Hindborg <a.hindborg@...nel.org>,
Alice Ryhl <aliceryhl@...gle.com>, Trevor Gross <tmgross@...ch.edu>,
Danilo Krummrich <dakr@...nel.org>, Alexandre Courbot <acourbot@...dia.com>
Cc: linux-kernel@...r.kernel.org, rust-for-linux@...r.kernel.org,
kernel@...labora.com, linux-media@...r.kernel.org,
Daniel Almeida <daniel.almeida@...labora.com>
Subject: [PATCH 0/7] rust: add initial v4l2 support
Hi,
This topic has been discussed in the last two iterations of the Media
Summit and it has been dormant since. In my humble opinion, and owing
to all the progress that Rust in the kernel has seen since my last
attempts ([0], [1]), it is time to try again.
This series reduces the scope of the original attempt considerably. It
adds APIs to register v4l2 and video devices, and just enough to process
a single ioctl (VIDIOC_QUERYCAP), including basic support for v4l2_fh.
It was tested with v4l2-ctl.
It builds upon the platform work from Danilo and others in order to
offer a concise, platform-based driver sample that is currently the only
user of the abstractions. It draws from all the work done for DRM
devices and others and uses patterns that are known to work for other
subsystems.
I hope that we can all agree that there is little that can go wrong
here.
I've also added a separate MAINTAINERS entry, as the topic of
maintaining the Rust abstractions has been a major point of contention
so far. Hopefully this settles this issue in a satisfactory way for all
involved. In other words, no one is forced to contribute or alter their
workflow in any way, while those that want to contribute are invited to
do so. This approach has worked rather well so far.
I've decided to work on this once more after being told by a few people
that they would likely try to play with Rust v4l2 drivers if only they
did not have to write all of the infrastructure themselves. This work
(and subsequent patches) will pave the way for them.
Note: this is v1 and I'm aware that there are a few checkpatch and doc
issues which I will fix later.
[0]: https://lore.kernel.org/rust-for-linux/20230406215615.122099-1-daniel.almeida@collabora.com/
[1]: https://lore.kernel.org/rust-for-linux/20240227215146.46487-1-daniel.almeida@collabora.com/
---
Daniel Almeida (7):
rust: media: add the media module
rust: v4l2: add support for v4l2_device
rust: v4l2: add support for video device nodes
rust: v4l2: add support for v4l2 file handles
rust: v4l2: add device capabilities
rust: v4l2: add basic ioctl support
rust: samples: add the v4l2 sample driver
MAINTAINERS | 8 ++
rust/bindings/bindings_helper.h | 2 +
rust/helpers/helpers.c | 1 +
rust/helpers/v4l2-device.c | 30 +++++
rust/kernel/lib.rs | 2 +
rust/kernel/media/mod.rs | 9 ++
rust/kernel/media/v4l2/caps.rs | 193 ++++++++++++++++++++++++++++
rust/kernel/media/v4l2/device.rs | 176 +++++++++++++++++++++++++
rust/kernel/media/v4l2/file.rs | 164 ++++++++++++++++++++++++
rust/kernel/media/v4l2/ioctl.rs | 92 +++++++++++++
rust/kernel/media/v4l2/mod.rs | 20 +++
rust/kernel/media/v4l2/video.rs | 269 +++++++++++++++++++++++++++++++++++++++
samples/rust/Kconfig | 11 ++
samples/rust/Makefile | 1 +
samples/rust/rust_driver_v4l2.rs | 145 +++++++++++++++++++++
15 files changed, 1123 insertions(+)
---
base-commit: 8f5ae30d69d7543eee0d70083daf4de8fe15d585
change-id: 20250815-v4l2-f7a80388cf70
Best regards,
--
Daniel Almeida <daniel.almeida@...labora.com>
Powered by blists - more mailing lists