51f1cbd
From 6d24c1c5918907ab78a5729b78c0d165deb3cc2b Mon Sep 17 00:00:00 2001
51f1cbd
From: Michael Zoran <mzoran@crowfest.net>
51f1cbd
Date: Thu, 23 Feb 2017 17:54:31 -0800
51f1cbd
Subject: drm/vc4: Don't wait for vblank when updating the cursor
51f1cbd
51f1cbd
Commonly used desktop environments such as xfce4 and gnome
51f1cbd
on debian sid can flood the graphics drivers with cursor
51f1cbd
updates.  Because the current implementation is waiting
51f1cbd
for a vblank between cursor updates, this will cause the
51f1cbd
display to hang for a long time since a typical refresh
51f1cbd
rate is only 60Hz.
51f1cbd
51f1cbd
This is unnecessary and unexpected by user mode software,
51f1cbd
so simply swap out the cursor frame buffer without waiting.
51f1cbd
51f1cbd
Signed-off-by: Michael Zoran <mzoran@crowfest.net>
51f1cbd
Reviewed-by: Eric Anholt <eric@anholt.net>
51f1cbd
Link: http://patchwork.freedesktop.org/patch/msgid/20170224015431.24583-1-mzoran@crowfest.net
51f1cbd
51f1cbd
diff --git a/drivers/gpu/drm/vc4/vc4_plane.c b/drivers/gpu/drm/vc4/vc4_plane.c
51f1cbd
index f7a229d..110224c 100644
51f1cbd
--- a/drivers/gpu/drm/vc4/vc4_plane.c
51f1cbd
+++ b/drivers/gpu/drm/vc4/vc4_plane.c
51f1cbd
@@ -20,6 +20,7 @@
51f1cbd
 
51f1cbd
 #include "vc4_drv.h"
51f1cbd
 #include "vc4_regs.h"
51f1cbd
+#include "drm_atomic.h"
51f1cbd
 #include "drm_atomic_helper.h"
51f1cbd
 #include "drm_fb_cma_helper.h"
51f1cbd
 #include "drm_plane_helper.h"
51f1cbd
@@ -769,12 +770,6 @@ vc4_update_plane(struct drm_plane *plane,
51f1cbd
 	if (!plane_state)
51f1cbd
 		goto out;
51f1cbd
 
51f1cbd
-	/* If we're changing the cursor contents, do that in the
51f1cbd
-	 * normal vblank-synced atomic path.
51f1cbd
-	 */
51f1cbd
-	if (fb != plane_state->fb)
51f1cbd
-		goto out;
51f1cbd
-
51f1cbd
 	/* No configuring new scaling in the fast path. */
51f1cbd
 	if (crtc_w != plane_state->crtc_w ||
51f1cbd
 	    crtc_h != plane_state->crtc_h ||
51f1cbd
@@ -783,6 +778,11 @@ vc4_update_plane(struct drm_plane *plane,
51f1cbd
 		goto out;
51f1cbd
 	}
51f1cbd
 
51f1cbd
+	if (fb != plane_state->fb) {
51f1cbd
+		drm_atomic_set_fb_for_plane(plane->state, fb);
51f1cbd
+		vc4_plane_async_set_fb(plane, fb);
51f1cbd
+	}
51f1cbd
+
51f1cbd
 	/* Set the cursor's position on the screen.  This is the
51f1cbd
 	 * expected change from the drm_mode_cursor_universal()
51f1cbd
 	 * helper.
51f1cbd
-- 
51f1cbd
cgit v0.10.2
51f1cbd