Re: [PATCH v3 7/7] drm/atomic: Clean up update_connector_routing.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Mar 03, 2016 at 10:17:42AM +0100, Maarten Lankhorst wrote:
> connector_state->crtc can no longer be unset by accident,
> so that check can be removed. The other code open-codes
> drm_atomic_get_existing_crtc_state, so use that.
> 
> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@xxxxxxxxxxxxxxx>
> ---
>  drivers/gpu/drm/drm_atomic_helper.c | 17 ++++-------------
>  1 file changed, 4 insertions(+), 13 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
> index 2395201eb7ab..9f0d16eb04b2 100644
> --- a/drivers/gpu/drm/drm_atomic_helper.c
> +++ b/drivers/gpu/drm/drm_atomic_helper.c
> @@ -265,7 +265,7 @@ update_connector_routing(struct drm_atomic_state *state,
>  	const struct drm_connector_helper_funcs *funcs;
>  	struct drm_encoder *new_encoder;
>  	struct drm_crtc_state *crtc_state;
> -	int idx, ret;
> +	int ret;
>  
>  	DRM_DEBUG_ATOMIC("Updating routing for [CONNECTOR:%d:%s]\n",
>  			 connector->base.id,
> @@ -273,16 +273,12 @@ update_connector_routing(struct drm_atomic_state *state,
>  
>  	if (connector->state->crtc != connector_state->crtc) {
>  		if (connector->state->crtc) {
> -			idx = drm_crtc_index(connector->state->crtc);
> -
> -			crtc_state = state->crtc_states[idx];
> +			crtc_state = drm_atomic_get_existing_crtc_state(state, connector->state->crtc);
>  			crtc_state->connectors_changed = true;
>  		}
>  
>  		if (connector_state->crtc) {
> -			idx = drm_crtc_index(connector_state->crtc);
> -
> -			crtc_state = state->crtc_states[idx];
> +			crtc_state = drm_atomic_get_existing_crtc_state(state, connector_state->crtc);
>  			crtc_state->connectors_changed = true;
>  		}
>  	}
> @@ -336,14 +332,9 @@ update_connector_routing(struct drm_atomic_state *state,
>  
>  	steal_encoder(state, new_encoder);
>  
> -	if (WARN_ON(!connector_state->crtc))
> -		return -EINVAL;
> -

I was going to suggest just this when I read the code previously.

>  	set_best_encoder(state, connector_state, new_encoder);
>  
> -	idx = drm_crtc_index(connector_state->crtc);
> -
> -	crtc_state = state->crtc_states[idx];
> +	crtc_state = drm_atomic_get_existing_crtc_state(state, connector_state->crtc);

These could have been a separate patch, but no biggie

Reviewed-by: Ville Syrjälä <ville.syrjala@xxxxxxxxxxxxxxx>

>  	crtc_state->connectors_changed = true;
>  
>  	DRM_DEBUG_ATOMIC("[CONNECTOR:%d:%s] using [ENCODER:%d:%s] on [CRTC:%d:%s]\n",
> -- 
> 2.1.0
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux