Commit d4afb8cc authored by Ander Conselvan de Oliveira's avatar Ander Conselvan de Oliveira Committed by Daniel Vetter

drm/i915: Don't use plane update helper in legacy mode set

Use lower level calls to better integrate with the modeset code and
allow a full state swap in a follow up patch.
Signed-off-by: default avatarAnder Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>
Reviewed-by: default avatarMaarten Lankhorst <maarten.lankhorst@linux.intel.com>
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
parent 4978cc93
...@@ -12332,6 +12332,23 @@ static int __intel_set_mode_checks(struct drm_atomic_state *state) ...@@ -12332,6 +12332,23 @@ static int __intel_set_mode_checks(struct drm_atomic_state *state)
return 0; return 0;
} }
static void __intel_set_mode_swap_plane_state(struct drm_device *dev,
struct drm_atomic_state *state)
{
int i;
for (i = 0; i < dev->mode_config.num_total_plane; i++) {
struct drm_plane *plane = state->planes[i];
if (!plane)
continue;
plane->state->state = state;
swap(state->plane_states[i], plane->state);
plane->state->state = NULL;
}
}
static int __intel_set_mode(struct drm_crtc *modeset_crtc, static int __intel_set_mode(struct drm_crtc *modeset_crtc,
struct intel_crtc_state *pipe_config) struct intel_crtc_state *pipe_config)
{ {
...@@ -12342,8 +12359,6 @@ static int __intel_set_mode(struct drm_crtc *modeset_crtc, ...@@ -12342,8 +12359,6 @@ static int __intel_set_mode(struct drm_crtc *modeset_crtc,
struct intel_crtc *intel_crtc; struct intel_crtc *intel_crtc;
struct drm_crtc *crtc; struct drm_crtc *crtc;
struct drm_crtc_state *crtc_state; struct drm_crtc_state *crtc_state;
struct drm_plane *plane;
struct drm_plane_state *plane_state;
int ret = 0; int ret = 0;
int i; int i;
...@@ -12351,6 +12366,10 @@ static int __intel_set_mode(struct drm_crtc *modeset_crtc, ...@@ -12351,6 +12366,10 @@ static int __intel_set_mode(struct drm_crtc *modeset_crtc,
if (ret < 0) if (ret < 0)
return ret; return ret;
ret = drm_atomic_helper_prepare_planes(dev, state);
if (ret)
return ret;
crtc_state_copy = kmalloc(sizeof(*crtc_state_copy), GFP_KERNEL); crtc_state_copy = kmalloc(sizeof(*crtc_state_copy), GFP_KERNEL);
if (!crtc_state_copy) if (!crtc_state_copy)
return -ENOMEM; return -ENOMEM;
...@@ -12395,26 +12414,8 @@ static int __intel_set_mode(struct drm_crtc *modeset_crtc, ...@@ -12395,26 +12414,8 @@ static int __intel_set_mode(struct drm_crtc *modeset_crtc,
modeset_update_crtc_power_domains(state); modeset_update_crtc_power_domains(state);
for_each_plane_in_state(state, plane, plane_state, i) { __intel_set_mode_swap_plane_state(dev, state);
if (WARN_ON(plane != modeset_crtc->primary)) drm_atomic_helper_commit_planes(dev, state);
continue;
/* Primary plane is disabled in intel_crtc_disable() */
if (!pipe_config->base.enable)
continue;
ret = drm_plane_helper_update(plane, plane_state->crtc,
plane_state->fb,
plane_state->crtc_x,
plane_state->crtc_y,
plane_state->crtc_w,
plane_state->crtc_h,
plane_state->src_x,
plane_state->src_y,
plane_state->src_w,
plane_state->src_h);
WARN_ON(ret != 0);
}
/* Now enable the clocks, plane, pipe, and connectors that we set up. */ /* Now enable the clocks, plane, pipe, and connectors that we set up. */
for_each_crtc_in_state(state, crtc, crtc_state, i) { for_each_crtc_in_state(state, crtc, crtc_state, i) {
...@@ -12437,6 +12438,8 @@ static int __intel_set_mode(struct drm_crtc *modeset_crtc, ...@@ -12437,6 +12438,8 @@ static int __intel_set_mode(struct drm_crtc *modeset_crtc,
intel_crtc->config = crtc_state_copy; intel_crtc->config = crtc_state_copy;
intel_crtc->base.state = &crtc_state_copy->base; intel_crtc->base.state = &crtc_state_copy->base;
drm_atomic_helper_cleanup_planes(dev, state);
drm_atomic_state_free(state); drm_atomic_state_free(state);
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment