Blob Blame History Raw
From 75343a44c901b681328b22ae50bcf5efdf6c988f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ville=20Syrj=C3=A4l=C3=A4?= <ville.syrjala@linux.intel.com>
Date: Mon, 27 Mar 2017 21:55:38 +0300
Subject: [PATCH] drm/i915: Drop useless posting reads from cursor commit
Mime-version: 1.0
Content-type: text/plain; charset=UTF-8
Content-transfer-encoding: 8bit
Git-commit: 75343a44c901b681328b22ae50bcf5efdf6c988f
Patch-mainline: v4.13-rc1
References: FATE#322643 bsc#1055900

There should be no need to do posting reads between all the cursor
register accessess. Let's just drop them.

V2: Rebase due to I915_WRITE_FW() and uncore.lock

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk> #v1
Link: http://patchwork.freedesktop.org/patch/msgid/20170327185546.2977-8-ville.syrjala@linux.intel.com
Acked-by: Takashi Iwai <tiwai@suse.de>

---
 drivers/gpu/drm/i915/intel_display.c |   32 +++++++++++++++-----------------
 1 file changed, 15 insertions(+), 17 deletions(-)

--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -9242,30 +9242,28 @@ static void i845_update_cursor(struct in
 		 * whilst the cursor is disabled.
 		 */
 		I915_WRITE_FW(CURCNTR(PIPE_A), 0);
-		POSTING_READ_FW(CURCNTR(PIPE_A));
 		plane->cursor.cntl = 0;
 	}
 
-	if (plane->cursor.base != base) {
+	if (plane->cursor.base != base)
 		I915_WRITE_FW(CURBASE(PIPE_A), base);
-		plane->cursor.base = base;
-	}
 
-	if (plane->cursor.size != size) {
+	if (plane->cursor.size != size)
 		I915_WRITE_FW(CURSIZE, size);
-		plane->cursor.size = size;
-	}
 
 	if (cntl)
 		I915_WRITE_FW(CURPOS(PIPE_A), pos);
 
-	if (plane->cursor.cntl != cntl) {
+	if (plane->cursor.cntl != cntl)
 		I915_WRITE_FW(CURCNTR(PIPE_A), cntl);
-		POSTING_READ_FW(CURCNTR(PIPE_A));
-		plane->cursor.cntl = cntl;
-	}
+
+	POSTING_READ_FW(CURCNTR(PIPE_A));
 
 	spin_unlock_irqrestore(&dev_priv->uncore.lock, irqflags);
+
+	plane->cursor.cntl = cntl;
+	plane->cursor.base = base;
+	plane->cursor.size = size;
 }
 
 static void i845_disable_cursor(struct intel_plane *plane,
@@ -9328,21 +9326,21 @@ static void i9xx_update_cursor(struct in
 
 	spin_lock_irqsave(&dev_priv->uncore.lock, irqflags);
 
-	if (plane->cursor.cntl != cntl) {
+	if (plane->cursor.cntl != cntl)
 		I915_WRITE_FW(CURCNTR(pipe), cntl);
-		POSTING_READ_FW(CURCNTR(pipe));
-		plane->cursor.cntl = cntl;
-	}
 
 	if (cntl)
 		I915_WRITE_FW(CURPOS(pipe), pos);
 
-	/* and commit changes on next vblank */
-	I915_WRITE_FW(CURBASE(pipe), base);
+	if (plane->cursor.cntl != cntl ||
+	    plane->cursor.base != base)
+		I915_WRITE_FW(CURBASE(pipe), base);
+
 	POSTING_READ_FW(CURBASE(pipe));
 
 	spin_unlock_irqrestore(&dev_priv->uncore.lock, irqflags);
 
+	plane->cursor.cntl = cntl;
 	plane->cursor.base = base;
 }