diff options
author | Vito Caputo <vcaputo@pengaru.com> | 2018-01-02 21:11:55 -0800 |
---|---|---|
committer | Vito Caputo <vcaputo@pengaru.com> | 2018-02-22 14:26:10 -0800 |
commit | d8948f3755d0b5bd199d80b60ece460ac61979f0 (patch) | |
tree | 29daa4badaa995c6ed1054c8bc800ea0be5c9465 /src | |
parent | d58d959a94f24fa6f496380b1f085cda48560a63 (diff) |
rototiller: wire up sdl video backend
Diffstat (limited to 'src')
-rw-r--r-- | src/rototiller.c | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/src/rototiller.c b/src/rototiller.c index e9bccfa..d09438e 100644 --- a/src/rototiller.c +++ b/src/rototiller.c @@ -11,6 +11,7 @@ #include <xf86drmMode.h> #include "drm_fb.h" +#include "sdl_fb.h" #include "settings.h" #include "setup.h" #include "fb.h" @@ -31,6 +32,8 @@ #define DEFAULT_VIDEO "drm" extern fb_ops_t drm_fb_ops; +extern fb_ops_t sdl_fb_ops; +fb_ops_t *fb_ops; extern rototiller_module_t julia_module; extern rototiller_module_t plasma_module; @@ -151,12 +154,13 @@ static int setup_video(settings_t *settings, setting_desc_t **next_setting) setting_desc_t *desc; const char *values[] = { "drm", + "sdl", NULL, }; desc = setting_desc_new("Video Backend", NULL, - "drm", + "[a-z]+", DEFAULT_VIDEO, values, NULL); @@ -168,11 +172,18 @@ static int setup_video(settings_t *settings, setting_desc_t **next_setting) return 1; } - /* XXX: this is temporarily simply restricted to drm */ - if (strcmp(video, "drm")) - return -EINVAL; + /* XXX: this is kind of hacky for now */ + if (!strcmp(video, "drm")) { + fb_ops = &drm_fb_ops; + + return drm_fb_ops.setup(settings, next_setting); + } else if (!strcmp(video, "sdl")) { + fb_ops = &sdl_fb_ops; + + return sdl_fb_ops.setup(settings, next_setting); + } - return drm_fb_ops.setup(settings, next_setting); + return -EINVAL; } /* select module if not yet selected, then setup the module. */ @@ -345,7 +356,7 @@ int main(int argc, const char *argv[]) exit_if(!(module = module_lookup(settings_get_key(setup.module, 0))), "unable to lookup module from settings \"%s\"", settings_get_key(setup.module, 0)); - exit_if(!(fb = fb_new(&drm_fb_ops, setup.video, NUM_FB_PAGES)), + exit_if(!(fb = fb_new(fb_ops, setup.video, NUM_FB_PAGES)), "unable to create fb"); exit_if(!fps_setup(), |