mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-02 10:46:50 +07:00
a33d42dd03
When testing, we want a random but yet reproducible order in which to process elements. Here we create an array which is a random (using the Tausworthe PRNG) permutation of the order in which to execute. Note these are simple helpers intended to be merged upstream in lib/ v2: Tidier code by David Herrmann v3: Add reminder that this code is intended to be temporary, with at least the bulk of the prandom changes going to lib/ Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com> Cc: David Herrmann <dh.herrmann@gmail.com> Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> Link: http://patchwork.freedesktop.org/patch/msgid/20161222083641.2691-6-chris@chris-wilson.co.uk
26 lines
680 B
C
26 lines
680 B
C
#ifndef __DRM_RANDOM_H__
|
|
#define __DRM_RANDOM_H__
|
|
|
|
/* This is a temporary home for a couple of utility functions that should
|
|
* be transposed to lib/ at the earliest convenience.
|
|
*/
|
|
|
|
#include <linux/random.h>
|
|
|
|
#define DRM_RND_STATE_INITIALIZER(seed__) ({ \
|
|
struct rnd_state state__; \
|
|
prandom_seed_state(&state__, (seed__)); \
|
|
state__; \
|
|
})
|
|
|
|
#define DRM_RND_STATE(name__, seed__) \
|
|
struct rnd_state name__ = DRM_RND_STATE_INITIALIZER(seed__)
|
|
|
|
unsigned int *drm_random_order(unsigned int count,
|
|
struct rnd_state *state);
|
|
void drm_random_reorder(unsigned int *order,
|
|
unsigned int count,
|
|
struct rnd_state *state);
|
|
|
|
#endif /* !__DRM_RANDOM_H__ */
|