[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251107193204.398657-1-lyude@redhat.com>
Date: Fri, 7 Nov 2025 14:23:52 -0500
From: Lyude Paul <lyude@...hat.com>
To: linux-kernel@...r.kernel.org,
rust-for-linux@...r.kernel.org,
dri-devel@...ts.freedesktop.org
Cc: 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>
Subject: [PATCH 0/2] rust: drm: Introduce DeviceCtx
One of the unsolved issues we still have with the rust DRM bindings is
the ability to limit certain Device operations to contexts where we can
guarantee that a Device has been fully initialized and registered with
userspace, or vice-versa (e.g. must be unregistered). This is a bit of
an issue for KMS bindings, since we need to be able to limit the
creation of static resources like CRTCs such that they only happen
before userspace registration.
While the previous solution for this that I had was simply not exposing
drm::Device at all until the device has been registered with userspace,
unfortunately this isn't enough since:
* As we found out with Tyr, drivers occasionally need to be able to
create GEM objects before device registration
* We would still need to be able to handle KMS callbacks which could be
invoked after KMS init but before userspace registration (not handled
in this series specifically, but DeviceCtx will be required for
handling this).
This patch series provides a pretty nice solution to this, by
implementing a very similar solution to kernel::device::DeviceCtx:
introducing our own DeviceCtx type state. In the future, we'll likely
add a DeviceCtx state specifically for KMS devices that aren't
guaranteed to be registered with userspace.
Lyude Paul (2):
rust: drm: Introduce DeviceCtx
rust/drm/gem: Use DeviceCtx with GEM objects
drivers/gpu/drm/nova/driver.rs | 10 +-
drivers/gpu/drm/nova/gem.rs | 11 +-
drivers/gpu/drm/tyr/driver.rs | 15 ++-
drivers/gpu/drm/tyr/gem.rs | 3 +-
rust/kernel/drm/device.rs | 181 ++++++++++++++++++++++++++-------
rust/kernel/drm/driver.rs | 37 +++++--
rust/kernel/drm/gem/mod.rs | 66 ++++++++----
rust/kernel/drm/mod.rs | 4 +
8 files changed, 244 insertions(+), 83 deletions(-)
base-commit: ade19c5060dfa39b84a9475a4a6b05e2a8a2b3ac
--
2.51.1
Powered by blists - more mailing lists