[Intel-gfx] [PATCH] drm/i915/display: Add a vblank wait for FBC activation within same frame

Uma Shankar uma.shankar at intel.com
Thu Sep 10 12:11:53 UTC 2020


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 at 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



More information about the Intel-gfx mailing list