From 4ee5a2d4868082c9c1f44ba67dd006756de9ad2c Mon Sep 17 00:00:00 2001 From: June McEnroe Date: Mon, 5 Feb 2018 14:47:19 -0500 Subject: 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. --- bin/gfb.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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 #include #include +#include #include #include #include @@ -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); -- cgit 1.4.1