diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/main.c | 12 | ||||
-rw-r--r-- | src/til_args.c | 3 | ||||
-rw-r--r-- | src/til_args.h | 1 |
3 files changed, 15 insertions, 1 deletions
@@ -12,8 +12,9 @@ #include "til.h" #include "til_args.h" -#include "til_settings.h" #include "til_fb.h" +#include "til_settings.h" +#include "til_stream.h" #include "til_util.h" #include "fps.h" @@ -53,6 +54,7 @@ typedef struct rototiller_t { til_args_t args; const til_module_t *module; til_module_context_t *module_context; + til_stream_t *stream; pthread_t thread; til_fb_t *fb; struct timeval start_tv; @@ -329,10 +331,14 @@ static void * rototiller_thread(void *_rt) unsigned ticks; fragment = til_fb_page_get(rt->fb); + fragment->stream = rt->stream; gettimeofday(&now, NULL); ticks = get_ticks(&rt->start_tv, &now, rt->ticks_offset); til_module_render(rt->module_context, ticks, &fragment); til_fb_fragment_submit(fragment); + + if (rt->args.print_pipes) /* render threads are idle at this point */ + til_stream_fprint(rt->stream, stdout); } return NULL; @@ -376,6 +382,9 @@ int main(int argc, const char *argv[]) exit_if((r = til_fb_new(fb_ops, setup.video_setup, NUM_FB_PAGES, &rototiller.fb)) < 0, "unable to create fb: %s", strerror(-r)); + exit_if(!(rototiller.stream = til_stream_new()), + "unable to create root stream"); + exit_if(!fps_setup(), "unable to setup fps counter"); @@ -405,6 +414,7 @@ int main(int argc, const char *argv[]) pthread_join(rototiller.thread, NULL); til_shutdown(); til_module_context_free(rototiller.module_context); + til_stream_free(rototiller.stream); til_fb_free(rototiller.fb); return EXIT_SUCCESS; diff --git a/src/til_args.c b/src/til_args.c index 8969d89..11f2487 100644 --- a/src/til_args.c +++ b/src/til_args.c @@ -12,6 +12,7 @@ * ./rototiller --defaults // use default settings where unspecified * ./rototiller --go // don't show args and wait for user input before proceeding * ./rototiller --seed=0xdeadbeef // explicitly set global random seed instead of generating one + * ./rototiller --print-pipes // print values for the pipes every frame * * unrecognized arguments trigger an -EINVAL error, unless res_{argc,argv} are non-NULL * where a new argv will be allocated and populated with the otherwise invalid arguments @@ -54,6 +55,8 @@ static int args_parse(int argc, const char *argv[], til_args_t *res_args, int *r res_args->help = 1; } else if (!strcasecmp("--go", argv[i])) { res_args->gogogo = 1; + } else if (!strcasecmp("--print-pipes", argv[i])) { + res_args->print_pipes = 1; } else { if (!res_argv) return -EINVAL; diff --git a/src/til_args.h b/src/til_args.h index d45b619..85d4d7b 100644 --- a/src/til_args.h +++ b/src/til_args.h @@ -11,6 +11,7 @@ typedef struct til_args_t { unsigned use_defaults:1; unsigned help:1; unsigned gogogo:1; + unsigned print_pipes:1; } til_args_t; int til_args_parse(int argc, const char *argv[], til_args_t *res_args); |