[RFC 00/11] atomic pageflip (v2)

Rob Clark rob.clark at linaro.org
Wed Sep 12 20:49:46 PDT 2012


From: Rob Clark <rob at ti.com>

This is following a bit the approach that Ville is taking for atomic-
modeset, in that it is switching over to using properties for everything.
The advantage of this approach is that it makes it easier to add new
attributes to set as part of a page-flip (and even opens the option to
add new object types).

The basic principles are:
 a) split out object state (in this case, plane and crtc, although I
    expect more to be added as atomic-modeset is added) into seperate
    structures that can be atomically commited or rolled back.  The
    property values array is also split out into the state structs,
    so that the property values visible to userspace automatically
    reflect the current state (ie. property changes are either
    committed or discarded depending on whether the state changes
    are committed or discarded).
 b) expand the object property API (set_property()) to take a state
    object.  The obj->set_property() simply updates the state object
    without actually applying the changes to the hw.
 c) after all the property updates are done, the updated state can
    be checked for correctness and against the hw capabilities, and
    then either discarded or committed atomically.

Since we need to include properties in the atomic-pageflip scheme,
doing everything via properties avoids updating a bunch of additional
driver provided callbacks.  Instead we just drop crtc->page_flip()
and plane->update_plane().  By splitting out the object's mutable
state into drm_{plane,crtc,etc}_state structs (which are wrapped by
the individual drivers to add their own hw specific state), we can
use some helpers (drm_{plane,crtc,etc}_set_property() and
drm_{plane,crtc,etc}_check_state()) to keep core error checking in
drm core and avoid pushing the burden of dealing with common
properties to the individual drivers.

The intention is for this to also simplify atomic-modeset, by
providing some of the necessary infrastructure (object property types,
signed property values, and property's whose usespace visible values
automatically tracks the object state which is either committed or
discarded depending on whether the state change was committed to hw
or not) which will also be needed for atomic-modeset.

So far, I've only updated omapdrm to the new APIs, as a proof of
concept.  Only a few drivers support drm plane, so I expect the
updates to convert drm-plane to properties should not be so hard.
Possibly for crtc/pageflip we might need to have a transition period
where we still support crtc->page_flip() code path until all drivers
are updated.

My complete branch is here:

  https://github.com/robclark/kernel-omap4/commits/drm_nuclear
  git://github.com/robclark/kernel-omap4.git drm_nuclear

Open points (I think) are:
 + should atomic-pageflip support flips on multiple CRTCs.  I think
   it at least simplifies things if the driver knows up front which
   CRTC(s) are involved, and whether the operation is modeset (sync)
   or pageflip (async).
 + How to deal w/ hardware restrictions which span multiple CRTCs.
   One idea is to get rid of the test flag in the atomic-pageflip
   ioctl, and always do test operations via atomic-modeset ioctl
   w/ the test flag.

Rob Clark (11):
  drm: add atomic fxns
  drm: add object property type
  drm: add DRM_MODE_PROP_DYNAMIC property flag
  drm: add DRM_MODE_PROP_SIGNED property flag
  drm: split property values out
  drm: convert plane to properties
  drm: add drm_plane_state
  drm: convert page_flip to properties
  drm: add drm_crtc_state
  drm: atomic pageflip
  drm/omap: update for atomic age

 drivers/gpu/drm/drm_crtc.c            |  838 ++++++++++++++++++++++++---------
 drivers/gpu/drm/drm_crtc_helper.c     |   51 +-
 drivers/gpu/drm/drm_drv.c             |    1 +
 drivers/gpu/drm/drm_fb_helper.c       |   11 +-
 drivers/staging/omapdrm/Makefile      |    1 +
 drivers/staging/omapdrm/omap_atomic.c |  339 +++++++++++++
 drivers/staging/omapdrm/omap_atomic.h |   52 ++
 drivers/staging/omapdrm/omap_crtc.c   |  246 +++++-----
 drivers/staging/omapdrm/omap_drv.c    |   21 +-
 drivers/staging/omapdrm/omap_drv.h    |   45 +-
 drivers/staging/omapdrm/omap_fb.c     |   44 +-
 drivers/staging/omapdrm/omap_plane.c  |  296 ++++++------
 include/drm/drm.h                     |    2 +
 include/drm/drmP.h                    |   52 ++
 include/drm/drm_crtc.h                |  179 +++++--
 include/drm/drm_mode.h                |   50 ++
 16 files changed, 1607 insertions(+), 621 deletions(-)
 create mode 100644 drivers/staging/omapdrm/omap_atomic.c
 create mode 100644 drivers/staging/omapdrm/omap_atomic.h

-- 
1.7.9.5



More information about the dri-devel mailing list