Skip to content

Introduce DeviceContext

Lyude Paul dri-devel lkml nova-gpu rust-for-linux 8 versions – Applied

Status from this message: Applied, thanks!

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v6 Latest posting 2/23 patches 1 replyApplied
  2. v6 posting 1/25 patches 0 repliesSuperseded
  3. v5 posting 2/24 patches 0 repliesSuperseded
Earlier versions · 5
VersionPostedPatchesRepliesStatus
v5 posting 1/24 patches7 repliesSuperseded
v43 patches2 repliesSuperseded
v33 patches6 repliesSuperseded
v23 patches2 repliesSuperseded
v12 patches2 repliesSuperseded

V2 from the cover letter

* s/DeviceCtx/DeviceContext/ for consistency
* Move private driver-data availability to the Registration DeviceContext
* s/AnyCtx/Init/

Patches in v6 posting 2/2 Applied

#Subject and filesSizeRepliesApplied
1/3rust/drm: Introduce DeviceContextdrivers/gpu/drm/nova/driver.rs drivers/gpu/drm/tyr/driver.rs rust/kernel/drm/device.rs +2 more+214 -650 replies
2/3rust/drm/gem: Add DriverAllocImpl type aliasrust/kernel/drm/gem/mod.rs+7 -20 replies
3/3rust/drm/gem: Use DeviceContext with GEM objectsdrivers/gpu/drm/nova/driver.rs drivers/gpu/drm/nova/gem.rs drivers/gpu/drm/tyr/driver.rs +5 more+113 -590 replies

Reviews trailers per patch

All 3 patches have a Reviewed-by or Acked-by.

PatchDaniel Almeida
1/3R-b
2/3R-b
3/3R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v6 thread

Cover letter [PATCH v6 0/3] Introduce DeviceContext

Previous version of this patch series:
https://patchwork.freedesktop.org/series/160217/#rev5

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.

Series-wide changes

V2:
* s/DeviceCtx/DeviceContext/ for consistency
* Move private driver-data availability to the Registration DeviceContext
* s/AnyCtx/Init/
V4:
* Split out DriverAllocImpl into it's own patch V6:
* Rebase

More changes described in each patch description.

Lyude Paul (3):
rust/drm: Introduce DeviceContext rust/drm/gem: Add DriverAllocImpl type alias rust/drm/gem: Use DeviceContext with GEM objects

 drivers/gpu/drm/nova/driver.rs |  10 +-
 drivers/gpu/drm/nova/gem.rs    |  15 ++-
 drivers/gpu/drm/tyr/driver.rs  |  12 +-
 drivers/gpu/drm/tyr/gem.rs     |  11 +-
 rust/kernel/drm/device.rs      | 240 +++++++++++++++++++++++++--------
 rust/kernel/drm/driver.rs      |  37 +++--
 rust/kernel/drm/gem/mod.rs     |  72 +++++++---
 rust/kernel/drm/gem/shmem.rs   |  57 ++++----
 rust/kernel/drm/mod.rs         |   4 +
 9 files changed, 333 insertions(+), 125 deletions(-)

base-commit: 37f748ed0c19e007e7c5677f5d605d6b93841792

Signature · 1 line
2.54.0