diff options
author | Vito Caputo <vcaputo@pengaru.com> | 2022-05-01 11:12:16 -0700 |
---|---|---|
committer | Vito Caputo <vcaputo@pengaru.com> | 2022-05-01 13:49:51 -0700 |
commit | a4d50ba990cd8df5617bb945938aee7b5b556d11 (patch) | |
tree | f0c34953d285b4b5b4b172c59afcfa0c76590357 /src/modules/montage | |
parent | f203d1b61b07f1c87df46b576d57f378247db07d (diff) |
til: wire n_cpus up to the fragmenter function
Fragmenting is often dimensioned according to the number of cpus,
and by not supplying this to the fragmenter it was made rather
common for module contexts to plumb this themselves - in some
cases incorporating a context type/create/destroy rigamarole
for the n_cpus circuit alone.
So just plumb it in libtil, and the prepare_frame functions can
choose to ignore it if they have something more desirable onhand.
Future commits will remove a bunch of n_cpus from module contexts
in favor of this.
Diffstat (limited to 'src/modules/montage')
-rw-r--r-- | src/modules/montage/montage.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/src/modules/montage/montage.c b/src/modules/montage/montage.c index e6f6ef1..19562db 100644 --- a/src/modules/montage/montage.c +++ b/src/modules/montage/montage.c @@ -12,7 +12,6 @@ typedef struct montage_context_t { const til_module_t **modules; void **contexts; size_t n_modules; - unsigned n_cpus; } montage_context_t; static void setup_next_module(montage_context_t *ctxt); @@ -77,8 +76,6 @@ static void * montage_create_context(unsigned ticks, unsigned num_cpus, til_setu ctxt->modules[ctxt->n_modules++] = module; } - ctxt->n_cpus = num_cpus; - ctxt->contexts = calloc(ctxt->n_modules, sizeof(void *)); if (!ctxt->contexts) { free(ctxt); @@ -164,7 +161,7 @@ static int montage_fragment_tile(const til_fb_fragment_t *fragment, unsigned til * 1. it divides the frame into subfragments for threaded rendering * 2. it determines which modules will be rendered where via fragment->number */ -static int montage_fragmenter(void *context, const til_fb_fragment_t *fragment, unsigned number, til_fb_fragment_t *res_fragment) +static int montage_fragmenter(void *context, unsigned n_cpus, const til_fb_fragment_t *fragment, unsigned number, til_fb_fragment_t *res_fragment) { montage_context_t *ctxt = context; float root = sqrtf(ctxt->n_modules); @@ -215,7 +212,7 @@ static void montage_render_fragment(void *context, unsigned ticks, unsigned cpu, module->prepare_frame(ctxt->contexts[fragment->number], ticks, 1, fragment, &fragmenter); - while (fragmenter(ctxt->contexts[fragment->number], fragment, fragnum++, &frag)) + while (fragmenter(ctxt->contexts[fragment->number], 1, fragment, fragnum++, &frag)) module->render_fragment(ctxt->contexts[fragment->number], ticks, fragnum, &frag); } else if (module->render_fragment) module->render_fragment(ctxt->contexts[fragment->number], ticks, 0, fragment); |