summaryrefslogtreecommitdiff
path: root/src/main.c
diff options
context:
space:
mode:
authorVito Caputo <vcaputo@pengaru.com>2023-01-10 23:33:45 -0800
committerVito Caputo <vcaputo@pengaru.com>2023-01-11 22:31:31 -0800
commit470305ae1c7b038fa0ad58223a2d48f60158a7bf (patch)
treea863ca2b2cf1116109e4e3360bc34288caa9851e /src/main.c
parentd94affec0e772e529479b0a4624464690919fed4 (diff)
main,til_args: employ the stream, add --print-pipes
This is a rudimentary integration of the new til_stream_t into rototiller. If the stream is going to continue living in til_fb_fragment_t, the fragmenters and other nested frame scenarios likely need to be updated to copy the stream through to make the pipes available to the nested renders. --print-pipes dumps the values found at the pipes' driver taps to stdout on every frame. Right now there's no way to externally write these values, but with --print-pipes you can already see where things are going and it's a nice visibility tool for tapped variables in modules. Only stars and plato tap variables presently, but that will improve.
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/main.c b/src/main.c
index 0718bfd..5b2024d 100644
--- a/src/main.c
+++ b/src/main.c
@@ -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;
© All Rights Reserved