rust-for-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Daniel Almeida <daniel.almeida@collabora.com>
To: "Miguel Ojeda" <ojeda@kernel.org>,
	"Alex Gaynor" <alex.gaynor@gmail.com>,
	"Boqun Feng" <boqun.feng@gmail.com>,
	"Gary Guo" <gary@garyguo.net>,
	"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
	"Benno Lossin" <lossin@kernel.org>,
	"Andreas Hindborg" <a.hindborg@kernel.org>,
	"Alice Ryhl" <aliceryhl@google.com>,
	"Trevor Gross" <tmgross@umich.edu>,
	"Danilo Krummrich" <dakr@kernel.org>,
	"Alexandre Courbot" <acourbot@nvidia.com>
Cc: linux-kernel@vger.kernel.org, rust-for-linux@vger.kernel.org,
	 kernel@collabora.com, linux-media@vger.kernel.org,
	 Daniel Almeida <daniel.almeida@collabora.com>
Subject: [PATCH 0/7] rust: add initial v4l2 support
Date: Mon, 18 Aug 2025 02:49:46 -0300	[thread overview]
Message-ID: <20250818-v4l2-v1-0-6887e772aac2@collabora.com> (raw)

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@collabora.com>


             reply	other threads:[~2025-08-18  5:51 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-18  5:49 Daniel Almeida [this message]
2025-08-18  5:49 ` [PATCH 1/7] rust: media: add the media module Daniel Almeida
2025-08-18  8:56   ` Miguel Ojeda
2025-08-18 10:28   ` Janne Grunau
2025-08-18  5:49 ` [PATCH 2/7] rust: v4l2: add support for v4l2_device Daniel Almeida
2025-08-18  9:14   ` Danilo Krummrich
2025-08-18  5:49 ` [PATCH 3/7] rust: v4l2: add support for video device nodes Daniel Almeida
2025-08-18  9:26   ` Danilo Krummrich
2025-08-18  5:49 ` [PATCH 4/7] rust: v4l2: add support for v4l2 file handles Daniel Almeida
2025-08-18  5:49 ` [PATCH 5/7] rust: v4l2: add device capabilities Daniel Almeida
2025-08-20  4:14   ` Elle Rhumsaa
2025-08-18  5:49 ` [PATCH 6/7] rust: v4l2: add basic ioctl support Daniel Almeida
2025-08-20  4:22   ` Elle Rhumsaa
2025-08-18  5:49 ` [PATCH 7/7] rust: samples: add the v4l2 sample driver Daniel Almeida
2025-08-20  4:24   ` Elle Rhumsaa
2025-08-20 12:39   ` Danilo Krummrich
2025-08-18  8:45 ` [PATCH 0/7] rust: add initial v4l2 support Miguel Ojeda

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250818-v4l2-v1-0-6887e772aac2@collabora.com \
    --to=daniel.almeida@collabora.com \
    --cc=a.hindborg@kernel.org \
    --cc=acourbot@nvidia.com \
    --cc=alex.gaynor@gmail.com \
    --cc=aliceryhl@google.com \
    --cc=bjorn3_gh@protonmail.com \
    --cc=boqun.feng@gmail.com \
    --cc=dakr@kernel.org \
    --cc=gary@garyguo.net \
    --cc=kernel@collabora.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=lossin@kernel.org \
    --cc=ojeda@kernel.org \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=tmgross@umich.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).