[PATCH v3 0/23] rust: drm: KMS abstractions for a Rust display driver
Mike Lothian <[email protected]>
| Newsgroups | org.kernel.vger.rust-for-linux,dev.linux.lists.llvm,org.freedesktop.lists.dri-devel |
|---|---|
| Message-ID | <[email protected]> |
KMS abstractions for a Rust display driver, continuing Lyude Paul's KMS series
rather than replacing it. The first patch adapts that work to the DRM APIs as
they stand today, and the rest add what a real driver turned out to need
Broadly they fall into four groups:
Lifetime and ownership: mode-object references tied to their owners, owned
CRTC and vblank references, a safe constructor for owned registration data,
pinning the owner while DRM files remain open, and rejecting cross-device
GEM handle creation
Properties a driver must read or publish: typed colour and rotation, plane
blend mode, FB_DAMAGE_CLIPS, connector colorimetry and HDR metadata, and a
connector's requested link depth
Callbacks and state: connector detect() and mode_valid(), common state and
connector helpers, checked plane geometry, walking the CRTCs an atomic
commit carries, and CRTC mode changes
Modes and framebuffers: an owned display mode constructor, mode flags and CTA
VIC matching, synthesized CVT connector modes, and validated shmem scanout
views
Also here are the HDCP 2.2 message identifiers, which are DRM UAPI rather than
driver constants
Changes since v2:
Lyude's 43 commits are carried in order and patch-identical to the imported
source, with her messages and tags untouched and no trailer of mine on any
of them. v2 mixed her work with adaptations of mine and obscured the
attribution, which was the fair complaint
Everything of mine on top is a separate commit, and it is either an
adaptation to a DRM API that has moved or a safety extension a driver
needed
The i2c adapter-provider patch is dropped. Igor Korotin's work is active and
its provider-lifetime question is not one to answer privately in a driver,
so the kernel driver registers no downstream I2C adapter this round
The typed event channels and the private ioctl compat translations are
dropped. Both existed for a second consumer that is not part of this
posting, so neither has a user in what is sent
The hardware-cursor support that was a separate v2 patch is folded into the
plane work it belongs to
Two overlaps worth naming. Alvin Sun's
"Fix missing fops.owner in Rust DRM/misc abstractions" fixes the same bug as
"rust: drm: pin the owner while DRM files remain open", from the other end,
through ModuleMetadata rather than by threading an owning module through
UnregisteredDevice::new(). Theirs is the better shape and mine should be dropped
the moment it lands; it is still load-bearing today because upstream
UnregisteredDevice::new() takes no module. And where an early patch here fixes a
commit of Lyude's that is itself unmerged, that fix would be better folded into
her next revision than carried separately, and I am happy to do it that way
v2: https://lore.kernel.org/r/[email protected]
The rest of the posting, which is one series per subsystem:
rust-core, 9 patches, rust-for-linux and linux-kernel
https://lore.kernel.org/r/[email protected]
rust-crypto, 2 patches, linux-crypto and rust-for-linux
https://lore.kernel.org/r/[email protected]
rust-usb, 5 patches, linux-usb and rust-for-linux
https://lore.kernel.org/r/[email protected]
rust-drm, 23 patches, this one
rust-firmware, 1 patch, to linux-kernel and rust-for-linux, not sent yet
drm-vino, 13 patches, to dri-devel, not sent yet
Vino is the user for all of them. The abstractions themselves are generic and
carry no knowledge of DisplayLink
The whole thing is one branch, base and prerequisites included, which is the
quickest way to read it:
git clone -b vino-v3 https://github.com/FireBurn/linux
cd linux
make LLVM=1 rustavailable
make LLVM=1 -j$(nproc)
make LLVM=1 -j$(nproc) modules
CONFIG_RUST=y and CONFIG_DRM_VINO=m are the two to set; DRM_VINO selects the
rest of what it needs
It is the exact tree these patches were generated from, at 4c9ba407018e, the
drm-rust-next tip of 2026-08-06. drm-next has moved on since, and this follows
drm-rust-next deliberately: the KMS layer underneath this work lives only there,
and that tree picks up drm-next on its own schedule
Two commits on the branch are not in any of the series above, because they
enable no part of Vino: a scheduler call site that stops compiling under the
locking-guard series, and the Kms associated type Tyr needs once the KMS
registration trait requires one
It applies to the base above plus this, and nothing else:
Lyude Paul, Rust bindings for KMS + RVKMS
https://lore.kernel.org/r/[email protected]
The reference branch also carries Boqun Feng's counted interrupt disabling
series, which SpinLockIrq needs. One patch of it is already in tip locking/core
as e901c1510e24
These patches were written with the assistance of Claude (Anthropic), used
through Claude Code as an interactive coding assistant, across the design, the
implementation and the tests. Every patch it contributed to carries an
Assisted-by trailer. The Signed-off-by is mine: I have reviewed and tested what
is here and I stand behind it
Mike Lothian (23):
rust: drm: kms: adapt Lyude's KMS series to current DRM APIs
rust: drm: kms: tie mode-object references to their owners
rust: drm: kms: constrain connector encoder attachment
rust: drm: reject cross-device GEM handle creation
rust: drm: kms: add common state and connector helpers
rust: drm: expose HDCP 2.2 message identifiers
rust: drm: kms: add typed color and rotation properties
rust: drm: kms: add connector detect() and mode_valid() hooks
rust: drm: kms: add plane damage-clip accessors
rust: drm: framebuffer: add validated shmem scanout views
rust: drm: kms: expose checked plane geometry
rust: drm: kms: add owned CRTC and vblank references
rust: drm: kms: plane: add FB_DAMAGE_CLIPS property support
rust: drm: add a safe constructor for owned registration data
rust: drm: pin the owner while DRM files remain open
rust: drm: kms: add the plane blend-mode property
rust: drm: add an owned display mode constructor
rust: drm: expose mode flags and CTA VIC matching
rust: drm: expose CRTC mode changes
rust: drm: kms: add synthesized CVT connector modes
rust: drm: kms: read a connector's colorimetry and HDR metadata
rust: drm: kms: walk the CRTCs an atomic commit carries
rust: drm: kms: expose a connector's requested link depth
22 files changed, 2062 insertions(+), 99 deletions(-)
base-commit: 4c9ba407018e8deb06dbc643112bac8f40404f95
prerequisite-message-id: <[email protected]>