Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Uma Shankar <uma.shankar@intel.com>
To: intel-gfx@lists.freedesktop.org
Subject: [Intel-gfx] [PATCH] drm/i915/display: Add a vblank wait for FBC activation within same frame
Date: Thu, 10 Sep 2020 17:41:53 +0530	[thread overview]
Message-ID: <20200910121153.6749-1-uma.shankar@intel.com> (raw)

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;
 
 	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,
-- 
2.26.2

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

             reply	other threads:[~2020-09-10 11:36 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-10 12:11 Uma Shankar [this message]
2020-09-10 13:28 ` [Intel-gfx] ✓ Fi.CI.BAT: success for drm/i915/display: Add a vblank wait for FBC activation within same frame Patchwork
2020-09-10 13:33 ` [Intel-gfx] [PATCH] " Jani Nikula
2020-09-10 13:42   ` 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=20200910121153.6749-1-uma.shankar@intel.com \
    --to=uma.shankar@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    /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