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 | |
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')
-rw-r--r-- | src/modules/checkers/checkers.c | 2 | ||||
-rw-r--r-- | src/modules/drizzle/drizzle.c | 2 | ||||
-rw-r--r-- | src/modules/flui2d/flui2d.c | 2 | ||||
-rw-r--r-- | src/modules/julia/julia.c | 2 | ||||
-rw-r--r-- | src/modules/meta2d/meta2d.c | 2 | ||||
-rw-r--r-- | src/modules/montage/montage.c | 7 | ||||
-rw-r--r-- | src/modules/plasma/plasma.c | 2 | ||||
-rw-r--r-- | src/modules/ray/ray.c | 2 | ||||
-rw-r--r-- | src/modules/roto/roto.c | 2 | ||||
-rw-r--r-- | src/modules/snow/snow.c | 2 | ||||
-rw-r--r-- | src/modules/sparkler/sparkler.c | 2 | ||||
-rw-r--r-- | src/modules/submit/submit.c | 2 | ||||
-rw-r--r-- | src/modules/swab/swab.c | 2 | ||||
-rw-r--r-- | src/modules/voronoi/voronoi.c | 2 |
14 files changed, 15 insertions, 18 deletions
diff --git a/src/modules/checkers/checkers.c b/src/modules/checkers/checkers.c index b4bc56f..99812cc 100644 --- a/src/modules/checkers/checkers.c +++ b/src/modules/checkers/checkers.c @@ -84,7 +84,7 @@ static void checkers_destroy_context(void *context) } -static int checkers_fragmenter(void *context, const til_fb_fragment_t *fragment, unsigned number, til_fb_fragment_t *res_fragment) +static int checkers_fragmenter(void *context, unsigned n_cpus, const til_fb_fragment_t *fragment, unsigned number, til_fb_fragment_t *res_fragment) { checkers_context_t *ctxt = context; diff --git a/src/modules/drizzle/drizzle.c b/src/modules/drizzle/drizzle.c index 2fa3b75..498b857 100644 --- a/src/modules/drizzle/drizzle.c +++ b/src/modules/drizzle/drizzle.c @@ -106,7 +106,7 @@ static void drizzle_destroy_context(void *context) } -static int drizzle_fragmenter(void *context, const til_fb_fragment_t *fragment, unsigned number, til_fb_fragment_t *res_fragment) +static int drizzle_fragmenter(void *context, unsigned n_cpus, const til_fb_fragment_t *fragment, unsigned number, til_fb_fragment_t *res_fragment) { drizzle_context_t *ctxt = context; diff --git a/src/modules/flui2d/flui2d.c b/src/modules/flui2d/flui2d.c index 53ed49d..e00dcca 100644 --- a/src/modules/flui2d/flui2d.c +++ b/src/modules/flui2d/flui2d.c @@ -276,7 +276,7 @@ static void flui2d_destroy_context(void *context) } -static int flui2d_fragmenter(void *context, const til_fb_fragment_t *fragment, unsigned number, til_fb_fragment_t *res_fragment) +static int flui2d_fragmenter(void *context, unsigned n_cpus, const til_fb_fragment_t *fragment, unsigned number, til_fb_fragment_t *res_fragment) { return til_fb_fragment_tile_single(fragment, 64, number, res_fragment); } diff --git a/src/modules/julia/julia.c b/src/modules/julia/julia.c index 4b3cd73..fc0f092 100644 --- a/src/modules/julia/julia.c +++ b/src/modules/julia/julia.c @@ -102,7 +102,7 @@ static inline unsigned julia_iter(float real, float imag, float creal, float cim } -static int julia_fragmenter(void *context, const til_fb_fragment_t *fragment, unsigned number, til_fb_fragment_t *res_fragment) +static int julia_fragmenter(void *context, unsigned n_cpus, const til_fb_fragment_t *fragment, unsigned number, til_fb_fragment_t *res_fragment) { julia_context_t *ctxt = context; diff --git a/src/modules/meta2d/meta2d.c b/src/modules/meta2d/meta2d.c index 8edff42..327a4d9 100644 --- a/src/modules/meta2d/meta2d.c +++ b/src/modules/meta2d/meta2d.c @@ -100,7 +100,7 @@ static void meta2d_destroy_context(void *context) } -static int meta2d_fragmenter(void *context, const til_fb_fragment_t *fragment, unsigned number, til_fb_fragment_t *res_fragment) +static int meta2d_fragmenter(void *context, unsigned n_cpus, const til_fb_fragment_t *fragment, unsigned number, til_fb_fragment_t *res_fragment) { meta2d_context_t *ctxt = context; 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); diff --git a/src/modules/plasma/plasma.c b/src/modules/plasma/plasma.c index 0a6b1e5..a498f6d 100644 --- a/src/modules/plasma/plasma.c +++ b/src/modules/plasma/plasma.c @@ -72,7 +72,7 @@ static void plasma_destroy_context(void *context) } -static int plasma_fragmenter(void *context, const til_fb_fragment_t *fragment, unsigned number, til_fb_fragment_t *res_fragment) +static int plasma_fragmenter(void *context, unsigned n_cpus, const til_fb_fragment_t *fragment, unsigned number, til_fb_fragment_t *res_fragment) { plasma_context_t *ctxt = context; diff --git a/src/modules/ray/ray.c b/src/modules/ray/ray.c index 49d3371..6ecb2ff 100644 --- a/src/modules/ray/ray.c +++ b/src/modules/ray/ray.c @@ -142,7 +142,7 @@ static void ray_destroy_context(void *context) } -static int ray_fragmenter(void *context, const til_fb_fragment_t *fragment, unsigned number, til_fb_fragment_t *res_fragment) +static int ray_fragmenter(void *context, unsigned n_cpus, const til_fb_fragment_t *fragment, unsigned number, til_fb_fragment_t *res_fragment) { return til_fb_fragment_tile_single(fragment, 64, number, res_fragment); } diff --git a/src/modules/roto/roto.c b/src/modules/roto/roto.c index 65b3400..98fffc0 100644 --- a/src/modules/roto/roto.c +++ b/src/modules/roto/roto.c @@ -169,7 +169,7 @@ static void init_roto(uint8_t texture[256][256], int32_t *costab, int32_t *sinta } -static int roto_fragmenter(void *context, const til_fb_fragment_t *fragment, unsigned number, til_fb_fragment_t *res_fragment) +static int roto_fragmenter(void *context, unsigned n_cpus, const til_fb_fragment_t *fragment, unsigned number, til_fb_fragment_t *res_fragment) { roto_context_t *ctxt = context; diff --git a/src/modules/snow/snow.c b/src/modules/snow/snow.c index cd364a0..685d1bc 100644 --- a/src/modules/snow/snow.c +++ b/src/modules/snow/snow.c @@ -43,7 +43,7 @@ static void snow_destroy_context(void *context) } -static int snow_fragmenter(void *context, const til_fb_fragment_t *fragment, unsigned number, til_fb_fragment_t *res_fragment) +static int snow_fragmenter(void *context, unsigned n_cpus, const til_fb_fragment_t *fragment, unsigned number, til_fb_fragment_t *res_fragment) { snow_context_t *ctxt = context; diff --git a/src/modules/sparkler/sparkler.c b/src/modules/sparkler/sparkler.c index 62abfe5..e4e241d 100644 --- a/src/modules/sparkler/sparkler.c +++ b/src/modules/sparkler/sparkler.c @@ -73,7 +73,7 @@ static void sparkler_destroy_context(void *context) } -static int sparkler_fragmenter(void *context, const til_fb_fragment_t *fragment, unsigned number, til_fb_fragment_t *res_fragment) +static int sparkler_fragmenter(void *context, unsigned n_cpus, const til_fb_fragment_t *fragment, unsigned number, til_fb_fragment_t *res_fragment) { sparkler_context_t *ctxt = context; diff --git a/src/modules/submit/submit.c b/src/modules/submit/submit.c index f8e2ff0..ebda531 100644 --- a/src/modules/submit/submit.c +++ b/src/modules/submit/submit.c @@ -292,7 +292,7 @@ static void submit_destroy_context(void *context) } -static int submit_fragmenter(void *context, const til_fb_fragment_t *fragment, unsigned number, til_fb_fragment_t *res_fragment) +static int submit_fragmenter(void *context, unsigned n_cpus, const til_fb_fragment_t *fragment, unsigned number, til_fb_fragment_t *res_fragment) { return til_fb_fragment_tile_single(fragment, 32, number, res_fragment); } diff --git a/src/modules/swab/swab.c b/src/modules/swab/swab.c index 6a0d81d..63d5649 100644 --- a/src/modules/swab/swab.c +++ b/src/modules/swab/swab.c @@ -92,7 +92,7 @@ static void swab_destroy_context(void *context) } -static int swab_fragmenter(void *context, const til_fb_fragment_t *fragment, unsigned number, til_fb_fragment_t *res_fragment) +static int swab_fragmenter(void *context, unsigned n_cpus, const til_fb_fragment_t *fragment, unsigned number, til_fb_fragment_t *res_fragment) { swab_context_t *ctxt = context; diff --git a/src/modules/voronoi/voronoi.c b/src/modules/voronoi/voronoi.c index ea68136..204746f 100644 --- a/src/modules/voronoi/voronoi.c +++ b/src/modules/voronoi/voronoi.c @@ -105,7 +105,7 @@ static void voronoi_destroy_context(void *context) } -static int voronoi_fragmenter(void *context, const til_fb_fragment_t *fragment, unsigned number, til_fb_fragment_t *res_fragment) +static int voronoi_fragmenter(void *context, unsigned n_cpus, const til_fb_fragment_t *fragment, unsigned number, til_fb_fragment_t *res_fragment) { voronoi_context_t *ctxt = context; |