rust-for-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] rust: drm: Introduce DeviceCtx
@ 2025-11-07 19:23 Lyude Paul
  2025-11-07 19:23 ` [PATCH 1/2] " Lyude Paul
  2025-11-07 19:23 ` [PATCH 2/2] rust/drm/gem: Use DeviceCtx with GEM objects Lyude Paul
  0 siblings, 2 replies; 3+ messages in thread
From: Lyude Paul @ 2025-11-07 19:23 UTC (permalink / raw)
  To: linux-kernel, rust-for-linux, dri-devel
  Cc: Miguel Ojeda, Alex Gaynor, Boqun Feng, Gary Guo,
	Björn Roy Baron, Benno Lossin, Andreas Hindborg, Alice Ryhl,
	Trevor Gross, Danilo Krummrich

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-11-07 19:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-07 19:23 [PATCH 0/2] rust: drm: Introduce DeviceCtx Lyude Paul
2025-11-07 19:23 ` [PATCH 1/2] " Lyude Paul
2025-11-07 19:23 ` [PATCH 2/2] rust/drm/gem: Use DeviceCtx with GEM objects Lyude Paul

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).