drm/i915: Refactor work that can sleep out of commit (v2)

Once we integrate our work into the atomic pipeline, plane commit
operations will need to happen with interrupts disabled, due to vblank
evasion.  Create new 'pre_commit' and 'post_commit' handlers to cover
hardware programming operations that can sleep and thus must happen
outside the vblank evasion window.

v2: Fix broken sprite code split

Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
drm/i915: Move vblank evasion to commit (v2)

Move the vblank evasion up from the low-level, hw-specific
update_plane() handlers to the general plane commit operation.
Everything inside commit should now be non-sleeping, so this brings us
closer to how vblank evasion will behave once we move over to atomic.

v2: Restore lost intel_crtc->active check on vblank evasion

Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
drm/i915: Clarify sprite plane function names (v2)

A few of the sprite-related function names in i915 are very similar
(e.g., intel_enable_planes() vs intel_crtc_enable_planes()) and don't
make it clear whether they only operate on sprite planes, or whether
they also apply to all universal plane types.  Rename a few functions to
be more consistent with our function naming for primary/cursor planes or
to clarify that they apply specifically to sprite planes:

 - s/intel_disable_planes/intel_disable_sprite_planes/
 - s/intel_enable_planes/intel_enable_sprite_planes/

Also, drop the sprite-specific intel_destroy_plane() and just use
the type-agnostic intel_plane_destroy() function.  The extra 'disable'
call that intel_destroy_plane() did is unnecessary since the plane will
already be disabled due to framebuffer destruction by the point it gets
called.

v2: Earlier consolidation patches have reduced the number of functions
    we need to rename here.

Reviewed-by(v1): Bob Paauwe <bob.j.paauwe@intel.com>
Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
drm/i915: Make intel_crtc_has_pending_flip() non-static

We'll want to use this from the atomic plane helpers, so ensure it can
be called outside intel_display.c.

Reviewed-by: Bob Paauwe <bob.j.paauwe@intel.com>
Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
drm/i915: Prepare for atomic plane helpers (v5)

Add the new driver entrypoints that will be called by the atomic plane
helpers.

This patch does not actually switch over to the new plane helpers yet,
so there should be no functional change here.  Also note that although
plane programming was already split into check/prepare/commit steps,
some of the semantics of those individual functions will need to change
slightly when we do make the jump so that they match the behavior the
plane helpers expect.

v2:
 - Renamed file from intel_atomic.c to intel_atomic_plane.c (Daniel)
 - Fix a copy/paste comment mistake (Bob)

v3:
 - Use prepare/cleanup functions that we've already factored out
 - Use newly refactored pre_commit/commit/post_commit to avoid sleeping
   during vblank evasion

v4:
 - Rebase to latest di-nightly requires adding an 'old_state' parameter
   to atomic_update;

v5:
 - Must have botched a rebase somewhere and lost some work.  Restore
   state 'dirty' flag to let begin/end code know which planes to
   run the pre_commit/post_commit hooks for.  This would have actually
   shown up as broken in the next commit rather than this one.

Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
drm/i915: Switch plane handling to atomic helpers (v5)

Now that we have hooks to enable the atomic plane helpers, we can use
the plane helpers for our .update_plane() and .disable_plane()
entrypoints.

v2: Fix commit message typo (Bob)

v3: Rebased on top of Gustavo Padovan's patches to kill off
    intel_crtc_cursor_set_obj() and intel_pipe_set_base().

v4: Rebase again on latest display refactor series.  Now that previous
    patches have smoothed the rough edges of the existing display code,
    the transition here is much less painful.

v5: Plane helpers will re-prepare the same fb for a plane.  Drop the
    WARN on this condition.

Testcase: igt/kms_plane
Testcase: igt/kms_universal_plane
Testcase: igt/kms_cursor_crc
Acknowledged-by(v2): Bob Paauwe <bob.j.paauwe@intel.com>
Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
drm/i915: Drop unused position fields

The userspace-requested plane coordinates are now stored in
plane->state.base (and the i915-adjusted values are stored in
plane->state), so we no longer use the coordinate fields in intel_plane
or the orig_{src,dst} fields in intel_plane_state.  Drop them.

Reviewed-by: Bob Paauwe <bob.j.paauwe@intel.com>
Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
drm/i915: Integrate kerneldoc for atomic plane helpers

Signed-off-by: Matt Roper <matthew.d.roper@intel.com>