Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@linux.intel.com>
To: Uma Shankar <uma.shankar@intel.com>, intel-gfx@lists.freedesktop.org
Subject: Re: [Intel-gfx] [PATCH] drm/i915/display: Add a vblank wait for FBC activation within same frame
Date: Thu, 10 Sep 2020 16:33:53 +0300	[thread overview]
Message-ID: <878sdh21tq.fsf@intel.com> (raw)
In-Reply-To: <20200910121153.6749-1-uma.shankar@intel.com>

On Thu, 10 Sep 2020, Uma Shankar <uma.shankar@intel.com> wrote:
> Add a vblank wait when fbc activation request comes for the
> same frame on TGL. This helps fix underrun related to fbc.
>
> Signed-off-by: Uma Shankar <uma.shankar@intel.com>
> ---
>  drivers/gpu/drm/i915/display/intel_fbc.c | 13 +++++++++++--
>  1 file changed, 11 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_fbc.c b/drivers/gpu/drm/i915/display/intel_fbc.c
> index 135f5e8a4d70..3e1d715e4a4e 100644
> --- a/drivers/gpu/drm/i915/display/intel_fbc.c
> +++ b/drivers/gpu/drm/i915/display/intel_fbc.c
> @@ -1055,6 +1055,7 @@ static void __intel_fbc_post_update(struct intel_crtc *crtc)
>  {
>  	struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
>  	struct intel_fbc *fbc = &dev_priv->fbc;
> +	static u32 old_frame_cnt, new_frame_cnt;

In the strongest terms, do not add static data. These would be shared
across devices, which is certainly a bug.

BR,
Jani.

>  
>  	drm_WARN_ON(&dev_priv->drm, !mutex_is_locked(&fbc->lock));
>  
> @@ -1075,10 +1076,18 @@ static void __intel_fbc_post_update(struct intel_crtc *crtc)
>  	if (!intel_fbc_can_activate(crtc))
>  		return;
>  
> -	if (!fbc->busy_bits)
> +	old_frame_cnt = new_frame_cnt;
> +	new_frame_cnt = intel_crtc_get_vblank_counter(crtc);
> +	if (!fbc->busy_bits) {
> +		if (IS_TIGERLAKE(dev_priv) &&
> +		    old_frame_cnt == new_frame_cnt) {
> +			drm_dbg_kms(&dev_priv->drm, "Wait for vblank before Activating FBC");
> +			intel_wait_for_vblank_if_active(dev_priv, crtc->pipe);
> +		}
>  		intel_fbc_hw_activate(dev_priv);
> -	else
> +	} else {
>  		intel_fbc_deactivate(dev_priv, "frontbuffer write");
> +	}
>  }
>  
>  void intel_fbc_post_update(struct intel_atomic_state *state,

-- 
Jani Nikula, Intel Open Source Graphics Center
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  parent reply	other threads:[~2020-09-10 13:33 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-10 12:11 [Intel-gfx] [PATCH] drm/i915/display: Add a vblank wait for FBC activation within same frame Uma Shankar
2020-09-10 13:28 ` [Intel-gfx] ✓ Fi.CI.BAT: success for " Patchwork
2020-09-10 13:33 ` Jani Nikula [this message]
2020-09-10 13:42   ` [Intel-gfx] [PATCH] " Shankar, Uma
2020-09-10 13:52     ` Ville Syrjälä
2020-09-10 13:59       ` Shankar, Uma
2020-09-10 15:31 ` [Intel-gfx] ✗ Fi.CI.IGT: failure for " Patchwork

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=878sdh21tq.fsf@intel.com \
    --to=jani.nikula@linux.intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=uma.shankar@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox