[PATCH 5/8] drm/i915/gen9: Hold wm_mutex around SKL watermark updates

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



SKL watermark code uses a field in dev_priv to hold the watermark
results being calculated.  If independent commits are submitted against
disjoint CRTC's, the watermark updates could race and clobber each
other's usage of dev_priv->wm.skl_results.

Signed-off-by: Matt Roper <matthew.d.roper@xxxxxxxxx>
---
 drivers/gpu/drm/i915/intel_pm.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
index 041db5d3..29d37d3 100644
--- a/drivers/gpu/drm/i915/intel_pm.c
+++ b/drivers/gpu/drm/i915/intel_pm.c
@@ -3805,6 +3805,7 @@ static void skl_update_wm(struct drm_crtc *crtc)
 	struct intel_crtc_state *cstate = to_intel_crtc_state(crtc->state);
 	struct skl_pipe_wm *pipe_wm = &cstate->wm.optimal.skl;
 
+	mutex_lock(&dev_priv->wm.wm_mutex);
 
 	/* Clear all dirty flags */
 	memset(results->dirty, 0, sizeof(bool) * I915_MAX_PIPES);
@@ -3815,7 +3816,7 @@ static void skl_update_wm(struct drm_crtc *crtc)
 	skl_set_plane_pixel_rate(crtc);
 
 	if (!skl_update_pipe_wm(crtc, &results->ddb, pipe_wm))
-		return;
+		goto out;
 
 	skl_compute_wm_results(dev, pipe_wm, results, intel_crtc);
 	results->dirty[intel_crtc->pipe] = true;
@@ -3826,6 +3827,9 @@ static void skl_update_wm(struct drm_crtc *crtc)
 
 	/* store the new configuration */
 	dev_priv->wm.skl_hw = *results;
+
+out:
+	mutex_unlock(&dev_priv->wm.wm_mutex);
 }
 
 static void ilk_compute_wm_config(struct drm_device *dev,
-- 
2.1.4

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




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux