06de599
From e2e407dc093f530b771ee8bf8fe1be41e3cea8b3 Mon Sep 17 00:00:00 2001
06de599
From: Matt Roper <matthew.d.roper@intel.com>
06de599
Date: Mon, 8 Feb 2016 11:05:28 -0800
06de599
Subject: [PATCH] drm/i915: Pretend cursor is always on for ILK-style WM
06de599
 calculations (v2)
06de599
06de599
Due to our lack of two-step watermark programming, our driver has
06de599
historically pretended that the cursor plane is always on for the
06de599
purpose of watermark calculations; this helps avoid serious flickering
06de599
when the cursor turns off/on (e.g., when the user moves the mouse
06de599
pointer to a different screen).  That workaround was accidentally
06de599
dropped as we started working toward atomic watermark updates.  Since we
06de599
still aren't quite there yet with two-stage updates, we need to
06de599
resurrect the workaround and treat the cursor as always active.
06de599
06de599
v2: Tweak cursor width calculations slightly to more closely match the
06de599
    logic we used before the atomic overhaul began.  (Ville)
06de599
06de599
Cc: simdev11@outlook.com
06de599
Cc: manfred.kitzbichler@gmail.com
06de599
Cc: drm-intel-fixes@lists.freedesktop.org
06de599
Reported-by: simdev11@outlook.com
06de599
Reported-by: manfred.kitzbichler@gmail.com
06de599
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=93892
06de599
Fixes: 43d59eda1 ("drm/i915: Eliminate usage of plane_wm_parameters from ILK-style WM code (v2)")
06de599
Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
06de599
Link: http://patchwork.freedesktop.org/patch/msgid/1454479611-6804-1-git-send-email-matthew.d.roper@intel.com
06de599
(cherry picked from commit b2435692dbb709d4c8ff3b2f2815c9b8423b72bb)
06de599
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
06de599
Link: http://patchwork.freedesktop.org/patch/msgid/1454958328-30129-1-git-send-email-matthew.d.roper@intel.com
06de599
---
06de599
 drivers/gpu/drm/i915/intel_pm.c | 14 +++++++++-----
06de599
 1 file changed, 9 insertions(+), 5 deletions(-)
06de599
06de599
diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
06de599
index eb5fa05..a234687 100644
06de599
--- a/drivers/gpu/drm/i915/intel_pm.c
06de599
+++ b/drivers/gpu/drm/i915/intel_pm.c
06de599
@@ -1783,16 +1783,20 @@ static uint32_t ilk_compute_cur_wm(const struct intel_crtc_state *cstate,
06de599
 				   const struct intel_plane_state *pstate,
06de599
 				   uint32_t mem_value)
06de599
 {
06de599
-	int bpp = pstate->base.fb ? pstate->base.fb->bits_per_pixel / 8 : 0;
06de599
+	/*
06de599
+	 * We treat the cursor plane as always-on for the purposes of watermark
06de599
+	 * calculation.  Until we have two-stage watermark programming merged,
06de599
+	 * this is necessary to avoid flickering.
06de599
+	 */
06de599
+	int cpp = 4;
06de599
+	int width = pstate->visible ? pstate->base.crtc_w : 64;
06de599
 
06de599
-	if (!cstate->base.active || !pstate->visible)
06de599
+	if (!cstate->base.active)
06de599
 		return 0;
06de599
 
06de599
 	return ilk_wm_method2(ilk_pipe_pixel_rate(cstate),
06de599
 			      cstate->base.adjusted_mode.crtc_htotal,
06de599
-			      drm_rect_width(&pstate->dst),
06de599
-			      bpp,
06de599
-			      mem_value);
06de599
+			      width, cpp, mem_value);
06de599
 }
06de599
 
06de599
 /* Only for WM_LP. */
06de599
-- 
06de599
2.5.0
06de599