All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel@ffwll.ch>
To: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH] drm/i915: Do not use lock all in hsw_trans_edp_pipe_A_crc_wa
Date: Wed, 12 Apr 2017 10:55:41 +0200	[thread overview]
Message-ID: <20170412085541.pkskn366wsqqeokm@phenom.ffwll.local> (raw)
In-Reply-To: <1491312297-18673-1-git-send-email-maarten.lankhorst@linux.intel.com>

On Tue, Apr 04, 2017 at 03:24:57PM +0200, Maarten Lankhorst wrote:
> There is no need to acquire all locks here,
> doing a commit after forcing a modeset on the affected crtc
> is enough. Any other locks needed will be acquired as needed.
> 
> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> ---
>  drivers/gpu/drm/i915/intel_pipe_crc.c | 17 ++++++++++++++---
>  1 file changed, 14 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_pipe_crc.c b/drivers/gpu/drm/i915/intel_pipe_crc.c
> index 9fd9c70baeed..647426c75b0a 100644
> --- a/drivers/gpu/drm/i915/intel_pipe_crc.c
> +++ b/drivers/gpu/drm/i915/intel_pipe_crc.c
> @@ -513,16 +513,20 @@ static void hsw_trans_edp_pipe_A_crc_wa(struct drm_i915_private *dev_priv,
>  	struct intel_crtc *crtc = intel_get_crtc_for_pipe(dev_priv, PIPE_A);
>  	struct intel_crtc_state *pipe_config;
>  	struct drm_atomic_state *state;
> +	struct drm_modeset_acquire_ctx ctx;
>  	int ret = 0;
>  
> -	drm_modeset_lock_all(dev);
> +	drm_modeset_acquire_init(&ctx, 0);
> +
>  	state = drm_atomic_state_alloc(dev);
>  	if (!state) {
>  		ret = -ENOMEM;
>  		goto unlock;
>  	}
>  
> -	state->acquire_ctx = drm_modeset_legacy_acquire_ctx(&crtc->base);
> +	state->acquire_ctx = &ctx;
> +
> +retry:
>  	pipe_config = intel_atomic_get_crtc_state(state, crtc);
>  	if (IS_ERR(pipe_config)) {
>  		ret = PTR_ERR(pipe_config);
> @@ -537,10 +541,17 @@ static void hsw_trans_edp_pipe_A_crc_wa(struct drm_i915_private *dev_priv,
>  	ret = drm_atomic_commit(state);
>  
>  put_state:
> +	if (ret == -EDEADLK) {
> +		drm_atomic_state_clear(state);

Random idea of the day: Should we treat the atomic state like a special ww
mutex to make sure it's properly cleared when we drop the locks? Not sure
that's feasible, reasonable and how badly it'd break the suspend/resume
helpers, but would be good to make sure we always clear the state before
dropping locks.

Anyway, that idea aside, patch lgtm.

Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>

> +		drm_modeset_backoff(&ctx);
> +		goto retry;
> +	}
> +
>  	drm_atomic_state_put(state);
>  unlock:
>  	WARN(ret, "Toggling workaround to %i returns %i\n", enable, ret);
> -	drm_modeset_unlock_all(dev);
> +	drm_modeset_drop_locks(&ctx);
> +	drm_modeset_acquire_fini(&ctx);
>  }
>  
>  static int ivb_pipe_crc_ctl_reg(struct drm_i915_private *dev_priv,
> -- 
> 2.7.4
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

      parent reply	other threads:[~2017-04-12  8:55 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-04 13:24 [PATCH] drm/i915: Do not use lock all in hsw_trans_edp_pipe_A_crc_wa Maarten Lankhorst
2017-04-04 14:37 ` ✓ Fi.CI.BAT: success for " Patchwork
2017-04-12  8:55 ` Daniel Vetter [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170412085541.pkskn366wsqqeokm@phenom.ffwll.local \
    --to=daniel@ffwll.ch \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=maarten.lankhorst@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.