diff options
author | Vito Caputo <vcaputo@pengaru.com> | 2022-04-28 01:32:44 -0700 |
---|---|---|
committer | Vito Caputo <vcaputo@pengaru.com> | 2022-05-01 13:52:14 -0700 |
commit | 5e8d2d487db792c13609e2e83890256d452873d9 (patch) | |
tree | be7f2ac0217a914a3d9799ac98af528008111edd | |
parent | 920839003b4ea1628d81fc56351b2cf053f2f8ff (diff) |
modules/plasma: randomize initial state of contexts
As with roto, it's important to differentiate plasma instances
when layered... plus it's kind of boring to always start plasma
identically.
-rw-r--r-- | src/modules/plasma/plasma.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/modules/plasma/plasma.c b/src/modules/plasma/plasma.c index d319d90..ee499a6 100644 --- a/src/modules/plasma/plasma.c +++ b/src/modules/plasma/plasma.c @@ -53,7 +53,8 @@ static void init_plasma(int32_t *costab, int32_t *sintab) static void * plasma_create_context(unsigned ticks, unsigned n_cpus, til_setup_t *setup) { - static int initialized; + static int initialized; + plasma_context_t *ctxt; if (!initialized) { initialized = 1; @@ -61,7 +62,13 @@ static void * plasma_create_context(unsigned ticks, unsigned n_cpus, til_setup_t init_plasma(costab, sintab); } - return calloc(1, sizeof(plasma_context_t)); + ctxt = calloc(1, sizeof(plasma_context_t)); + if (!ctxt) + return NULL; + + ctxt->rr = rand(); + + return ctxt; } |