diff options
authorVille Syrjälä <>2019-03-01 11:26:07 +0000
committerChris Wilson <>2019-03-01 18:22:07 +0000
commit6afed33b2d673d88674f0c76efe500ae414e8e1b (patch)
parenta63b6a22981f4add450132ac617b0ef07e103705 (diff)
sna: Switch back to hwcursor on the next cursor update
Once we've switched to using the swcursor (possibly due to the cursor ioctl failing) we currently keep using the swcursor until the modeset. That's not particularly great as the swcursor has several issues. Apart from the (presumably expected) flicker, the cursor also tends to leave horrible trails behind around dri2/3 windows (happens with tearfree at least). To avoid some of that let's try to switch back to the hwcursor a bit sooner. We can do that neatly via the convenient swcursor block handler. v2 [ickle]: Apply the restoration after the screen update is complete. v3 [vsyrjala]: Push it back to restore_swcursor and remove the fullscreen redraw -- prevents terrible flickering in v2! References: Signed-off-by: Ville Syrjälä <> Signed-off-by: Chris Wilson <>
1 files changed, 6 insertions, 14 deletions
diff --git a/src/sna/sna_display.c b/src/sna/sna_display.c
index fe67f85b..119ea981 100644
--- a/src/sna/sna_display.c
+++ b/src/sna/sna_display.c
@@ -6286,23 +6286,15 @@ sna_realize_cursor(xf86CursorInfoPtr info, CursorPtr cursor)
return NULL;
-static void enable_fb_access(ScrnInfoPtr scrn, int state)
- scrn->EnableDisableFBAccess(
-#ifdef XF86_HAS_SCRN_CONV
- scrn,
- scrn->scrnIndex,
- state);
static void __restore_swcursor(ScrnInfoPtr scrn)
+ struct sna *sna = to_sna(scrn);
DBG(("%s: attempting to restore SW cursor\n", __FUNCTION__));
- enable_fb_access(scrn, FALSE);
- enable_fb_access(scrn, TRUE);
+ xf86CursorResetCursor(scrn->pScreen);
+ /* Try to switch back to the HW cursor on the next cursor update */
+ sna->cursor.disable = false;
RemoveBlockAndWakeupHandlers((void *)__restore_swcursor,
(void *)NoopDDA,