Previous version of this patch series: https://patchwork.freedesktop.org/series/160217/#rev1
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). 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 DeviceContext 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::DeviceContext: introducing our own DeviceContext type state. This patch series depends on the two pre-requisite patch series: * https://patchwork.freedesktop.org/series/160523/ * https://patchwork.freedesktop.org/series/160525/ Series-wide changes V2: * s/DeviceCtx/DeviceContext/ for consistency * Move private driver-data availability to the Registration DeviceContext * s/AnyCtx/Init/ More changes described in each patch description. Lyude Paul (3): rust/drm: Introduce DeviceContext rust/drm: Don't setup private driver data until registration rust/drm/gem: Use DeviceContext with GEM objects drivers/gpu/drm/nova/driver.rs | 10 +- drivers/gpu/drm/nova/gem.rs | 11 +- drivers/gpu/drm/tyr/driver.rs | 12 +- drivers/gpu/drm/tyr/gem.rs | 3 +- rust/kernel/drm/device.rs | 246 +++++++++++++++++++++++++-------- rust/kernel/drm/driver.rs | 55 ++++++-- rust/kernel/drm/gem/mod.rs | 64 ++++++--- rust/kernel/drm/mod.rs | 4 + 8 files changed, 303 insertions(+), 102 deletions(-) base-commit: 6ea52b6d8f33ae627f4dcf43b12b6e713a8b9331 prerequisite-patch-id: d596b2a5a81fb067cb267fe30b6e2d8fd47fddad prerequisite-patch-id: 32f09c643498c714d92a6a87b3de220b5d37b41e prerequisite-patch-id: 28f11c925aab9ed9d4fa70dbbf2c4a7accb5c05d -- 2.52.0
