diff options
author | Avi Halachmi (:avih) <avihpit@yahoo.com> | 2019-02-26 22:37:49 +0200 |
---|---|---|
committer | Hiltjo Posthuma <hiltjo@codemadness.org> | 2020-05-09 13:53:50 +0200 |
commit | 1d590910652519268152eae6b97cf30ace4e90c0 (patch) | |
tree | aec0e38e3864e42409023f75be2aa148b0fe1a80 /st.info | |
parent | d6ea0a1a61853dd892029a7126e7fdb70c371878 (diff) | |
download | st-1d590910652519268152eae6b97cf30ace4e90c0.tar.gz st-1d590910652519268152eae6b97cf30ace4e90c0.tar.bz2 st-1d590910652519268152eae6b97cf30ace4e90c0.zip |
auto-sync: draw on idle to avoid flicker/tearing
st could easily tear/flicker with animation or other unattended
output. This commit eliminates most of the tear/flicker.
Before this commit, the display timing had two "modes":
- Interactively, st was waiting fixed `1000/xfps` ms after forwarding
the kb/mouse event to the application and before drawing.
- Unattended, and specifically with animations, the draw frequency was
throttled to `actionfps`. Animation at a higher rate would throttle
and likely tear, and at lower rates it was tearing big frames
(specifically, when one `read` didn't get a full "frame").
The interactive behavior was decent, but it was impossible to get good
unattended-draw behavior even with carefully chosen configuration.
This commit changes the behavior such that it draws on idle instead of
using fixed latency/frequency. This means that it tries to draw only
when it's very likely that the application has completed its output
(or after some duration without idle), so it mostly succeeds to avoid
tear, flicker, and partial drawing.
The config values minlatency/maxlatency replace xfps/actionfps and
define the range which the algorithm is allowed to wait from the
initial draw-trigger until the actual draw. The range enables the
flexibility to choose when to draw - when least likely to flicker.
It also unifies the interactive and unattended behavior and config
values, which makes the code simpler as well - without sacrificing
latency during interactive use, because typically interactively idle
arrives very quickly, so the wait is typically minlatency.
While it only slighly improves interactive behavior, for animations
and other unattended-drawing it improves greatly, as it effectively
adapts to any [animation] output rate without tearing, throttling,
redundant drawing, or unnecessary delays (sounds impossible, but it
works).
Diffstat (limited to 'st.info')
0 files changed, 0 insertions, 0 deletions