Hi,
As some background, I've been using st on an Arm device (Genesi Efika
MX) which has relatively low specs compared to your average x86/amd64
computer. st should be ideal because of how small it is compared to
xterm or rxvt but the reality is that its rendering is quite a bit
slower. Under heavy processor load, such as building a package, I can
literally watch the terminal window refreshing (ie I can see a line
traveling down the window, above which the window is refreshed and below
which the window is dirty...."tearing").
I've changed the code to use the X Double Buffer Extension (Xdbe).
Instead of rendering to a Pixbuf and then copying that Pixbuf to the
window, which is a relatively slow operation, it now renders to an
XdbeBackBuffer and then simply swaps buffers with the window. The result
is tear-free and apparently faster rendering even on an 800mhz Arm cpu.
A side effect is that the code is a bit shorter as a result too. For
example, xresize() does almost nothing now, since the XdbeBackBuffer is
automatically resized with the window (see the DBE manpage), so several
Xlib calls can be removed from that function.
The provided diff is against the default branch, however I also got it
working for the xft branch. I can provide a diff for that too if you
want but the only extra difference is that any Xft draw-related calls
should work on xw.buf rather than xw.win (including the one in
xresize()).
LIBS in config.mk should have -lXext appended. I forgot to include that
in the patch.
A few caveats: 1) my C skills are a bit rusty, 2) I'm unfamiliar with
Mercurial, 3) I'm completely new to Xlib. So, while it Works For Me
(tm), you might want to test it a bit and let me know if I messed up
something.
I'm going to keep hacking on it to try to improve further the speed if I
can.
Cheers,
Brandon Invergo
Received on Fri Apr 20 2012 - 10:39:11 CEST