[Intel-gfx] [PATCH 12/42] drm/i915: move swap_state to the right place

Daniel Vetter daniel at ffwll.ch
Tue May 12 01:25:11 PDT 2015


On Mon, May 11, 2015 at 04:24:48PM +0200, Maarten Lankhorst wrote:
> Done as a separate commit to allow better bisecting.

Assuming my comments on patch 10 pan out this would boil down to just
moving the swap_state call up a bit, plus adjusting the loop over the
old_state in the disable loops like this patch does already. Given that
things are still a bit unclear I didn't carefully review whether you've
missed any of those, but makes sense otherwise.
-Daniel

> 
> Signed-off-by: Maarten Lankhorst <maarten.lankhorst at linux.intel.com>
> ---
>  drivers/gpu/drm/i915/intel_display.c | 50 +++++-------------------------------
>  1 file changed, 7 insertions(+), 43 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> index a90ebc8eff6f..253d9cd4154a 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -11437,28 +11437,9 @@ intel_modeset_update_state(struct drm_atomic_state *state)
>  	struct drm_crtc *crtc;
>  	struct drm_crtc_state *crtc_state;
>  	struct drm_connector *connector;
> -	struct drm_connector_state *connector_state;
> -	int i;
>  
>  	intel_shared_dpll_commit(dev_priv);
>  
> -	/*
> -	 * swap crtc and connector state, plane state is already swapped in
> -	 * __intel_set_mode_update_planes. Once .crtc_disable is fixed
> -	 * all state should be swapped before disabling crtc's.
> -	 */
> -	for_each_crtc_in_state(state, crtc, crtc_state, i) {
> -		crtc->state->state = state;
> -		swap(state->crtc_states[i], crtc->state);
> -		crtc->state->state = NULL;
> -	}
> -
> -	for_each_connector_in_state(state, connector, connector_state, i) {
> -		connector->state->state = state;
> -		swap(state->connector_states[i], connector->state);
> -		connector->state->state = NULL;
> -	}
> -
>  	for_each_intel_encoder(dev, intel_encoder) {
>  		if (!intel_encoder->base.crtc)
>  			continue;
> @@ -12183,21 +12164,6 @@ static void __intel_set_mode_update_planes(struct drm_device *dev,
>  	struct drm_plane *plane;
>  	struct drm_crtc *crtc;
>  
> -	/*
> -	 * For now only swap plane state, will be replaced with a
> -	 * call to drm_atomic_helper_swap_state
> -	 */
> -	for_each_plane_in_state(state, plane, old_plane_state, 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;
> -	}
> -
>  	for_each_crtc_in_state(state, crtc, crtc_state, i) {
>  		const struct drm_crtc_helper_funcs *funcs;
>  
> @@ -12206,10 +12172,6 @@ static void __intel_set_mode_update_planes(struct drm_device *dev,
>  		if (!funcs || !funcs->atomic_begin)
>  			continue;
>  
> -		/* XXX: Hack because crtc state is not swapped */
> -		crtc->state->mode_changed = crtc_state->mode_changed;
> -		crtc->state->active_changed = crtc_state->active_changed;
> -
>  		DRM_DEBUG_ATOMIC("Calling atomic_begin on crtc %i\n", i);
>  		funcs->atomic_begin(crtc);
>  	}
> @@ -12287,7 +12249,7 @@ static int __intel_set_mode(struct drm_crtc *modeset_crtc,
>  	struct drm_i915_private *dev_priv = dev->dev_private;
>  	struct drm_atomic_state *state = pipe_config->base.state;
>  	struct drm_crtc *crtc;
> -	struct drm_crtc_state *crtc_state;
> +	struct drm_crtc_state *old_crtc_state;
>  	int ret;
>  	int i;
>  
> @@ -12299,15 +12261,17 @@ static int __intel_set_mode(struct drm_crtc *modeset_crtc,
>  	if (ret)
>  		return ret;
>  
> +	drm_atomic_helper_swap_state(dev, state);
> +
>  	__intel_set_mode_update_planes(dev, state);
>  
> -	for_each_crtc_in_state(state, crtc, crtc_state, i) {
> +	for_each_crtc_in_state(state, crtc, old_crtc_state, i) {
>  		struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
>  
> -		if (!needs_modeset(crtc_state))
> +		if (!needs_modeset(crtc->state))
>  			continue;
>  
> -		if (!crtc->state->active)
> +		if (!old_crtc_state->active)
>  			continue;
>  
>  		intel_crtc_dpms_overlay_disable(to_intel_crtc(crtc));
> @@ -12329,7 +12293,7 @@ static int __intel_set_mode(struct drm_crtc *modeset_crtc,
>  	modeset_update_crtc_power_domains(state);
>  
>  	/* 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, old_crtc_state, i) {
>  		if (!crtc->state->active) {
>  			if (needs_modeset(crtc->state))
>  				intel_update_watermarks(crtc);
> -- 
> 2.1.0
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch


More information about the Intel-gfx mailing list