Skip to content

drm/msm/mdp5: atomic smp + hwpipe assignment

Rob Clark dri-devel linux-arm-msm 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest4 of 5 patches 4 repliesIn review

4 of 5 patches are in this archive. The cover letter announces 5.

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/5drm/msm/mdp5: introduce mdp5_hw_pipedrivers/gpu/drm/msm/Makefile drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.h +3 more+197 -853 replies
2/5drm/msm: subclass drm_atomic_statedrivers/gpu/drm/msm/msm_atomic.c drivers/gpu/drm/msm/msm_drv.c drivers/gpu/drm/msm/msm_drv.h +1 more+51 -00 replies
4/5drm/msm/mdp5: dynamically assign hw pipes to planesdrivers/gpu/drm/msm/mdp/mdp5/mdp5_crtc.c drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.h +3 more+171 -801 reply
5/5drm/msm/mdp5: handle SMP block allocations "atomically"drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.h drivers/gpu/drm/msm/mdp/mdp5/mdp5_pipe.c +4 more+193 -2450 replies

Reviews trailers per patch

1 of 4 patches has a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchArchit Taneja
SeriesR-b
1/5R-b
2/5
4/5
5/5

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

Read the v1 thread

Cover letter [PATCH 0/5] drm/msm/mdp5: atomic smp + hwpipe assignment

In the process of getting kms fence fd (and related gpu egl fence fd extension) working with real hardware (using android drm-hwc) I found a lot of issues w/ plane support. Perhaps that is to be expected the first time getting a userspace that actually makes heavy use of overlay planes working. So some of the approaches here may be useful to other drivers when they cross that bridge.

The mdp5 hw, in particular variants that have "SMP" (Shared Memory Pool, ie. shared FIFO blocks that are allocated to the various hw pipes) have a lot of constraints that a generic userspace is not aware of. Such as not being able to arbitrarily change scanout width or pixel format on an active pipe. In addition, not all pipes can support all features (YUV, rotation, and in some cases, scaling).

Additionally, during the initial conversion to atomic, we did not handle SMP block allocation in plane->atomic_check(), leading to cases where an update could fail in plane->atomic_update() due to failure to allocate SMP blocks.

To solve this:
(1) dynamically assign hw pipes to planes at ->atomic_check() based on the required plane capabilities
(2) handle SMP block allocation in ->atomic_check(). When SMP block allocation needs to change, re-assign a new hw pipe

To do this, we need to track the SMP block allocation, and hw pipe assignment in a global atomic state object. This way, we ensure that multiple updates from different threads which touch shared state (the hw pipe assignemnt or SMP block allocation) are properly serialized (via state_lock), and atomic test-only updates, or commits that fail in atomic_check() (or deadlock/backoff scenarios) are properly un- wound by simply throwing away the new state objects.

The global state is handled in the same way as plane/crtc/etc state. On mdp5_get_state(), the state_lock is acquired as part of the atomic acquire_ctx, and the current state is copied. At that point changes to the copied state are permitted. New plane state can reference new hw pipes, since the assignment of hw pipes is tracked in the global state. At any point the new state can be thrown away (along with the various new plane state objects that reference it as part of the new drm_atomic_state). And if the new state is committed, the new global state is swapped with old state, in the same way per-plane/ crtc/connector state is handled, preserving consistency between global and per-plane state.

Rob Clark (5):
drm/msm/mdp5: introduce mdp5_hw_pipe
drm/msm: subclass drm_atomic_state drm/msm/mdp5: add skeletal mdp5_state drm/msm/mdp5: dynamically assign hw pipes to planes drm/msm/mdp5: handle SMP block allocations "atomically"

 drivers/gpu/drm/msm/Makefile              |   1 +
 drivers/gpu/drm/msm/mdp/mdp5/mdp5_crtc.c  |   2 +-
 drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c   | 180 +++++++++++++++-----
 drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.h   |  33 +++-
 drivers/gpu/drm/msm/mdp/mdp5/mdp5_pipe.c  | 132 +++++++++++++++
 drivers/gpu/drm/msm/mdp/mdp5/mdp5_pipe.h  |  54 ++++++
 drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c | 202 +++++++++-------------
 drivers/gpu/drm/msm/mdp/mdp5/mdp5_smp.c   | 270 ++++++++++--------------------
 drivers/gpu/drm/msm/mdp/mdp5/mdp5_smp.h   |  66 ++++++--
 drivers/gpu/drm/msm/msm_atomic.c          |  31 ++++
 drivers/gpu/drm/msm/msm_drv.c             |   3 +
 drivers/gpu/drm/msm/msm_drv.h             |   3 +
 drivers/gpu/drm/msm/msm_kms.h             |  14 ++
 13 files changed, 629 insertions(+), 362 deletions(-)
 create mode 100644 drivers/gpu/drm/msm/mdp/mdp5/mdp5_pipe.c
 create mode 100644 drivers/gpu/drm/msm/mdp/mdp5/mdp5_pipe.h
Signature · 1 line
2.7.4