summaryrefslogtreecommitdiff
path: root/src/modules
diff options
context:
space:
mode:
authorVito Caputo <vcaputo@pengaru.com>2019-11-24 22:05:22 -0800
committerVito Caputo <vcaputo@pengaru.com>2019-11-24 22:05:22 -0800
commit5be99f176e6bab0d3cb45aa396d4ab852719db5d (patch)
tree97c2292b0264fb60d547a4020a2cd5409208afed /src/modules
parent7857405e735fcf4542f9022d8f9e00c176f86597 (diff)
snow: only create n_cpus fragments
Since snow_context_t needs another member anyways, stick n_cpus in there to inform the fragmenter of precisely how many fragments to make. This renderer doesn't benefit from tiling or any such locality, so it uses the slice fragmenter and really only benefits from as many fragments as there are CPUs. Any additional fragments is just wasted fragmenting overhead.
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/snow/snow.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/modules/snow/snow.c b/src/modules/snow/snow.c
index 3e6331a..2de4d76 100644
--- a/src/modules/snow/snow.c
+++ b/src/modules/snow/snow.c
@@ -15,7 +15,7 @@ typedef union snow_seed_t {
} snow_seed_t;
typedef struct snow_context_t {
- int foo; /* make the compiler happy */
+ unsigned n_cpus;
snow_seed_t seeds[];
} snow_context_t;
@@ -31,6 +31,8 @@ static void * snow_create_context(unsigned n_cpus)
for (unsigned i = 0; i < n_cpus; i++)
ctxt->seeds[i].seed = rand();
+ ctxt->n_cpus = n_cpus;
+
return ctxt;
}
@@ -43,7 +45,9 @@ static void snow_destroy_context(void *context)
static int snow_fragmenter(void *context, const fb_fragment_t *fragment, unsigned number, fb_fragment_t *res_fragment)
{
- return fb_fragment_slice_single(fragment, 32, number, res_fragment);
+ snow_context_t *ctxt = context;
+
+ return fb_fragment_slice_single(fragment, ctxt->n_cpus, number, res_fragment);
}
© All Rights Reserved