drm/i915: Drop useless posting reads from cursor commit
authorVille Syrjälä <ville.syrjala@linux.intel.com>
Mon, 27 Mar 2017 18:55:38 +0000 (21:55 +0300)
committerVille Syrjälä <ville.syrjala@linux.intel.com>
Wed, 10 May 2017 16:07:27 +0000 (19:07 +0300)
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
drivers/gpu/drm/i915/intel_display.c

index 2372b2a..cb20de0 100644 (file)
@@ -9232,30 +9232,28 @@ static void i845_update_cursor(struct intel_plane *plane,
                 * 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,
@@ -9318,21 +9316,21 @@ static void i9xx_update_cursor(struct intel_plane *plane,
 
        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;
 }