From 5e8d2d487db792c13609e2e83890256d452873d9 Mon Sep 17 00:00:00 2001 From: Vito Caputo Date: Thu, 28 Apr 2022 01:32:44 -0700 Subject: 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. --- src/modules/plasma/plasma.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src/modules') 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; } -- cgit v1.2.3