[Intel-gfx] [PATCH] drm/i915: Send vblank event when requested in atomic commit.

Maarten Lankhorst maarten.lankhorst at linux.intel.com
Tue Jul 21 05:26:45 PDT 2015


Op 21-07-15 om 14:05 schreef Maarten Lankhorst:
> This is probably slightly wrong, but better than not sending events.
>
> Signed-off-by: Maarten Lankhorst <maarten.lankhorst at linux.intel.com>
> ---
> diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> index 82da2c54bd2e..10bb66ec493a 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -11456,8 +11456,14 @@ retry:
>  			drm_atomic_set_fb_for_plane(plane_state, fb);
>  
>  			ret = drm_atomic_set_crtc_for_plane(plane_state, crtc);
> -			if (!ret)
> -				ret = drm_atomic_commit(state);
> +		}
> +
> +		if (!ret) {
> +			struct drm_crtc_state *crtc_state =
> +			    drm_atomic_get_existing_crtc_state(state, crtc);
> +
> +			crtc_state->event = event;
> +			ret = drm_atomic_commit(state);
>  		}
>  
>  		if (ret == -EDEADLK) {
> @@ -11468,12 +11474,6 @@ retry:
>  
>  		if (ret)
>  			drm_atomic_state_free(state);
> -
> -		if (ret == 0 && event) {
> -			spin_lock_irq(&dev->event_lock);
> -			drm_send_vblank_event(dev, pipe, event);
> -			spin_unlock_irq(&dev->event_lock);
> -		}
>  	}
>  	return ret;
>  }
> @@ -13089,6 +13089,14 @@ static int intel_atomic_commit(struct drm_device *dev,
>  	drm_atomic_helper_wait_for_vblanks(dev, state);
>  	drm_atomic_helper_cleanup_planes(dev, state);
>  
> +	for_each_crtc_in_state(state, crtc, crtc_state, i)
> +		if (crtc->state->event) {
> +			spin_lock_irq(&dev->event_lock);
> +			drm_crtc_send_vblank_event(dev, crtc, crtc->state->event);
> +			crtc->state->event = NULL;
> +			spin_unlock_irq(&dev->event_lock);
> +		}
> +
>  	if (any_ms)
>  		intel_modeset_check_state(dev, state);
>  
>
Fails to compile, should have been a RFC.


More information about the Intel-gfx mailing list