summary refs log tree commit diff
path: root/bin
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2018-02-05 14:47:19 -0500
committerJune McEnroe <june@causal.agency>2018-02-05 14:47:19 -0500
commit4ee5a2d4868082c9c1f44ba67dd006756de9ad2c (patch)
treef07b5985dc9ec1d2c49bdd587fec88f4b1c25b94 /bin
parentRewrite gfxx bit handling (diff)
downloadsrc-4ee5a2d4868082c9c1f44ba67dd006756de9ad2c.tar.gz
src-4ee5a2d4868082c9c1f44ba67dd006756de9ad2c.zip
Double-buffer gfb frontend
Still not vsync (seems like a newer DRM-fbdev implementation handles
FBIO_WAITFORVSYNC but my kernel doesn't), but avoids flicker from
clearing to black for each frame.
Diffstat (limited to 'bin')
-rw-r--r--bin/gfb.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/bin/gfb.c b/bin/gfb.c
index e64efee5..9925cc12 100644
--- a/bin/gfb.c
+++ b/bin/gfb.c
@@ -19,6 +19,7 @@
 #include <linux/fb.h>
 #include <stdint.h>
 #include <stdlib.h>
+#include <string.h>
 #include <sys/ioctl.h>
 #include <sys/mman.h>
 #include <sysexits.h>
@@ -75,8 +76,10 @@ int main(int argc, char *argv[]) {
     error = tcsetattr(STDERR_FILENO, TCSADRAIN, &term);
     if (error) err(EX_IOERR, "tcsetattr");
 
+    uint32_t back[info.xres * info.yres];
     for (;;) {
-        draw(buf, info.xres, info.yres);
+        draw(back, info.xres, info.yres);
+        memcpy(buf, back, size);
 
         char in;
         ssize_t len = read(STDERR_FILENO, &in, 1);