drm/i915: clean up atomic plane check functions, v2.

By passing crtc_state to the check_plane functions a lot of duplicated
code can be removed. There are still some transitional helper calls,
they will be removed later.

Changes since v1:
- Revert state->visible changes.
- Use plane->state->crtc instead of plane->crtc.
- Use drm_atomic_get_existing_crtc_state.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Reviewed-by: Matt Roper <matthew.d.roper@intel.com>
Tested-by(IVB): Matt Roper <matthew.d.roper@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
This commit is contained in:
Maarten Lankhorst
2015-06-15 12:33:46 +02:00
committed by Daniel Vetter
parent 302d19ac76
commit 061e4b8d65
4 changed files with 29 additions and 45 deletions

View File

@@ -116,7 +116,7 @@ static int intel_plane_atomic_check(struct drm_plane *plane,
struct intel_plane_state *intel_state = to_intel_plane_state(state);
int ret;
crtc = crtc ? crtc : plane->crtc;
crtc = crtc ? crtc : plane->state->crtc;
intel_crtc = to_intel_crtc(crtc);
/*
@@ -131,10 +131,13 @@ static int intel_plane_atomic_check(struct drm_plane *plane,
/* FIXME: temporary hack necessary while we still use the plane update
* helper. */
if (state->state) {
crtc_state =
intel_atomic_get_crtc_state(state->state, intel_crtc);
if (IS_ERR(crtc_state))
return PTR_ERR(crtc_state);
struct drm_crtc_state *drm_crtc_state =
drm_atomic_get_existing_crtc_state(state->state, crtc);
if (WARN_ON(!drm_crtc_state))
return -EINVAL;
crtc_state = to_intel_crtc_state(drm_crtc_state);
} else {
crtc_state = intel_crtc->config;
}
@@ -185,7 +188,8 @@ static int intel_plane_atomic_check(struct drm_plane *plane,
}
}
ret = intel_plane->check_plane(plane, intel_state);
intel_state->visible = false;
ret = intel_plane->check_plane(plane, crtc_state, intel_state);
if (ret || !state->state)
return ret;