summaryrefslogtreecommitdiff
path: root/src/modules/checkers
diff options
context:
space:
mode:
authorVito Caputo <vcaputo@pengaru.com>2023-01-11 15:22:01 -0800
committerVito Caputo <vcaputo@pengaru.com>2023-01-11 22:31:31 -0800
commitb08baac7e388bf32fefd4f1ab129b28d5fc57aa9 (patch)
tree51e7b414c88ef5637b038f6747be15898d54618d /src/modules/checkers
parent470305ae1c7b038fa0ad58223a2d48f60158a7bf (diff)
* turn til_fb_fragment_t.stream into a discrete parameter
This was mostly done out of convenience at the expense of turning the fragment struct into more of a junk drawer. But properly cleaning up owned stream pipes on context destroy makes the inappropriateness of being part of til_fb_fragment_t glaringly apparent. Now the stream is just a separate thing passed to context create, with a reference kept in the context for use throughout. Cleanup of the owned pipes on the stream supplied to context create is automagic when the context gets destroyed. Note that despite there being a stream in the module context, the stream to use is still supplied to all the rendering family functions (prepare/render/finish) and it's the passed-in stream which should be used by these functions. This is done to support the possibility of switching out the stream frame-to-frame, which may be interesting. Imagine doing things like a latent stream and a future stream and switching between them on the fly for instance. If there's a sequencing composite module, it could flip between multiple sets of tracks or jump around multiple streams with the visuals immediately flipping accordingly. This should fix the --print-pipes crashing issues caused by lack of cleanup when contexts were removed (like rtv does so often).
Diffstat (limited to 'src/modules/checkers')
-rw-r--r--src/modules/checkers/checkers.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/modules/checkers/checkers.c b/src/modules/checkers/checkers.c
index b7a4f11..c4a419f 100644
--- a/src/modules/checkers/checkers.c
+++ b/src/modules/checkers/checkers.c
@@ -79,7 +79,7 @@ static checkers_setup_t checkers_default_setup = {
};
-static til_module_context_t * checkers_create_context(unsigned seed, unsigned ticks, unsigned n_cpus, char *path, til_setup_t *setup)
+static til_module_context_t * checkers_create_context(til_stream_t *stream, unsigned seed, unsigned ticks, unsigned n_cpus, char *path, til_setup_t *setup)
{
size_t size = sizeof(checkers_context_t);
checkers_context_t *ctxt;
@@ -90,7 +90,7 @@ static til_module_context_t * checkers_create_context(unsigned seed, unsigned ti
if (((checkers_setup_t *)setup)->fill_module)
size += sizeof(til_module_context_t *) * n_cpus;
- ctxt = til_module_context_new(size, ticks, seed, n_cpus, path);
+ ctxt = til_module_context_new(stream, size, ticks, seed, n_cpus, path);
if (!ctxt)
return NULL;
@@ -104,7 +104,7 @@ static til_module_context_t * checkers_create_context(unsigned seed, unsigned ti
/* since checkers is already threaded, create an n_cpus=1 context per-cpu */
for (unsigned i = 0; i < n_cpus; i++) /* TODO: errors */
- (void) til_module_create_context(module, seed, ticks, 1, path /* FIXME TODO path-per-context breaks down on these per-cpu-context abuses */, module_setup, &ctxt->fill_module_contexts[i]);
+ (void) til_module_create_context(module, stream, seed, ticks, 1, path /* FIXME TODO path-per-context breaks down on these per-cpu-context abuses */, module_setup, &ctxt->fill_module_contexts[i]);
/* XXX: it would be interesting to support various patterns/layouts by varying the seed, but this will require
* more complex context allocation strategies while also maintaining the per-cpu allocation.
@@ -227,7 +227,7 @@ static int checkers_fragmenter(til_module_context_t *context, const til_fb_fragm
}
-static void checkers_prepare_frame(til_module_context_t *context, unsigned ticks, til_fb_fragment_t **fragment_ptr, til_frame_plan_t *res_frame_plan)
+static void checkers_prepare_frame(til_module_context_t *context, til_stream_t *stream, unsigned ticks, til_fb_fragment_t **fragment_ptr, til_frame_plan_t *res_frame_plan)
{
checkers_context_t *ctxt = (checkers_context_t *)context;
til_fb_fragment_t *fragment = *fragment_ptr;
@@ -255,7 +255,7 @@ static inline unsigned hash(unsigned x)
}
-static void checkers_render_fragment(til_module_context_t *context, unsigned ticks, unsigned cpu, til_fb_fragment_t **fragment_ptr)
+static void checkers_render_fragment(til_module_context_t *context, til_stream_t *stream, unsigned ticks, unsigned cpu, til_fb_fragment_t **fragment_ptr)
{
checkers_context_t *ctxt = (checkers_context_t *)context;
til_fb_fragment_t *fragment = *fragment_ptr;
@@ -323,7 +323,7 @@ static void checkers_render_fragment(til_module_context_t *context, unsigned tic
til_fb_fragment_fill(fragment, flags, color);
else {
/* TODO: we need a way to send down color and flags, and use the module render as a brush of sorts */
- til_module_render(ctxt->fill_module_contexts[cpu], ticks, fragment_ptr);
+ til_module_render(ctxt->fill_module_contexts[cpu], stream, ticks, fragment_ptr);
}
}
}
© All Rights Reserved