[Intel-gfx] [PATCH 15/19] drm/i915: Prepare MST connector removal for async unpin.

Patrik Jakobsson patrik.jakobsson at linux.intel.com
Wed May 11 09:26:37 UTC 2016


On Tue, Apr 19, 2016 at 09:52:35AM +0200, Maarten Lankhorst wrote:
> check_connector_state might get called from unpin_work, which means

verify_connector_state and not check_connector_state?

Otherwise looks good

Reviewed-by: Patrik Jakobsson <patrik.jakobsson at linux.intel.com>

> that the mst removal function has to flush it, and it has to use
> for_each_intel_connector because it cannot check if connection_mutex
> is held.
> 
> Signed-off-by: Maarten Lankhorst <maarten.lankhorst at linux.intel.com>
> ---
>  drivers/gpu/drm/i915/intel_display.c | 12 ++++++------
>  drivers/gpu/drm/i915/intel_dp_mst.c  | 11 +++++++++++
>  drivers/gpu/drm/i915/intel_drv.h     |  1 +
>  3 files changed, 18 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> index 5d60b3a8f06c..6feb8c6ccb8c 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -3900,7 +3900,7 @@ static void page_flip_completed(struct intel_crtc *intel_crtc, struct intel_flip
>  	queue_work(dev_priv->wq, &work->unpin_work);
>  }
>  
> -static int intel_crtc_wait_for_pending_flips(struct drm_crtc *crtc)
> +int intel_crtc_wait_for_pending_flips(struct drm_crtc *crtc)
>  {
>  	struct drm_device *dev = crtc->dev;
>  	struct drm_i915_private *dev_priv = dev->dev_private;
> @@ -12458,16 +12458,16 @@ static void verify_wm_state(struct drm_crtc *crtc,
>  static void
>  verify_connector_state(struct drm_device *dev, struct drm_crtc *crtc)
>  {
> -	struct drm_connector *connector;
> +	struct intel_connector *connector;
>  
> -	drm_for_each_connector(connector, dev) {
> -		struct drm_encoder *encoder = connector->encoder;
> -		struct drm_connector_state *state = connector->state;
> +	for_each_intel_connector(dev, connector) {
> +		struct drm_connector_state *state = connector->base.state;
> +		struct drm_encoder *encoder = connector->base.encoder;
>  
>  		if (state->crtc != crtc)
>  			continue;
>  
> -		intel_connector_verify_state(to_intel_connector(connector));
> +		intel_connector_verify_state(connector);
>  
>  		I915_STATE_WARN(state->best_encoder != encoder,
>  		     "connector's atomic encoder doesn't match legacy encoder\n");
> diff --git a/drivers/gpu/drm/i915/intel_dp_mst.c b/drivers/gpu/drm/i915/intel_dp_mst.c
> index 94b4e833dadd..ab24f3ea08bc 100644
> --- a/drivers/gpu/drm/i915/intel_dp_mst.c
> +++ b/drivers/gpu/drm/i915/intel_dp_mst.c
> @@ -501,6 +501,7 @@ static void intel_dp_destroy_mst_connector(struct drm_dp_mst_topology_mgr *mgr,
>  {
>  	struct intel_connector *intel_connector = to_intel_connector(connector);
>  	struct drm_device *dev = connector->dev;
> +	struct drm_crtc *crtc;
>  
>  	intel_connector->unregister(intel_connector);
>  
> @@ -518,6 +519,16 @@ static void intel_dp_destroy_mst_connector(struct drm_dp_mst_topology_mgr *mgr,
>  		WARN(ret, "Disabling mst crtc failed with %i\n", ret);
>  	}
>  
> +	/* Ensure any hw state checker call is completed */
> +	for_each_crtc(dev, crtc)
> +		intel_crtc_wait_for_pending_flips(crtc);
> +
> +	/*
> +	 * Before removing the connector, make sure all work is flushed
> +	 * because it may traverse the connector list.
> +	 */
> +	flush_workqueue(to_i915(dev)->wq);
> +
>  	intel_connector_remove_from_fbdev(intel_connector);
>  	drm_connector_cleanup(connector);
>  	drm_modeset_unlock_all(dev);
> diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
> index 0ec81df35710..d2cfb50332be 100644
> --- a/drivers/gpu/drm/i915/intel_drv.h
> +++ b/drivers/gpu/drm/i915/intel_drv.h
> @@ -1145,6 +1145,7 @@ intel_wait_for_vblank_if_active(struct drm_device *dev, int pipe)
>  	if (crtc->active)
>  		intel_wait_for_vblank(dev, pipe);
>  }
> +int intel_crtc_wait_for_pending_flips(struct drm_crtc *crtc);
>  
>  u32 intel_crtc_get_vblank_counter(struct intel_crtc *crtc);
>  
> -- 
> 2.1.0
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Intel Sweden AB Registered Office: Knarrarnasgatan 15, 164 40 Kista, Stockholm, Sweden Registration Number: 556189-6027 


More information about the Intel-gfx mailing list