summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVito Caputo <vcaputo@pengaru.com>2022-04-22 13:32:50 -0700
committerVito Caputo <vcaputo@pengaru.com>2022-04-22 13:32:50 -0700
commit4e0138c315d2a165335724f7993724da4f7a1147 (patch)
treeb2848e4e452d3dc8226c34d17458a3292af226e8
parent0a798f421863d7c74bf7e8e6f37d8021e9df52f2 (diff)
modules/montage: randomize module setups
Instead of always showing defaults, randomize the setup like rtv does.
-rw-r--r--src/modules/montage/montage.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/src/modules/montage/montage.c b/src/modules/montage/montage.c
index 521ccfd..15c1354 100644
--- a/src/modules/montage/montage.c
+++ b/src/modules/montage/montage.c
@@ -10,9 +10,9 @@
typedef struct montage_context_t {
const til_module_t **modules;
- void **contexts;
- size_t n_modules;
- unsigned n_cpus;
+ void **contexts;
+ size_t n_modules;
+ unsigned n_cpus;
} montage_context_t;
static void setup_next_module(montage_context_t *ctxt);
@@ -88,9 +88,19 @@ static void * montage_create_context(unsigned ticks, unsigned num_cpus, void *se
for (size_t i = 0; i < ctxt->n_modules; i++) {
const til_module_t *module = ctxt->modules[i];
+ void *setup = NULL;
+
+ (void) til_module_randomize_setup(module, &setup, NULL);
if (module->create_context) /* FIXME errors */
- ctxt->contexts[i] = module->create_context(ticks, 1, NULL);
+ ctxt->contexts[i] = module->create_context(ticks, 1, setup);
+
+ /* TODO FIXME: free setup! modules don't currently implement it.
+ * What should probably happen is the setup should become a til struct
+ * type having just a free function pointer. Then module setups would
+ * simply embed this at the start of their private setup struct and return a
+ * pointer to that as their setup.
+ */
}
return ctxt;
© All Rights Reserved