diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2016-07-03 09:42:38 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2016-07-03 11:23:05 +0100 |
commit | 376b813e7c60826357034f4ea40ffada514fbdc3 (patch) | |
tree | 12d829ab778cd16e0b41eea88d8153163e624485 /lib/igt_rand.c | |
parent | 3e765840129a17b462565f7b48dfe9d9792b292f (diff) |
igt/gem_exec_gttfill: Reduce overhead in setting up filler batches
Since all the batches start with the same content, we can reuse the same
buf to fill them.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'lib/igt_rand.c')
-rw-r--r-- | lib/igt_rand.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/igt_rand.c b/lib/igt_rand.c new file mode 100644 index 00000000..a3298a9f --- /dev/null +++ b/lib/igt_rand.c @@ -0,0 +1,19 @@ +#include "igt_rand.h" + +static uint32_t state = 0x12345678; + +uint32_t +hars_petruska_f54_1_random_seed(uint32_t new_state) +{ + uint32_t old_state = state; + state = new_state; + return old_state; +} + +uint32_t +hars_petruska_f54_1_random_unsafe(void) +{ +#define rol(x,k) ((x << k) | (x >> (32-k))) + return state = (state ^ rol (state, 5) ^ rol (state, 24)) + 0x37798849; +#undef rol +} |