drm/i915: Compute display surface offset in the plane check hook for SKL+
authorVille Syrjälä <ville.syrjala@linux.intel.com>
Thu, 28 Jan 2016 14:53:54 +0000 (16:53 +0200)
committerVille Syrjälä <ville.syrjala@linux.intel.com>
Thu, 11 Aug 2016 15:35:10 +0000 (18:35 +0300)
commitb63a16f6cd8911e74816a307f8078e29564eadc0
tree0278b2eab212e5d1a975a1590cbd0d38335fa8a5
parent66a2d927cb0eb6767529454316ac36511cdffdac
drm/i915: Compute display surface offset in the plane check hook for SKL+

SKL has nasty limitations with the display surface offsets:
* source x offset + width must be less than the stride for X tiled
  surfaces or the display engine falls over
* the surface offset requires lots of alignment (256K or 1M)

These facts mean that we can't just pick any suitably aligned tile
boundary as the offset and expect the resulting x offset to be useable.
The solution is to start with the closest boundary as before, but then
keep searching backwards until we find one that works, or don't. This
means we must be prepared to fail, hence the whole surface offset
calculation needs to be moved to the .check_plane() hook from the
.update_plane() hook.

While at it we can check that the source width/height don't exceed
maximum plane size limits.

We'll store the results of the computation in the plane state to make
it easy for the .update_plane() hook to do its thing.

v2: Replace for+break loop with while loop
    Rebase due to drm_plane_state src/dst rects
    Rebase due to plane_check_state()

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Sivakumar Thulasimani <sivakumar.thulasimani@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1470821001-25272-11-git-send-email-ville.syrjala@linux.intel.com
drivers/gpu/drm/i915/intel_display.c
drivers/gpu/drm/i915/intel_drv.h
drivers/gpu/drm/i915/intel_sprite.c