linux-arm-msm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Rob Clark <robdclark@gmail.com>
To: dri-devel@lists.freedesktop.org
Cc: linux-arm-msm@vger.kernel.org, freedreno@lists.freedesktop.org,
	Archit Taneja <architt@codeaurora.org>,
	Daniel Vetter <daniel@ffwll.ch>,
	Sean Paul <seanpaul@chromium.org>,
	Rob Clark <robdclark@gmail.com>
Subject: [PATCH 0/5] drm/msm/mdp5: atomic smp + hwpipe assignment
Date: Sat,  5 Nov 2016 12:25:56 -0400	[thread overview]
Message-ID: <1478363161-29293-1-git-send-email-robdclark@gmail.com> (raw)

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

-- 
2.7.4

             reply	other threads:[~2016-11-05 16:26 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-05 16:25 Rob Clark [this message]
2016-11-05 16:25 ` [PATCH 1/5] drm/msm/mdp5: introduce mdp5_hw_pipe Rob Clark
2016-11-07 10:38   ` Archit Taneja
     [not found]     ` <1c36659b-753e-12d4-c958-79d0e8d2af88-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2016-11-07 14:48       ` Rob Clark
2016-11-07 15:39         ` Archit Taneja
2016-11-05 16:25 ` [PATCH 2/5] drm/msm: subclass drm_atomic_state Rob Clark
     [not found] ` <1478363161-29293-1-git-send-email-robdclark-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-11-05 16:25   ` [PATCH 3/5] drm/msm/mdp5: add skeletal mdp5_state Rob Clark
     [not found]     ` <1478363161-29293-4-git-send-email-robdclark-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-11-07 10:29       ` Archit Taneja
2016-11-07 11:31         ` Rob Clark
2016-11-05 16:26 ` [PATCH 4/5] drm/msm/mdp5: dynamically assign hw pipes to planes Rob Clark
2016-11-07 10:29   ` Archit Taneja
2016-11-05 16:26 ` [PATCH 5/5] drm/msm/mdp5: handle SMP block allocations "atomically" Rob Clark

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1478363161-29293-1-git-send-email-robdclark@gmail.com \
    --to=robdclark@gmail.com \
    --cc=architt@codeaurora.org \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=freedreno@lists.freedesktop.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=seanpaul@chromium.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).