Skip to contentSkip to conversation

drm: vc4: Don't wait for vblank when updating the cursor

PATCH In review Michael Zoran 4 participants 7 messages Feb 24, 2017 – Mar 1, 2017 3 messages not in the archive

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm: vc4: Don't wait for vblank when updating the cursor

Commonly used desktop environments such as xfce4 and gnome on debian sid can flood the graphics drivers with cursor updates. Because the current implementation is waiting for a vblank between cursor updates, this will cause the display to hang for a long time since a typical refresh rate is only 60Hz.

This is unnecessary and unexpected by user mode software, so simply swap out the cursor frame buffer without waiting.

---
 drivers/gpu/drm/vc4/vc4_plane.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/gpu/drm/vc4/vc4_plane.c +6 -6
index f7a229df572d..110224c3a3ac 100644
@@ -20,6 +20,7 @@
 
 #include "vc4_drv.h"
 #include "vc4_regs.h"
+#include "drm_atomic.h"
 #include "drm_atomic_helper.h"
 #include "drm_fb_cma_helper.h"
 #include "drm_plane_helper.h"
@@ -769,12 +770,6 @@ vc4_update_plane(struct drm_plane *plane,
 	if (!plane_state)
 		goto out;
 
-	/* If we're changing the cursor contents, do that in the
-	 * normal vblank-synced atomic path.
-	 */
-	if (fb != plane_state->fb)
-		goto out;
-
 	/* No configuring new scaling in the fast path. */
 	if (crtc_w != plane_state->crtc_w ||
 	    crtc_h != plane_state->crtc_h ||
@@ -783,6 +778,11 @@ vc4_update_plane(struct drm_plane *plane,
 		goto out;
 	}
 
+	if (fb != plane_state->fb) {
+		drm_atomic_set_fb_for_plane(plane->state, fb);
+		vc4_plane_async_set_fb(plane, fb);
+	}
+
 	/* Set the cursor's position on the screen.  This is the
 	 * expected change from the drm_mode_cursor_universal()
 	 * helper.
Signature · 1 line
2.11.0
#1 lore raw
Quoted 3 lines · Michael Zoran

Commonly used desktop environments such as xfce4 and gnome on debian sid can flood the graphics drivers with cursor updates.

FWIW, this has nothing to do with the desktop environment or indeed the client side at all. Translating input to HW cursor movement is handled entirely inside the X server.

Signature · 6 lines
Earthling Michel Dänzer               |               http://www.amd.com
Libre software enthusiast             |             Mesa and X developer
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

A message that is not in the archive (sent off-list or not yet received): 2396e747-a8fe-8bba-3d9b-8d16f268a30e-otUistvHUpPR7s880joybQ@public.gmane.org

#3 lore raw
Quoted 5 lines · Michel Dänzer
Quoted 3 lines · Michael Zoran

Commonly used desktop environments such as xfce4 and gnome on debian sid can flood the graphics drivers with cursor updates.

Quoted 7 lines

FWIW, this has nothing to do with the desktop environment or indeed the
client side at all. Translating input to HW cursor movement is handled
entirely inside the X server.

Yes, as your point out it may well be the x server that is causing this. I wasn't sure if it was the windows manager or the x server that was doing this.

Either way, when opening a new application the driver gets flooded with cursor updates as something is animating a spinning cursor. Since the refresh rate is only 60Hz, I see a very long hang in the desktop(several minutes) where nothing responds. SSHing into the RPI still works though even though it appears hung.

I had a few people on the net test the changes and they all report that without the change xfce4 and gnome are both unusable on the RPI. With the change, things work fine. Not waiting for the vblank on cursor updates is what other drivers appears to do as well...

_______________________________________________
linux-rpi-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-rpi-kernel

#4 lore raw
Quoted 24 lines · Michael Zoran
Quoted 5 lines · Michel Dänzer
Quoted 3 lines · Michael Zoran

Commonly used desktop environments such as xfce4 and gnome on debian sid can flood the graphics drivers with cursor updates.

Quoted 7 lines

FWIW, this has nothing to do with the desktop environment or indeed the
client side at all. Translating input to HW cursor movement is handled
entirely inside the X server.

Yes, as your point out it may well be the x server that is causing this. I wasn't sure if it was the windows manager or the x server that was doing this.

Either way, when opening a new application the driver gets flooded with cursor updates as something is animating a spinning cursor. Since the refresh rate is only 60Hz, I see a very long hang in the desktop(several minutes) where nothing responds. SSHing into the RPI still works though even though it appears hung.

Quoted 4 lines

I had a few people on the net test the changes and they all report that without the change xfce4 and gnome are both unusable on the RPI. With the change, things work fine. Not waiting for the vblank on cursor updates is what other drivers appears to do as well...

Sure. My point is merely that the commit log should say "Xorg can flood [...]" instead of "Commonly used desktop environments such as xfce4 and gnome on debian sid can flood [...]".

Signature · 6 lines
Earthling Michel Dänzer               |               http://www.amd.com
Libre software enthusiast             |             Mesa and X developer
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

A message that is not in the archive (sent off-list or not yet received): fbf20389-13a7-430c-6bc8-5484d37c629a-otUistvHUpPR7s880joybQ@public.gmane.org

#6 lore raw
Quoted 37 lines · Michel Dänzer
Quoted 29 lines · Michael Zoran
Quoted 5 lines · Michel Dänzer
Quoted 3 lines · Michael Zoran

Commonly used desktop environments such as xfce4 and gnome on debian sid can flood the graphics drivers with cursor updates.

Quoted 8 lines

FWIW, this has nothing to do with the desktop environment or indeed
the
client side at all. Translating input to HW cursor movement is handled
entirely inside the X server.

Yes, as your point out it may well be the x server that is causing this.  I wasn't sure if it was the windows manager or the x server that
was doing this.

Either way, when opening a new application the driver gets flooded with
cursor updates as something is animating a spinning cursor.  Since the
refresh rate is only 60Hz, I see a very long hang in the desktop(several minutes) where nothing responds.  SSHing into the RPI
still works though even though it appears hung.

Quoted 6 lines

I had a few people on the net test the changes and they all report that
without the change xfce4 and gnome are both unusable on the RPI.  With
the change, things work fine.  Not waiting for the vblank on cursor updates is what other drivers appears to do as well...

Quoted 6 lines

Sure. My point is merely that the commit log should say "Xorg can flood
[...]" instead of "Commonly used desktop environments such as xfce4 and
gnome on debian sid can flood [...]".

Thanks for the tip. I don't plan to submit many vc4 changes, but it's good to know.

BTW, you wouldn't happen to know what component is animating the spinning cursor? I still highly suspect it's either the window manager(xfwm or mutter) or possibly the application that's drawing the taskbar.

_______________________________________________
linux-rpi-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-rpi-kernel

A message that is not in the archive (sent off-list or not yet received): [email protected]

#8 lore raw
Quoted 43 lines · Michael Zoran
Quoted 35 lines · Michel Dänzer
Quoted 27 lines · Michael Zoran
Quoted 11 lines · Michel Dänzer
Quoted 3 lines · Michael Zoran

Commonly used desktop environments such as xfce4 and gnome on debian sid can flood the graphics drivers with cursor updates.

FWIW, this has nothing to do with the desktop environment or indeed
the
client side at all. Translating input to HW cursor movement is handled
entirely inside the X server.

Yes, as your point out it may well be the x server that is causing this. I wasn't sure if it was the windows manager or the x server that
was doing this.

Either way, when opening a new application the driver gets flooded with
cursor updates as something is animating a spinning cursor. Since the
refresh rate is only 60Hz, I see a very long hang in the desktop(several minutes) where nothing responds. SSHing into the RPI
still works though even though it appears hung.

Quoted 6 lines

I had a few people on the net test the changes and they all report that
without the change xfce4 and gnome are both unusable on the RPI. With
the change, things work fine. Not waiting for the vblank on cursor updates is what other drivers appears to do as well...

Quoted 6 lines

Sure. My point is merely that the commit log should say "Xorg can flood
[...]" instead of "Commonly used desktop environments such as xfce4 and
gnome on debian sid can flood [...]".

Quoted 7 lines

Thanks for the tip. I don't plan to submit many vc4 changes, but it's good to know.

BTW, you wouldn't happen to know what component is animating the spinning cursor? I still highly suspect it's either the window manager(xfwm or mutter) or possibly the application that's drawing the taskbar.

A client asks the X server to use the spinning cursor, but the actual animation and corresponding DRM_IOCTL_MODE_CURSOR(2) calls are performed by the X server itself.

Signature · 7 lines
Earthling Michel Dänzer               |               http://www.amd.com
Libre software enthusiast             |             Mesa and X developer

_______________________________________________
linux-rpi-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-rpi-kernel
#9 lore raw
In reply to Michael Zoran
Quoted 11 lines · Michael Zoran

Commonly used desktop environments such as xfce4 and gnome on debian sid can flood the graphics drivers with cursor updates. Because the current implementation is waiting for a vblank between cursor updates, this will cause the display to hang for a long time since a typical refresh rate is only 60Hz.

This is unnecessary and unexpected by user mode software, so simply swap out the cursor frame buffer without waiting.

Reviewed and pushed to drm-misc-next. Thanks!

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel