From d780332c4b2fae4bbbb19c5d170e3810bc3184ac Mon Sep 17 00:00:00 2001 From: Gerd Hoffmann Date: Thu, 31 Mar 2016 21:57:53 +0200 Subject: fbpdf: add pageflip option, misc --- drmtools-egl.c | 3 +++ fbiconfig.c | 12 +++++++++++- fbiconfig.h | 2 ++ fbpdf.c | 14 +++++++++----- 4 files changed, 25 insertions(+), 6 deletions(-) diff --git a/drmtools-egl.c b/drmtools-egl.c index 8c91c0f..01cbab9 100644 --- a/drmtools-egl.c +++ b/drmtools-egl.c @@ -176,6 +176,9 @@ gfxstate *drm_init_egl(const char *device, const char *output) if (drm_setup_egl() < 0) return NULL; + fprintf(stderr, "%s: %s\n", + glGetString(GL_VENDOR), glGetString(GL_RENDERER)); + /* prepare gfx */ gfx = malloc(sizeof(*gfx)); memset(gfx, 0, sizeof(*gfx)); diff --git a/fbiconfig.c b/fbiconfig.c index 39da0bc..565a21b 100644 --- a/fbiconfig.c +++ b/fbiconfig.c @@ -204,6 +204,11 @@ struct cfg_cmdline fbpdf_cmd[] = { .option = { O_DEVICE_INFO }, .value = "1", .desc = "print device info", + },{ + .cmdline = "store", + .option = { O_WRITECONF }, + .value = "1", + .desc = "write cmd line args to config file", },{ /* end of list */ } @@ -228,12 +233,17 @@ struct cfg_cmdline fbpdf_cfg[] = { .option = { O_OUTPUT }, .needsarg = 1, .desc = "use drm output (try -info for a list)", + },{ + .cmdline = "pageflip", + .option = { O_PAGEFLIP }, + .yesno = 1, + .desc = "use pageflip (drm only)", },{ .letter = 'g', .cmdline = "opengl", .option = { O_OPENGL }, .yesno = 1, - .desc = "use opengl", + .desc = "use opengl (drm only)", },{ .letter = 'm', .cmdline = "mode", diff --git a/fbiconfig.h b/fbiconfig.h index 3cd5d7d..2e3a0a1 100644 --- a/fbiconfig.h +++ b/fbiconfig.h @@ -34,6 +34,7 @@ #define O_DEVICE O_OPTIONS, "device" #define O_OUTPUT O_OPTIONS, "output" #define O_OPENGL O_OPTIONS, "opengl" +#define O_PAGEFLIP O_OPTIONS, "pageflip" #define O_FONT O_OPTIONS, "font" #define O_VIDEO_MODE O_OPTIONS, "video-mode" @@ -65,6 +66,7 @@ #define GET_PCD_RES() cfg_get_int(O_PCD_RES, 3) #define GET_OPENGL() cfg_get_bool(O_OPENGL, 0) +#define GET_PAGEFLIP() cfg_get_bool(O_PAGEFLIP, 1) /* -------------------------------------------------------------------------- */ diff --git a/fbpdf.c b/fbpdf.c index c97edc1..0bc39ff 100644 --- a/fbpdf.c +++ b/fbpdf.c @@ -246,7 +246,7 @@ int main(int argc, char *argv[]) { GError *err = NULL; bool framebuffer = false; - bool quit, newpage; + bool quit, newpage, opengl, pageflip; char cwd[1024]; char uri[1024]; char key[32]; @@ -271,6 +271,8 @@ int main(int argc, char *argv[]) drm_info(cfg_get_str(O_DEVICE)); exit(0); } + if (GET_WRITECONF()) + fbi_write_config(); if (optind+1 != argc ) { usage(stderr, argv[0]); @@ -300,15 +302,17 @@ int main(int argc, char *argv[]) output = cfg_get_str(O_OUTPUT); mode = cfg_get_str(O_VIDEO_MODE); fitwidth = GET_FIT_WIDTH(); + opengl = GET_OPENGL(); + pageflip = GET_PAGEFLIP(); if (device) { /* device specified */ if (strncmp(device, "/dev/d", 6) == 0) { - if (GET_OPENGL()) { + if (opengl) { gfx = drm_init_egl(device, output); } if (!gfx) { - gfx = drm_init(device, output, true); + gfx = drm_init(device, output, pageflip); } } else { framebuffer = true; @@ -316,11 +320,11 @@ int main(int argc, char *argv[]) } } else { /* try drm first, failing that fb */ - if (GET_OPENGL()) { + if (opengl) { gfx = drm_init_egl(NULL, output); } if (!gfx) { - gfx = drm_init(NULL, output, true); + gfx = drm_init(NULL, output, pageflip); } if (!gfx) { framebuffer = true; -- cgit