7d2c2f2
From 2ad01780bf59b3a785975bf48a066645e5b6f7f5 Mon Sep 17 00:00:00 2001
7d2c2f2
From: Matt Roper <matthew.d.roper@intel.com>
7d2c2f2
Date: Thu, 12 May 2016 07:06:10 -0700
7d2c2f2
Subject: [PATCH 16/17] drm/i915/gen9: Reject display updates that exceed wm
7d2c2f2
 limitations (v2)
7d2c2f2
7d2c2f2
If we can't find any valid level 0 watermark values for the requested
7d2c2f2
atomic transaction, reject the configuration before we try to start
7d2c2f2
programming the hardware.
7d2c2f2
7d2c2f2
v2:
7d2c2f2
 - Add extra debugging output when we reject level 0 watermarks so that
7d2c2f2
   we can more easily debug how/why they were rejected.
7d2c2f2
7d2c2f2
Cc: Lyude Paul <cpaul@redhat.com>
7d2c2f2
Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
7d2c2f2
Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
7d2c2f2
Link: http://patchwork.freedesktop.org/patch/msgid/1463061971-19638-17-git-send-email-matthew.d.roper@intel.com
7d2c2f2
---
7d2c2f2
 drivers/gpu/drm/i915/intel_pm.c | 17 ++++++++++++++++-
7d2c2f2
 1 file changed, 16 insertions(+), 1 deletion(-)
7d2c2f2
7d2c2f2
diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
7d2c2f2
index b072417..f764d28 100644
7d2c2f2
--- a/drivers/gpu/drm/i915/intel_pm.c
7d2c2f2
+++ b/drivers/gpu/drm/i915/intel_pm.c
7d2c2f2
@@ -3306,7 +3306,22 @@ static int skl_compute_plane_wm(const struct drm_i915_private *dev_priv,
7d2c2f2
 
7d2c2f2
 	if (res_blocks >= ddb_allocation || res_lines > 31) {
7d2c2f2
 		*enabled = false;
7d2c2f2
-		return 0;
7d2c2f2
+
7d2c2f2
+		/*
7d2c2f2
+		 * If there are no valid level 0 watermarks, then we can't
7d2c2f2
+		 * support this display configuration.
7d2c2f2
+		 */
7d2c2f2
+		if (level) {
7d2c2f2
+			return 0;
7d2c2f2
+		} else {
7d2c2f2
+			DRM_DEBUG_KMS("Requested display configuration exceeds system watermark limitations\n");
7d2c2f2
+			DRM_DEBUG_KMS("Plane %d.%d: blocks required = %u/%u, lines required = %u/31\n",
7d2c2f2
+				      to_intel_crtc(cstate->base.crtc)->pipe,
7d2c2f2
+				      skl_wm_plane_id(to_intel_plane(pstate->plane)),
7d2c2f2
+				      res_blocks, ddb_allocation, res_lines);
7d2c2f2
+
7d2c2f2
+			return -EINVAL;
7d2c2f2
+		}
7d2c2f2
 	}
7d2c2f2
 
7d2c2f2
 	*out_blocks = res_blocks;
7d2c2f2
-- 
7d2c2f2
2.7.4
7d2c2f2