[CI 19/23] drm/i915: Fix CxSR disable race between pipes

Harish Chegondi harish.chegondi at intel.com
Thu Apr 18 21:50:09 UTC 2019


From: Ville Syrjälä <ville.syrjala at linux.intel.com>

When one pipe is performing flips/plane updates/etc. and the other
pipe is getting enabled we must make sure the first pipe gets
blocked on CxSR disable properly when required. Easiest way to do
that is to do the CxSR vblank wait under wm.mutex which will then
block the first pipe until CxSR has been fully exited. Otherwise
the first pipe could proceed with its current operation with
CxSR still in the process of being disabled, and thus we could
get an underrun.

Signed-off-by: Ville Syrjälä <ville.syrjala at linux.intel.com>
---
 drivers/gpu/drm/i915/intel_pm.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
index 1ead91ad7ace..a68012fece54 100644
--- a/drivers/gpu/drm/i915/intel_pm.c
+++ b/drivers/gpu/drm/i915/intel_pm.c
@@ -1443,6 +1443,7 @@ static int g4x_compute_intermediate_wm(struct intel_crtc_state *new_crtc_state)
 
 		intermediate->sr.enable = false;
 		intermediate->hpll.enable = false;
+		new_crtc_state->disable_cxsr = true;
 		goto out;
 	}
 
@@ -1611,6 +1612,8 @@ static void g4x_initial_watermarks(struct intel_atomic_state *state,
 	struct intel_crtc *crtc = to_intel_crtc(crtc_state->base.crtc);
 
 	mutex_lock(&dev_priv->wm.wm_mutex);
+	if (crtc_state->disable_cxsr)
+		_g4x_disable_cxsr(dev_priv);
 	crtc->wm.active.g4x = crtc_state->wm.g4x.intermediate;
 	g4x_program_watermarks(dev_priv);
 	mutex_unlock(&dev_priv->wm.wm_mutex);
@@ -2129,6 +2132,7 @@ static int vlv_compute_intermediate_wm(struct intel_crtc_state *new_crtc_state)
 
 		for (level = 0; level < intermediate->num_levels; level++)
 			intermediate->sr[level].enable = false;
+		new_crtc_state->disable_cxsr = true;
 		goto out;
 	}
 
@@ -2307,6 +2311,8 @@ static void vlv_initial_watermarks(struct intel_atomic_state *state,
 	struct intel_crtc *crtc = to_intel_crtc(crtc_state->base.crtc);
 
 	mutex_lock(&dev_priv->wm.wm_mutex);
+	if (crtc_state->disable_cxsr)
+		_vlv_disable_cxsr(dev_priv);
 	crtc->wm.active.vlv = crtc_state->wm.vlv.intermediate;
 	vlv_program_watermarks(dev_priv);
 	mutex_unlock(&dev_priv->wm.wm_mutex);
-- 
2.20.1



More information about the Intel-gfx-trybot mailing list