sna: Switch back to hwcursor on the next cursor update
PATCH 1/1 sna: Switch back to hwcursor on the next cursor update
From: Ville Syrjälä <[email protected]>
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.
References: https://bugs.freedesktop.org/show_bug.cgi?id=106935
--- src/sna/sna_display.c | 5 +++++ 1 file changed, 5 insertions(+)
src/sna/sna_display.c +5 -0
@@ -6285,10 +6285,15 @@ static void enable_fb_access(ScrnInfoPtr scrn, int 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); +/* Try to switch back to the HW cursor on the next cursor update */ + sna->cursor.disable = false; +RemoveBlockAndWakeupHandlers ((void *)__restore_swcursor, (void *)NoopDDA, scrn);
Signature · 6 lines
2.18.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoting Ville Syrjala (2018-10-19 17:55:02)
Quoted 6 lines
From: Ville Syrjälä <[email protected]>
Once we've switched to using the swcursor (possibly due to the cursor ioctl failing) we currently keep using the swcursor until the modeset.
Quoted 8 lines
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.
Ok, so that forces the sw cursor to be switched off on the very next xf86CursorSetCursor() after being enabled. If the HWCursor fails, the cursor should be invisible until the next block handler. Won't that cause the cursor to flicker even more? Hmm, except that the swcursor should be restored within a frame. So more or less simply doubling the work of using swcursor? (Probably not actually, since swcursor is effectively an undo and paint every time and now we just make those two distinct steps) Certainly achieves the goal of forcing HW cursor back on at the earliest opportunity.
I think I have just argued that this doesn't actually impact on swcursor rendering, just extends the loop.
Quoted 2 lines
References: https://bugs.freedesktop.org/show_bug.cgi?id=106935
Signed-off-by Ville Syrjälä <[email protected]>
Tentative
I think I would like to review the impact on swcursor a bit more, FAIL_CURSOR_IOCTL be my friend.
-Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 26 lines · Chris Wilson
Quoting Ville Syrjala (2018-10-19 17:55:02)
Quoted 6 lines
From: Ville Syrjälä <[email protected]>
Once we've switched to using the swcursor (possibly due to the cursor ioctl failing) we currently keep using the swcursor until the modeset.
Quoted 8 lines
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.
Ok, so that forces the sw cursor to be switched off on the very next
xf86CursorSetCursor()after being enabled. If the HWCursor fails, the cursor should be invisible until the next block handler. Won't that cause the cursor to flicker even more? Hmm, except that the swcursor should be restored within a frame. So more or less simply doubling the work of using swcursor? (Probably not actually, since swcursor is effectively an undo and paint every time and now we just make those two distinct steps) Certainly achieves the goal of forcing HW cursor back on at the earliest opportunity.
Quoted 2 lines
I think I have just argued that this doesn't actually impact on swcursor rendering, just extends the loop.
Hmm. I didn't fully consider what happens when we try to switch back. So first the old swscursor gets cleared out, then we try to turn on the hwcursor, and if that still fails we eventually render the new swcursor? Right, so I guess this just adds a bit of a delay between the two steps.
My intial thought was to use a timer, but then I realized that I can just stick it into the block handler while still avoiding any recursion horrors.
Quoted 8 lines
Quoted 3 lines
References: https://bugs.freedesktop.org/show_bug.cgi?id=106935
Signed-off-by Ville Syrjälä <[email protected]>Tentative
Reviewed-by Chris Wilson <[email protected]>I think I would like to review the impact on swcursor a bit more,
FAIL_CURSOR_IOCTLbe my friend.
Sure. Maybe you can even figure out why we get those dirt trails ;)
Signature · 6 lines
Ville Syrjälä Intel _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoting Ville Syrjälä (2018-10-19 21:41:05)
Quoted 36 lines · Chris Wilson
Quoted 26 lines
Quoting Ville Syrjala (2018-10-19 17:55:02)
Quoted 6 lines
From: Ville Syrjälä <[email protected]>
Once we've switched to using the swcursor (possibly due to the cursor ioctl failing) we currently keep using the swcursor until the modeset.
Quoted 8 lines
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.
Ok, so that forces the sw cursor to be switched off on the very next
xf86CursorSetCursor()after being enabled. If the HWCursor fails, the cursor should be invisible until the next block handler. Won't that cause the cursor to flicker even more? Hmm, except that the swcursor should be restored within a frame. So more or less simply doubling the work of using swcursor? (Probably not actually, since swcursor is effectively an undo and paint every time and now we just make those two distinct steps) Certainly achieves the goal of forcing HW cursor back on at the earliest opportunity.Quoted 2 lines
I think I have just argued that this doesn't actually impact on swcursor rendering, just extends the loop.
Hmm. I didn't fully consider what happens when we try to switch back. So first the old swscursor gets cleared out, then we try to turn on the hwcursor, and if that still fails we eventually render the new swcursor? Right, so I guess this just adds a bit of a delay between the two steps.
Quoted 3 lines
My intial thought was to use a timer, but then I realized that I can just stick it into the block handler while still avoiding any recursion horrors.
Yup, works nicely and even better with your
- enable_fb_access(scrn, FALSE); - enable_fb_access(scrn, TRUE); + xf86CursorResetCursor(scrn->pScreen);
improvement!
Quoted 9 lines
Quoted 7 lines
Quoted 2 lines
References: https://bugs.freedesktop.org/show_bug.cgi?id=106935
Signed-off-by Ville Syrjälä <[email protected]>Tentative
Reviewed-by Chris Wilson <[email protected]>I think I would like to review the impact on swcursor a bit more,
FAIL_CURSOR_IOCTLbe my friend.Sure. Maybe you can even figure out why we get those dirt trails ;)
Mumble, mumble, mumble (faking copy area around DRI2CopyRegion). -Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v2 1/1 sna: Switch back to hwcursor on the next cursor update
In reply to Ville SyrjalaFrom: Ville Syrjälä <[email protected]>
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.
References: https://bugs.freedesktop.org/show_bug.cgi?id=106935
--- src/sna/sna_display.c | 3 +++ 1 file changed, 3 insertions(+)
src/sna/sna_display.c +3 -0
@@ -9106,6 +9106,9 @@ void sna_mode_redisplay(struct sna *sna)return ; } +/* Try to switch back to the HW cursor on the next cursor update */ + sna->cursor.disable = false; +if (!sna->mode.shadow_enabled)return ;
Signature · 6 lines
2.20.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx