Skip to contentSkip to conversation

drm/i915/gen9: Only copy WM results for changed pipes to skl_hw

PATCH In review Matt Roper 3 participants 3 messages Jul 7, 2016 – Jul 11, 2016

Subsystems (2)
lore
Share & tools
lore

Matt Roper

author
#0 lore raw

PATCH 1/1 drm/i915/gen9: Only copy WM results for changed pipes to skl_hw

When we write watermark values to the hardware, those values are stored in dev_priv->wm.skl_hw. However with recent watermark changes, the results structure we're copying from only contains valid watermark and DDB values for the pipes that are actually changing; the values for other pipes remain 0. Thus a blind copy of the entire skl_wm_values structure will clobber the values for unchanged pipes...we need to be more selective and only copy over the values for the changing pipes.

This mistake was hidden until recently due to another bug that caused us to erroneously re-calculate watermarks for all active pipes rather than changing pipes. Only when that bug was fixed was the impact of this bug discovered (e.g., modesets failing with "Requested display configuration exceeds system watermark limitations" messages and leaving watermarks non-functional, even ones initiated by intel_fbdev_restore_mode).

Cc Maarten Lankhorst <[email protected]>
Cc Lyude Paul <[email protected]>
Fixes 734fa01f3a17 ("drm/i915/gen9: Calculate watermarks during atomic 'check' (v2)")
Fixes 9b6130227495 ("drm/i915/gen9: Re-allocate DDB only for changed pipes")
---
 drivers/gpu/drm/i915/intel_pm.c | 22 ++++++++++++++++++++--
 1 file changed, 20 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_pm.c +20 -2
index 5a8ee0c..2913535 100644
@@ -4018,8 +4018,10 @@ static void skl_update_wm(struct drm_crtc *crtc)
 	struct drm_device *dev = crtc->dev;
 	struct drm_i915_private *dev_priv = to_i915(dev);
 	struct skl_wm_values *results = &dev_priv->wm.skl_results;
+	struct skl_wm_values *hw_vals = &dev_priv->wm.skl_hw;
 	struct intel_crtc_state *cstate = to_intel_crtc_state(crtc->state);
 	struct skl_pipe_wm *pipe_wm = &cstate->wm.skl.optimal;
+	int pipe;
 
 	if ((results->dirty_pipes & drm_crtc_mask(crtc)) == 0)
 		return;
@@ -4031,8 +4033,24 @@ static void skl_update_wm(struct drm_crtc *crtc)
 	skl_write_wm_values(dev_priv, results);
 	skl_flush_wm_values(dev_priv, results);
 
-	/* store the new configuration */
-	dev_priv->wm.skl_hw = *results;
+	/*
+	 * Store the new configuration (but only for the pipes that have
+	 * changed; the other values weren't recomputed).
+	 */
+	for_each_pipe_masked(dev_priv, pipe, results->dirty_pipes) {
+		hw_vals->wm_linetime[pipe] = results->wm_linetime[pipe];
+		hw_vals->ddb.pipe[pipe] = results->ddb.pipe[pipe];
+		memcpy(&hw_vals->ddb.plane[pipe], &results->ddb.plane[pipe],
+		       sizeof(hw_vals->ddb.plane[pipe]));
+		memcpy(&hw_vals->ddb.y_plane[pipe], &results->ddb.y_plane[pipe],
+		       sizeof(hw_vals->ddb.y_plane[pipe]));
+		memcpy(&hw_vals->plane[pipe],
+		       &results->plane[pipe],
+		       sizeof(results->plane[pipe]));
+		memcpy(&hw_vals->plane_trans[pipe],
+		       &results->plane_trans[pipe],
+		       sizeof(results->plane_trans[pipe]));
+	}
 
 	mutex_unlock(&dev_priv->wm.wm_mutex);
 }
Signature · 6 lines
2.1.4

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw

✗ Ro.CI.BAT: warning for drm/i915/gen9: Only copy WM results for changed pipes to skl_hw

== Series Details ==

== Series Details ==

Series: drm/i915/gen9: Only copy WM results for changed pipes to skl_hw
URL : https://patchwork.freedesktop.org/series/9628/
State : warning

== Summary ==

Series 9628v1 drm/i915/gen9: Only copy WM results for changed pipes to skl_hw
http://patchwork.freedesktop.org/api/1.0/series/9628/revisions/1/mbox

Test drv_module_reload_basic:

                pass       -> DMESG-WARN (ro-byt-n2820)
Test gem_exec_suspend:
        Subgroup basic-s3:
                dmesg-warn -> PASS       (fi-skl-i5-6260u)
fi-kbl-qkkr      total:237  pass:163  dwarn:29  dfail:0   fail:4   skip:41 
fi-skl-i5-6260u  total:237  pass:207  dwarn:0   dfail:0   fail:4   skip:26 
fi-skl-i7-6700k  total:237  pass:193  dwarn:0   dfail:0   fail:4   skip:40 
fi-snb-i7-2600   total:237  pass:179  dwarn:0   dfail:0   fail:4   skip:54 
ro-bdw-i5-5250u  total:229  pass:204  dwarn:1   dfail:1   fail:0   skip:23 
ro-bdw-i7-5557U  total:229  pass:204  dwarn:2   dfail:1   fail:0   skip:22 
ro-bdw-i7-5600u  total:229  pass:190  dwarn:0   dfail:1   fail:0   skip:38 
ro-byt-n2820     total:229  pass:179  dwarn:1   dfail:1   fail:3   skip:45 
ro-hsw-i3-4010u  total:229  pass:197  dwarn:0   dfail:1   fail:0   skip:31 
ro-hsw-i7-4770r  total:229  pass:197  dwarn:0   dfail:1   fail:0   skip:31 
ro-ilk-i7-620lm  total:229  pass:157  dwarn:0   dfail:1   fail:1   skip:70 
ro-ilk1-i5-650   total:224  pass:157  dwarn:0   dfail:1   fail:1   skip:65 
ro-ivb-i7-3770   total:229  pass:188  dwarn:0   dfail:1   fail:0   skip:40 
ro-skl3-i5-6260u total:229  pass:208  dwarn:1   dfail:1   fail:0   skip:19 
ro-snb-i7-2620M  total:229  pass:179  dwarn:0   dfail:1   fail:1   skip:48 

ro-bsw-n3050 failed to connect after reboot

Results at /archive/results/CI_IGT_test/RO_Patchwork_1450/

9fc25d3 drm-intel-nightly: 2016y-07m-07d-17h-02m-51s UTC integration manifest b816693 drm/i915/gen9: Only copy WM results for changed pipes to skl_hw

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#2 lore raw
In reply to Matt Roper

Just posting this so it's on the ML.

NAK on this patch, this causes leftover cursors on SKL. Additionally, there's a noticeable lag every time I move the cursor from one monitor to another, and the flickering from the broken watermarks still happens.

Quoted 68 lines · Matt Roper

When we write watermark values to the hardware, those values are stored in dev_priv->wm.skl_hw.  However with recent watermark changes, the results structure we're copying from only contains valid watermark and DDB values for the pipes that are actually changing; the values for other pipes remain 0.  Thus a blind copy of the entire skl_wm_values structure will clobber the values for unchanged pipes...we need to be more selective and only copy over the values for the changing pipes.

This mistake was hidden until recently due to another bug that caused us to erroneously re-calculate watermarks for all active pipes rather than changing pipes.  Only when that bug was fixed was the impact of this bug discovered (e.g., modesets failing with "Requested display configuration exceeds system watermark limitations" messages and leaving watermarks non-functional, even ones initiated by intel_fbdev_restore_mode).

Cc Maarten Lankhorst <[email protected]>
Cc Lyude Paul <[email protected]>
Fixes 734fa01f3a17 ("drm/i915/gen9: Calculate watermarks during atomic

'check' (v2)")

Fixes 9b6130227495 ("drm/i915/gen9: Re-allocate DDB only for changed pipes")

---
 drivers/gpu/drm/i915/intel_pm.c | 22 ++++++++++++++++++++--

 1 file changed, 20 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_pm.c +2 -0
index 5a8ee0c..2913535 100644
@@ -4018,8 +4018,10 @@ static void skl_update_wm(struct drm_crtc *crtc)
  	struct drm_device *dev = crtc->dev;
  	struct drm_i915_private *dev_priv = to_i915(dev);
  	struct skl_wm_values *results = &dev_priv->wm.skl_results;
+	struct skl_wm_values *hw_vals = &dev_priv->wm.skl_hw;
  	struct intel_crtc_state *cstate = to_intel_crtc_state(crtc->state);
  	struct skl_pipe_wm *pipe_wm = &cstate->wm.skl.optimal;
+	int pipe;


  if ((results->dirty_pipes & drm_crtc_mask(crtc)) == 0) return;

drivers/gpu/drm/i915/intel_pm.c +0 -0
@@ -4031,8 +4033,24 @@ static void skl_update_wm(struct drm_crtc *crtc)
  	skl_write_wm_values(dev_priv, results);
  	skl_flush_wm_values(dev_priv, results);

drivers/gpu/drm/i915/intel_pm.c +10 -2
-	/* store the new configuration */
-	dev_priv->wm.skl_hw = *results;
+	/*
+	 * Store the new configuration (but only for the pipes that have
+	 * changed; the other values weren't recomputed).
+	 */
+	for_each_pipe_masked(dev_priv, pipe, results->dirty_pipes) {
+		hw_vals->wm_linetime[pipe] = results->wm_linetime[pipe];
+		hw_vals->ddb.pipe[pipe] = results->ddb.pipe[pipe];
+		memcpy(&hw_vals->ddb.plane[pipe], &results->ddb.plane[pipe],
+		       sizeof(hw_vals->ddb.plane[pipe]));
+		memcpy(&hw_vals->ddb.y_plane[pipe], &results-
Quoted 1 line

ddb.y_plane[pipe],

drivers/gpu/drm/i915/intel_pm.c +8 -0
+		       sizeof(hw_vals->ddb.y_plane[pipe]));
+		memcpy(&hw_vals->plane[pipe],
+		       &results->plane[pipe],
+		       sizeof(results->plane[pipe]));
+		memcpy(&hw_vals->plane_trans[pipe],
+		       &results->plane_trans[pipe],
+		       sizeof(results->plane_trans[pipe]));
+	}


  mutex_unlock(&dev_priv->wm.wm_mutex);
 }

Signature · 6 lines
Cheers,
	Lyude
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx