Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Screen stutters for modern GPU acceleration based terminals like Alacritty, iTerm2, etc; use redraw with NOT_VALID #4

Closed
poetaman opened this issue Jul 26, 2021 · 5 comments
Assignees
Labels
bug Something isn't working

Comments

@poetaman
Copy link

poetaman commented Jul 26, 2021

Modern GPU based terminals draw the entire frame on redraws. The way to avoid screen from stuttering is to use a different approach to redrawing screen.

The solution is mentioned in neovim/neovim#14225 (comment), and vim/vim#8002 (comment). The solution is to redraw with
NOT_VALID, which would redraw everything but not clear the screen.

This problem is similar to vim on GPU accelerated terminals also has the problem and plans to fix it: vim/vim#8002

Here's an example of screen stuttering in rsclock. I am using tmux with frame sync feature enabled. Steps for enabling sync feature are detailed here: alacritty/alacritty#4904 (comment)

You won't see this problem with traditional terminals that do not use GPU acceleration. Though the future is with terminals that use GPU acceleration -- they are fast.

stutter_rsclock.mp4

As a sidenote, this screen stuttering does not happen in tty-clock (I tried with same setup & within tmux). But it doesn't guarantee all clock instances to update at same time like rsClock seems to (xorg62/tty-clock#70). Great work rsClock on that front!

@valebes valebes self-assigned this Jul 27, 2021
@valebes valebes added the bug Something isn't working label Jul 27, 2021
@valebes
Copy link
Owner

valebes commented Jul 27, 2021

Thanks @reportaman for the documentation provided.
As soon as I have time I will read the whole thing.
Thanks for the contribution :-) .

@valebes
Copy link
Owner

valebes commented Jul 27, 2021

Yeah, I can reproduce the issue on Alacritty

@poetaman
Copy link
Author

Yes I think this particular quirk of transitioning from coding TUIs that work on old terminal drawing mechanisms to ones that work on both new & old deserves an article on forums like reddit, medium, and hacker news... Given vim too has this problem (neovim doesn't though), shows that even experienced programmers are unaware. Anyway, I am happy to know you could reproduce it.

@valebes
Copy link
Owner

valebes commented Aug 4, 2021

@reportaman Hi, try to check the latest commit. If is all okay I will proceed to release a new release.

@poetaman
Copy link
Author

poetaman commented Aug 4, 2021

@valebes Yes, its working well now! No more stutters!!

Here's a video:

clocks.mp4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants