[PATCH 0/6] Cursor support with universal planes (v3)

Matt Roper matthew.d.roper at intel.com
Mon May 19 16:58:36 PDT 2014

(respinning the whole patch series to pull the entire set back together now
that a couple patches have been added at the beginning)

Cursor planes are a bit trickier to support via the universal plane interface
than primary planes were.  Legacy cursor ioctls take handles to driver buffers
directly whereas the universal plane API takes drm_framebuffer's that represent
a buffer; due to this mismatch it isn't possible to implement a set of cursor
helpers than provide "free" generic universal cursor support without driver
changes as we did with primary planes.  Drivers will need to be updated to
receive cursor support via the universal plane API.

If a driver tries to implement two interfaces for cursor support (legacy ioctl
and universal planes), the reference counting can get very tricky/messy since
we need to take into account userspace that may mix and match calls to both
interfaces.  To address that, this patch set causes legacy cursor ioctls
to be implemented using a driver's universal plane support if the driver
registers a primary plane.  Calls to the legacy set_cursor ioctl will wrap the
provided driver buffer in a drm_framebuffer and then pass that along to the
universal plane interface.  From a driver's point of view, this causes all
cursor operations to arrive on the universal plane interface, regardless of
which userspace API was used, which simplifies things greatly for the driver.

Patches #1 and #2 refactor the main logic of the add_fb2 and setplane ioctls
out into new functions that are intended for use by internal callers.  The
legacy -> universal cursor code will make use of these internal functions.

Patch #3 causes calls to the legacy cursor ioctls to be redirected to the
universal plane interface if a driver has registered a cursor plane with the
DRM core.  Cursor buffers are wrapped in a new DRM framebuffer and then
passed to the internal setplane interface for processing.

Patch #4 makes some minor changes to ensure drivers can successfully register a
cursor plane with the DRM core.

Patches #5 and #6 migrate the i915 driver to use universal planes for cursor
support.  The changes here are intentionally minimal for ease of review.  It's
likely that we could perform further cleanup in the future to eliminate some of
the cursor state tracked in intel_crtc (e.g., cursor_width/cursor_height) since
that information can be also be derived from crtc->cursor->fb.

Matt Roper (6):
  drm: Refactor framebuffer creation to allow internal use (v2)
  drm: Refactor setplane to allow internal use (v2)
  drm: Support legacy cursor ioctls via universal planes when possible
  drm: Allow drivers to register cursor planes with crtc
  drm/i915: Add intel_crtc_cursor_set_obj() to set cursor buffer (v2)
  drm/i915: Switch to unified plane cursor handling (v2)

 drivers/gpu/drm/drm_crtc.c           | 342 ++++++++++++++++++++++++-----------
 drivers/gpu/drm/i915/intel_display.c | 169 +++++++++++++----
 drivers/gpu/drm/i915/intel_drv.h     |   1 -
 include/drm/drm_crtc.h               |   6 +-
 4 files changed, 376 insertions(+), 142 deletions(-)

Cc: intel-gfx at lists.freedesktop.org

More information about the dri-devel mailing list