[RFC 0/4] Cursor support with universal planes

Matt Roper
2014-05-16T01:17:25Z

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, patch #1 in this 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.

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

Patch #3 does some minor i915 refactoring in preparation for the move to
universal planes.

Patch #4 transitions the i915 driver to universal planes. 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 (4):
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
drm/i915: Switch to unified plane cursor handling

drivers/gpu/drm/drm_crtc.c | 113 ++++++++++++++++++++-
drivers/gpu/drm/i915/intel_display.c | 188 ++++++++++++++++++++++++++++-------
drivers/gpu/drm/i915/intel_drv.h | 1 -
include/drm/drm_crtc.h | 6 +-
4 files changed, 267 insertions(+), 41 deletions(-)

--
1.8.5.1