All of lore.kernel.org
 help / color / mirror / Atom feed
From: Rodrigo Vivi <rodrigo.vivi@intel.com>
To: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH] drm/i915: Handle changing enable_fbc parameter at runtime better.
Date: Mon, 5 Mar 2018 10:50:14 -0800	[thread overview]
Message-ID: <20180305185014.GE15113@intel.com> (raw)
In-Reply-To: <20180305123608.20665-1-maarten.lankhorst@linux.intel.com>

On Mon, Mar 05, 2018 at 01:36:08PM +0100, Maarten Lankhorst wrote:
> If i915.enable_fbc is cleared at runtime, but FBC was previously enabled
> then we don't disable FBC until the next time the crtc is disabled.
> 
> Make sure that if the module param is changed, we disable FBC in
> intel_fbc_post_update so we never have to worry about disabling.

What about switching this from a parameter to debugfs toggle like drrs?

> 
> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> ---
>  drivers/gpu/drm/i915/intel_fbc.c | 62 +++++++++++++++++++++++-----------------
>  1 file changed, 36 insertions(+), 26 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_fbc.c b/drivers/gpu/drm/i915/intel_fbc.c
> index eaaa59b45707..5325b59c2f9c 100644
> --- a/drivers/gpu/drm/i915/intel_fbc.c
> +++ b/drivers/gpu/drm/i915/intel_fbc.c
> @@ -949,6 +949,30 @@ void intel_fbc_pre_update(struct intel_crtc *crtc,
>  	mutex_unlock(&fbc->lock);
>  }
>  
> +/**
> + * __intel_fbc_disable - disable FBC
> + * @dev_priv: i915 device instance
> + *
> + * This is the low level function that actually disables FBC. Callers should
> + * grab the FBC lock.
> + */
> +static void __intel_fbc_disable(struct drm_i915_private *dev_priv)
> +{
> +	struct intel_fbc *fbc = &dev_priv->fbc;
> +	struct intel_crtc *crtc = fbc->crtc;
> +
> +	WARN_ON(!mutex_is_locked(&fbc->lock));
> +	WARN_ON(!fbc->enabled);
> +	WARN_ON(fbc->active);
> +
> +	DRM_DEBUG_KMS("Disabling FBC on pipe %c\n", pipe_name(crtc->pipe));
> +
> +	__intel_fbc_cleanup_cfb(dev_priv);
> +
> +	fbc->enabled = false;
> +	fbc->crtc = NULL;
> +}
> +
>  static void __intel_fbc_post_update(struct intel_crtc *crtc)
>  {
>  	struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
> @@ -960,6 +984,13 @@ static void __intel_fbc_post_update(struct intel_crtc *crtc)
>  	if (!fbc->enabled || fbc->crtc != crtc)
>  		return;
>  
> +	if (!i915_modparams.enable_fbc) {
> +		intel_fbc_deactivate(dev_priv, "disabled at runtime per module param");
> +		__intel_fbc_disable(dev_priv);
> +
> +		return;
> +	}
> +
>  	if (!intel_fbc_can_activate(crtc)) {
>  		WARN_ON(fbc->active);
>  		return;
> @@ -1163,31 +1194,6 @@ void intel_fbc_enable(struct intel_crtc *crtc,
>  	mutex_unlock(&fbc->lock);
>  }
>  
> -/**
> - * __intel_fbc_disable - disable FBC
> - * @dev_priv: i915 device instance
> - *
> - * This is the low level function that actually disables FBC. Callers should
> - * grab the FBC lock.
> - */
> -static void __intel_fbc_disable(struct drm_i915_private *dev_priv)
> -{
> -	struct intel_fbc *fbc = &dev_priv->fbc;
> -	struct intel_crtc *crtc = fbc->crtc;
> -
> -	WARN_ON(!mutex_is_locked(&fbc->lock));
> -	WARN_ON(!fbc->enabled);
> -	WARN_ON(fbc->active);
> -	WARN_ON(crtc->active);
> -
> -	DRM_DEBUG_KMS("Disabling FBC on pipe %c\n", pipe_name(crtc->pipe));
> -
> -	__intel_fbc_cleanup_cfb(dev_priv);
> -
> -	fbc->enabled = false;
> -	fbc->crtc = NULL;
> -}
> -
>  /**
>   * intel_fbc_disable - disable FBC if it's associated with crtc
>   * @crtc: the CRTC
> @@ -1202,6 +1208,8 @@ void intel_fbc_disable(struct intel_crtc *crtc)
>  	if (!fbc_supported(dev_priv))
>  		return;
>  
> +	WARN_ON(crtc->active);
> +
>  	mutex_lock(&fbc->lock);
>  	if (fbc->crtc == crtc)
>  		__intel_fbc_disable(dev_priv);
> @@ -1224,8 +1232,10 @@ void intel_fbc_global_disable(struct drm_i915_private *dev_priv)
>  		return;
>  
>  	mutex_lock(&fbc->lock);
> -	if (fbc->enabled)
> +	if (fbc->enabled) {
> +		WARN_ON(fbc->crtc->active);
>  		__intel_fbc_disable(dev_priv);
> +	}
>  	mutex_unlock(&fbc->lock);
>  
>  	cancel_work_sync(&fbc->work.work);
> -- 
> 2.16.2
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  parent reply	other threads:[~2018-03-05 18:50 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-05 12:36 [PATCH] drm/i915: Handle changing enable_fbc parameter at runtime better Maarten Lankhorst
2018-03-05 13:18 ` ✓ Fi.CI.BAT: success for " Patchwork
2018-03-05 16:35 ` ✓ Fi.CI.IGT: " Patchwork
2018-03-05 18:50 ` Rodrigo Vivi [this message]
2018-03-06 10:22   ` [PATCH] " Maarten Lankhorst
2018-03-06 20:02     ` Rodrigo Vivi
2018-03-06 20:12       ` Maarten Lankhorst
2018-03-06 22:58         ` Rodrigo Vivi

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=20180305185014.GE15113@intel.com \
    --to=rodrigo.vivi@intel.com \
    --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.