* [PATCH i-g-t 1/5] lib/kms: simplify igt_random_crtc()
2026-06-18 14:09 [PATCH i-g-t 0/5] igt: cleanups to random functions Jani Nikula
@ 2026-06-18 14:09 ` Jani Nikula
2026-06-18 18:54 ` Sharma, Swati2
2026-06-18 14:09 ` [PATCH i-g-t 2/5] lib/rand: move static inlines to proper functions Jani Nikula
` (5 subsequent siblings)
6 siblings, 1 reply; 13+ messages in thread
From: Jani Nikula @ 2026-06-18 14:09 UTC (permalink / raw)
To: igt-dev; +Cc: jani.nikula
Now that igt_display_n_crtcs() reflects the actual number of CRTCs
again, we no longer have to count them separately.
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
lib/igt_kms.c | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)
diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index e82d32130666..06138ad7125d 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -7922,16 +7922,11 @@ igt_crtc_t *igt_next_crtc(igt_display_t *display, igt_crtc_t *crtc)
*/
igt_crtc_t *igt_random_crtc(igt_display_t *display)
{
- igt_crtc_t *crtcs[IGT_MAX_PIPES];
- igt_crtc_t *crtc;
- int n = 0;
-
- for_each_crtc(display, crtc)
- crtcs[n++] = crtc;
+ int n = igt_display_n_crtcs(display);
igt_skip_on_f(!n, "No CRTCs on device\n");
- return crtcs[rand() % n];
+ return igt_crtc_for_crtc_index(display, rand() % n);
}
static drmModeConnectorPtr igt_wait_for_connector(int drm_fd, unsigned int connector_id,
--
2.47.3
^ permalink raw reply related [flat|nested] 13+ messages in thread* Re: [PATCH i-g-t 1/5] lib/kms: simplify igt_random_crtc()
2026-06-18 14:09 ` [PATCH i-g-t 1/5] lib/kms: simplify igt_random_crtc() Jani Nikula
@ 2026-06-18 18:54 ` Sharma, Swati2
0 siblings, 0 replies; 13+ messages in thread
From: Sharma, Swati2 @ 2026-06-18 18:54 UTC (permalink / raw)
To: Jani Nikula, igt-dev
Hi Jani
On 18-06-2026 07:39 pm, Jani Nikula wrote:
> Now that igt_display_n_crtcs() reflects the actual number of CRTCs
> again, we no longer have to count them separately.
>
> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Patch LGTM
Reviewed-by: Swati Sharma <swati2.sharma@intel.com>
> ---
> lib/igt_kms.c | 9 ++-------
> 1 file changed, 2 insertions(+), 7 deletions(-)
>
> diff --git a/lib/igt_kms.c b/lib/igt_kms.c
> index e82d32130666..06138ad7125d 100644
> --- a/lib/igt_kms.c
> +++ b/lib/igt_kms.c
> @@ -7922,16 +7922,11 @@ igt_crtc_t *igt_next_crtc(igt_display_t *display, igt_crtc_t *crtc)
> */
> igt_crtc_t *igt_random_crtc(igt_display_t *display)
> {
> - igt_crtc_t *crtcs[IGT_MAX_PIPES];
> - igt_crtc_t *crtc;
> - int n = 0;
> -
> - for_each_crtc(display, crtc)
> - crtcs[n++] = crtc;
> + int n = igt_display_n_crtcs(display);
>
> igt_skip_on_f(!n, "No CRTCs on device\n");
>
> - return crtcs[rand() % n];
> + return igt_crtc_for_crtc_index(display, rand() % n);
> }
>
> static drmModeConnectorPtr igt_wait_for_connector(int drm_fd, unsigned int connector_id,
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH i-g-t 2/5] lib/rand: move static inlines to proper functions
2026-06-18 14:09 [PATCH i-g-t 0/5] igt: cleanups to random functions Jani Nikula
2026-06-18 14:09 ` [PATCH i-g-t 1/5] lib/kms: simplify igt_random_crtc() Jani Nikula
@ 2026-06-18 14:09 ` Jani Nikula
2026-06-18 18:55 ` Sharma, Swati2
2026-06-18 14:09 ` [PATCH i-g-t 3/5] benchmarks/gem_exec_reloc: use hars_petruska_f54_1_random() from lib/rand Jani Nikula
` (4 subsequent siblings)
6 siblings, 1 reply; 13+ messages in thread
From: Jani Nikula @ 2026-06-18 14:09 UTC (permalink / raw)
To: igt-dev; +Cc: jani.nikula
Hide the implementation details. Gut feeling says this also allows the
compiler to do better optimizations within the compilation unit.
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
lib/igt_rand.c | 13 +++++++++++++
lib/igt_rand.h | 13 ++-----------
2 files changed, 15 insertions(+), 11 deletions(-)
diff --git a/lib/igt_rand.c b/lib/igt_rand.c
index 16a6ba9b0c65..b2856d000450 100644
--- a/lib/igt_rand.c
+++ b/lib/igt_rand.c
@@ -35,3 +35,16 @@ uint32_t hars_petruska_f54_1_random_unsafe(void)
{
return hars_petruska_f54_1_random(&global);
}
+
+void hars_petruska_f54_1_random_perturb(uint32_t xor)
+{
+ uint32_t seed = hars_petruska_f54_1_random_seed(0) ^ xor;
+ hars_petruska_f54_1_random_seed(seed);
+ hars_petruska_f54_1_random_seed(hars_petruska_f54_1_random_unsafe());
+}
+
+/* Returns: pseudo-random number in interval [0, ep_ro) */
+uint32_t hars_petruska_f54_1_random_unsafe_max(uint32_t ep_ro)
+{
+ return ((uint64_t)hars_petruska_f54_1_random_unsafe() * ep_ro) >> 32;
+}
diff --git a/lib/igt_rand.h b/lib/igt_rand.h
index 0015680461c1..d89803bb020b 100644
--- a/lib/igt_rand.h
+++ b/lib/igt_rand.h
@@ -32,17 +32,8 @@ uint64_t hars_petruska_f54_1_random64(uint32_t *s);
uint32_t hars_petruska_f54_1_random_seed(uint32_t seed);
uint32_t hars_petruska_f54_1_random_unsafe(void);
-static inline void hars_petruska_f54_1_random_perturb(uint32_t xor)
-{
- uint32_t seed = hars_petruska_f54_1_random_seed(0) ^ xor;
- hars_petruska_f54_1_random_seed(seed);
- hars_petruska_f54_1_random_seed(hars_petruska_f54_1_random_unsafe());
-}
+void hars_petruska_f54_1_random_perturb(uint32_t xor);
-/* Returns: pseudo-random number in interval [0, ep_ro) */
-static inline uint32_t hars_petruska_f54_1_random_unsafe_max(uint32_t ep_ro)
-{
- return ((uint64_t)hars_petruska_f54_1_random_unsafe() * ep_ro) >> 32;
-}
+uint32_t hars_petruska_f54_1_random_unsafe_max(uint32_t ep_ro);
#endif /* IGT_RAND_H */
--
2.47.3
^ permalink raw reply related [flat|nested] 13+ messages in thread* Re: [PATCH i-g-t 2/5] lib/rand: move static inlines to proper functions
2026-06-18 14:09 ` [PATCH i-g-t 2/5] lib/rand: move static inlines to proper functions Jani Nikula
@ 2026-06-18 18:55 ` Sharma, Swati2
0 siblings, 0 replies; 13+ messages in thread
From: Sharma, Swati2 @ 2026-06-18 18:55 UTC (permalink / raw)
To: Jani Nikula, igt-dev
Hi Jani
On 18-06-2026 07:39 pm, Jani Nikula wrote:
> Hide the implementation details. Gut feeling says this also allows the
> compiler to do better optimizations within the compilation unit.
>
> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Patch LGTM
Reviewed-by: Swati Sharma <swati2.sharma@intel.com>
> ---
> lib/igt_rand.c | 13 +++++++++++++
> lib/igt_rand.h | 13 ++-----------
> 2 files changed, 15 insertions(+), 11 deletions(-)
>
> diff --git a/lib/igt_rand.c b/lib/igt_rand.c
> index 16a6ba9b0c65..b2856d000450 100644
> --- a/lib/igt_rand.c
> +++ b/lib/igt_rand.c
> @@ -35,3 +35,16 @@ uint32_t hars_petruska_f54_1_random_unsafe(void)
> {
> return hars_petruska_f54_1_random(&global);
> }
> +
> +void hars_petruska_f54_1_random_perturb(uint32_t xor)
> +{
> + uint32_t seed = hars_petruska_f54_1_random_seed(0) ^ xor;
> + hars_petruska_f54_1_random_seed(seed);
> + hars_petruska_f54_1_random_seed(hars_petruska_f54_1_random_unsafe());
> +}
> +
> +/* Returns: pseudo-random number in interval [0, ep_ro) */
> +uint32_t hars_petruska_f54_1_random_unsafe_max(uint32_t ep_ro)
> +{
> + return ((uint64_t)hars_petruska_f54_1_random_unsafe() * ep_ro) >> 32;
> +}
> diff --git a/lib/igt_rand.h b/lib/igt_rand.h
> index 0015680461c1..d89803bb020b 100644
> --- a/lib/igt_rand.h
> +++ b/lib/igt_rand.h
> @@ -32,17 +32,8 @@ uint64_t hars_petruska_f54_1_random64(uint32_t *s);
> uint32_t hars_petruska_f54_1_random_seed(uint32_t seed);
> uint32_t hars_petruska_f54_1_random_unsafe(void);
>
> -static inline void hars_petruska_f54_1_random_perturb(uint32_t xor)
> -{
> - uint32_t seed = hars_petruska_f54_1_random_seed(0) ^ xor;
> - hars_petruska_f54_1_random_seed(seed);
> - hars_petruska_f54_1_random_seed(hars_petruska_f54_1_random_unsafe());
> -}
> +void hars_petruska_f54_1_random_perturb(uint32_t xor);
>
> -/* Returns: pseudo-random number in interval [0, ep_ro) */
> -static inline uint32_t hars_petruska_f54_1_random_unsafe_max(uint32_t ep_ro)
> -{
> - return ((uint64_t)hars_petruska_f54_1_random_unsafe() * ep_ro) >> 32;
> -}
> +uint32_t hars_petruska_f54_1_random_unsafe_max(uint32_t ep_ro);
>
> #endif /* IGT_RAND_H */
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH i-g-t 3/5] benchmarks/gem_exec_reloc: use hars_petruska_f54_1_random() from lib/rand
2026-06-18 14:09 [PATCH i-g-t 0/5] igt: cleanups to random functions Jani Nikula
2026-06-18 14:09 ` [PATCH i-g-t 1/5] lib/kms: simplify igt_random_crtc() Jani Nikula
2026-06-18 14:09 ` [PATCH i-g-t 2/5] lib/rand: move static inlines to proper functions Jani Nikula
@ 2026-06-18 14:09 ` Jani Nikula
2026-06-18 18:56 ` Sharma, Swati2
2026-06-18 14:09 ` [PATCH i-g-t 4/5] benchmarks/gem_exec_trace: " Jani Nikula
` (3 subsequent siblings)
6 siblings, 1 reply; 13+ messages in thread
From: Jani Nikula @ 2026-06-18 14:09 UTC (permalink / raw)
To: igt-dev; +Cc: jani.nikula
Remove the local duplicate of hars_petruska_f54_1_random() by switching
to use lib/rand.
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
benchmarks/gem_exec_reloc.c | 15 ++++-----------
1 file changed, 4 insertions(+), 11 deletions(-)
diff --git a/benchmarks/gem_exec_reloc.c b/benchmarks/gem_exec_reloc.c
index 0610308669f2..ff25a3b3b59a 100644
--- a/benchmarks/gem_exec_reloc.c
+++ b/benchmarks/gem_exec_reloc.c
@@ -41,6 +41,7 @@
#include "i915/gem_create.h"
#include "i915/gem_mman.h"
#include "igt_debugfs.h"
+#include "igt_rand.h"
#include "intel_reg.h"
#include "ioctl_wrappers.h"
@@ -52,15 +53,7 @@
#define REVERSE_OFFSET 0x40
#define RANDOM_OFFSET 0x80
-static uint32_t
-hars_petruska_f54_1_random (void)
-{
- static uint32_t state = 0x12345678;
-
-#define rol(x,k) ((x << k) | (x >> (32-k)))
- return state = (state ^ rol (state, 5) ^ rol (state, 24)) + 0x37798849;
-#undef rol
-}
+static uint32_t random_state = 0x12345678;
#define ELAPSED(a,b) (1e6*((b)->tv_sec - (a)->tv_sec) + ((b)->tv_usec - (a)->tv_usec))
static int run(unsigned batch_size,
@@ -106,7 +99,7 @@ static int run(unsigned batch_size,
mem_reloc[n].offset = batch_size - 8 - (8*n % (batch_size - 16));
else if (flags & RANDOM_OFFSET)
mem_reloc[n].offset = 8 +
- 8*hars_petruska_f54_1_random() % (batch_size - 16);
+ 8*hars_petruska_f54_1_random(&random_state) % (batch_size - 16);
else
mem_reloc[n].offset = 1024;
mem_reloc[n].read_domains = I915_GEM_DOMAIN_RENDER;
@@ -135,7 +128,7 @@ static int run(unsigned batch_size,
execbuf.flags |= I915_EXEC_NO_RELOC;
for (n = 0; n < num_relocs; n++) {
- target[n] = hars_petruska_f54_1_random() % num_objects;
+ target[n] = hars_petruska_f54_1_random(&random_state) % num_objects;
if (flags & LUT)
reloc[n].target_handle = target[n];
else
--
2.47.3
^ permalink raw reply related [flat|nested] 13+ messages in thread* Re: [PATCH i-g-t 3/5] benchmarks/gem_exec_reloc: use hars_petruska_f54_1_random() from lib/rand
2026-06-18 14:09 ` [PATCH i-g-t 3/5] benchmarks/gem_exec_reloc: use hars_petruska_f54_1_random() from lib/rand Jani Nikula
@ 2026-06-18 18:56 ` Sharma, Swati2
0 siblings, 0 replies; 13+ messages in thread
From: Sharma, Swati2 @ 2026-06-18 18:56 UTC (permalink / raw)
To: Jani Nikula, igt-dev
Hi Jani
On 18-06-2026 07:39 pm, Jani Nikula wrote:
> Remove the local duplicate of hars_petruska_f54_1_random() by switching
> to use lib/rand.
>
> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Patch LGTM
Reviewed-by: Swati Sharma <swati2.sharma@intel.com>
> ---
> benchmarks/gem_exec_reloc.c | 15 ++++-----------
> 1 file changed, 4 insertions(+), 11 deletions(-)
>
> diff --git a/benchmarks/gem_exec_reloc.c b/benchmarks/gem_exec_reloc.c
> index 0610308669f2..ff25a3b3b59a 100644
> --- a/benchmarks/gem_exec_reloc.c
> +++ b/benchmarks/gem_exec_reloc.c
> @@ -41,6 +41,7 @@
> #include "i915/gem_create.h"
> #include "i915/gem_mman.h"
> #include "igt_debugfs.h"
> +#include "igt_rand.h"
> #include "intel_reg.h"
> #include "ioctl_wrappers.h"
>
> @@ -52,15 +53,7 @@
> #define REVERSE_OFFSET 0x40
> #define RANDOM_OFFSET 0x80
>
> -static uint32_t
> -hars_petruska_f54_1_random (void)
> -{
> - static uint32_t state = 0x12345678;
> -
> -#define rol(x,k) ((x << k) | (x >> (32-k)))
> - return state = (state ^ rol (state, 5) ^ rol (state, 24)) + 0x37798849;
> -#undef rol
> -}
> +static uint32_t random_state = 0x12345678;
>
> #define ELAPSED(a,b) (1e6*((b)->tv_sec - (a)->tv_sec) + ((b)->tv_usec - (a)->tv_usec))
> static int run(unsigned batch_size,
> @@ -106,7 +99,7 @@ static int run(unsigned batch_size,
> mem_reloc[n].offset = batch_size - 8 - (8*n % (batch_size - 16));
> else if (flags & RANDOM_OFFSET)
> mem_reloc[n].offset = 8 +
> - 8*hars_petruska_f54_1_random() % (batch_size - 16);
> + 8*hars_petruska_f54_1_random(&random_state) % (batch_size - 16);
> else
> mem_reloc[n].offset = 1024;
> mem_reloc[n].read_domains = I915_GEM_DOMAIN_RENDER;
> @@ -135,7 +128,7 @@ static int run(unsigned batch_size,
> execbuf.flags |= I915_EXEC_NO_RELOC;
>
> for (n = 0; n < num_relocs; n++) {
> - target[n] = hars_petruska_f54_1_random() % num_objects;
> + target[n] = hars_petruska_f54_1_random(&random_state) % num_objects;
> if (flags & LUT)
> reloc[n].target_handle = target[n];
> else
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH i-g-t 4/5] benchmarks/gem_exec_trace: use hars_petruska_f54_1_random() from lib/rand
2026-06-18 14:09 [PATCH i-g-t 0/5] igt: cleanups to random functions Jani Nikula
` (2 preceding siblings ...)
2026-06-18 14:09 ` [PATCH i-g-t 3/5] benchmarks/gem_exec_reloc: use hars_petruska_f54_1_random() from lib/rand Jani Nikula
@ 2026-06-18 14:09 ` Jani Nikula
2026-06-18 18:56 ` Sharma, Swati2
2026-06-18 14:09 ` [PATCH i-g-t 5/5] tests/gem_exec_lut_handle: " Jani Nikula
` (2 subsequent siblings)
6 siblings, 1 reply; 13+ messages in thread
From: Jani Nikula @ 2026-06-18 14:09 UTC (permalink / raw)
To: igt-dev; +Cc: jani.nikula
Remove the local duplicate of hars_petruska_f54_1_random() by switching
to use lib/rand.
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
benchmarks/gem_exec_trace.c | 12 +++---------
1 file changed, 3 insertions(+), 9 deletions(-)
diff --git a/benchmarks/gem_exec_trace.c b/benchmarks/gem_exec_trace.c
index 4263ccb03dbd..c27639105903 100644
--- a/benchmarks/gem_exec_trace.c
+++ b/benchmarks/gem_exec_trace.c
@@ -42,6 +42,7 @@
#include "drm.h"
#include "drmtest.h"
#include "i915/gem_create.h"
+#include "igt_rand.h"
#include "igt_stats.h"
#include "intel_io.h"
#include "ioctl_wrappers.h"
@@ -92,14 +93,7 @@ struct trace_wait {
uint32_t handle;
} __attribute__((packed));
-static uint32_t hars_petruska_f54_1_random(void)
-{
- static uint32_t state = 0x12345678;
-
-#define rol(x,k) ((x << k) | (x >> (32-k)))
- return state = (state ^ rol (state, 5) ^ rol (state, 24)) + 0x37798849;
-#undef rol
-}
+static uint32_t random_state = 0x12345678;
static double elapsed(const struct timespec *start, const struct timespec *end)
{
@@ -277,7 +271,7 @@ static double replay(const char *filename, long nop, long range)
sizeof(*exec_objects)))->handle = bo[0];
if (nop > 0) {
- eb.batch_start_offset = hars_petruska_f54_1_random();
+ eb.batch_start_offset = hars_petruska_f54_1_random(&random_state);
eb.batch_start_offset =
((uint64_t)eb.batch_start_offset * range) >> 32;
eb.batch_start_offset = ALIGN(eb.batch_start_offset, 64);
--
2.47.3
^ permalink raw reply related [flat|nested] 13+ messages in thread* Re: [PATCH i-g-t 4/5] benchmarks/gem_exec_trace: use hars_petruska_f54_1_random() from lib/rand
2026-06-18 14:09 ` [PATCH i-g-t 4/5] benchmarks/gem_exec_trace: " Jani Nikula
@ 2026-06-18 18:56 ` Sharma, Swati2
0 siblings, 0 replies; 13+ messages in thread
From: Sharma, Swati2 @ 2026-06-18 18:56 UTC (permalink / raw)
To: Jani Nikula, igt-dev
Hi Jani
On 18-06-2026 07:39 pm, Jani Nikula wrote:
> Remove the local duplicate of hars_petruska_f54_1_random() by switching
> to use lib/rand.
>
> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Patch LGTM
Reviewed-by: Swati Sharma <swati2.sharma@intel.com>
> ---
> benchmarks/gem_exec_trace.c | 12 +++---------
> 1 file changed, 3 insertions(+), 9 deletions(-)
>
> diff --git a/benchmarks/gem_exec_trace.c b/benchmarks/gem_exec_trace.c
> index 4263ccb03dbd..c27639105903 100644
> --- a/benchmarks/gem_exec_trace.c
> +++ b/benchmarks/gem_exec_trace.c
> @@ -42,6 +42,7 @@
> #include "drm.h"
> #include "drmtest.h"
> #include "i915/gem_create.h"
> +#include "igt_rand.h"
> #include "igt_stats.h"
> #include "intel_io.h"
> #include "ioctl_wrappers.h"
> @@ -92,14 +93,7 @@ struct trace_wait {
> uint32_t handle;
> } __attribute__((packed));
>
> -static uint32_t hars_petruska_f54_1_random(void)
> -{
> - static uint32_t state = 0x12345678;
> -
> -#define rol(x,k) ((x << k) | (x >> (32-k)))
> - return state = (state ^ rol (state, 5) ^ rol (state, 24)) + 0x37798849;
> -#undef rol
> -}
> +static uint32_t random_state = 0x12345678;
>
> static double elapsed(const struct timespec *start, const struct timespec *end)
> {
> @@ -277,7 +271,7 @@ static double replay(const char *filename, long nop, long range)
> sizeof(*exec_objects)))->handle = bo[0];
>
> if (nop > 0) {
> - eb.batch_start_offset = hars_petruska_f54_1_random();
> + eb.batch_start_offset = hars_petruska_f54_1_random(&random_state);
> eb.batch_start_offset =
> ((uint64_t)eb.batch_start_offset * range) >> 32;
> eb.batch_start_offset = ALIGN(eb.batch_start_offset, 64);
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH i-g-t 5/5] tests/gem_exec_lut_handle: use hars_petruska_f54_1_random() from lib/rand
2026-06-18 14:09 [PATCH i-g-t 0/5] igt: cleanups to random functions Jani Nikula
` (3 preceding siblings ...)
2026-06-18 14:09 ` [PATCH i-g-t 4/5] benchmarks/gem_exec_trace: " Jani Nikula
@ 2026-06-18 14:09 ` Jani Nikula
2026-06-18 18:56 ` Sharma, Swati2
2026-06-18 17:49 ` ✓ Xe.CI.BAT: success for igt: cleanups to random functions Patchwork
2026-06-18 18:30 ` ✓ i915.CI.BAT: " Patchwork
6 siblings, 1 reply; 13+ messages in thread
From: Jani Nikula @ 2026-06-18 14:09 UTC (permalink / raw)
To: igt-dev; +Cc: jani.nikula
Remove the local duplicate of hars_petruska_f54_1_random() by switching
to use lib/rand.
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
tests/intel/gem_exec_lut_handle.c | 14 ++++----------
1 file changed, 4 insertions(+), 10 deletions(-)
diff --git a/tests/intel/gem_exec_lut_handle.c b/tests/intel/gem_exec_lut_handle.c
index fac7f2fbb45f..6ed304fc6d5e 100644
--- a/tests/intel/gem_exec_lut_handle.c
+++ b/tests/intel/gem_exec_lut_handle.c
@@ -40,6 +40,8 @@
#include "i915/gem.h"
#include "i915/gem_create.h"
#include "igt.h"
+#include "igt_rand.h"
+
/**
* TEST: gem exec lut handle
* Description: Exercises the basic execbuffer using the handle LUT interface.
@@ -65,15 +67,7 @@ int target[MAX_NUM_RELOC];
struct drm_i915_gem_exec_object2 gem_exec[MAX_NUM_EXEC+1];
struct drm_i915_gem_relocation_entry mem_reloc[MAX_NUM_RELOC];
-static uint32_t state = 0x12345678;
-
-static uint32_t
-hars_petruska_f54_1_random (void)
-{
-#define rol(x,k) ((x << k) | (x >> (32-k)))
- return state = (state ^ rol (state, 5) ^ rol (state, 24)) + 0x37798849;
-#undef rol
-}
+static uint32_t random_state = 0x12345678;
static int has_exec_lut(int fd)
{
@@ -164,7 +158,7 @@ int igt_simple_main()
execbuf.flags |= I915_EXEC_NO_RELOC;
for (j = 0; j < m; j++) {
- target[j] = hars_petruska_f54_1_random() % n;
+ target[j] = hars_petruska_f54_1_random(&random_state) % n;
reloc[j].target_handle = target[j];
reloc[j].presumed_offset = -1;
}
--
2.47.3
^ permalink raw reply related [flat|nested] 13+ messages in thread* Re: [PATCH i-g-t 5/5] tests/gem_exec_lut_handle: use hars_petruska_f54_1_random() from lib/rand
2026-06-18 14:09 ` [PATCH i-g-t 5/5] tests/gem_exec_lut_handle: " Jani Nikula
@ 2026-06-18 18:56 ` Sharma, Swati2
0 siblings, 0 replies; 13+ messages in thread
From: Sharma, Swati2 @ 2026-06-18 18:56 UTC (permalink / raw)
To: Jani Nikula, igt-dev
Hi Jani
On 18-06-2026 07:39 pm, Jani Nikula wrote:
> Remove the local duplicate of hars_petruska_f54_1_random() by switching
> to use lib/rand.
>
> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Patch LGTM
Reviewed-by: Swati Sharma <swati2.sharma@intel.com>
> ---
> tests/intel/gem_exec_lut_handle.c | 14 ++++----------
> 1 file changed, 4 insertions(+), 10 deletions(-)
>
> diff --git a/tests/intel/gem_exec_lut_handle.c b/tests/intel/gem_exec_lut_handle.c
> index fac7f2fbb45f..6ed304fc6d5e 100644
> --- a/tests/intel/gem_exec_lut_handle.c
> +++ b/tests/intel/gem_exec_lut_handle.c
> @@ -40,6 +40,8 @@
> #include "i915/gem.h"
> #include "i915/gem_create.h"
> #include "igt.h"
> +#include "igt_rand.h"
> +
> /**
> * TEST: gem exec lut handle
> * Description: Exercises the basic execbuffer using the handle LUT interface.
> @@ -65,15 +67,7 @@ int target[MAX_NUM_RELOC];
> struct drm_i915_gem_exec_object2 gem_exec[MAX_NUM_EXEC+1];
> struct drm_i915_gem_relocation_entry mem_reloc[MAX_NUM_RELOC];
>
> -static uint32_t state = 0x12345678;
> -
> -static uint32_t
> -hars_petruska_f54_1_random (void)
> -{
> -#define rol(x,k) ((x << k) | (x >> (32-k)))
> - return state = (state ^ rol (state, 5) ^ rol (state, 24)) + 0x37798849;
> -#undef rol
> -}
> +static uint32_t random_state = 0x12345678;
>
> static int has_exec_lut(int fd)
> {
> @@ -164,7 +158,7 @@ int igt_simple_main()
> execbuf.flags |= I915_EXEC_NO_RELOC;
>
> for (j = 0; j < m; j++) {
> - target[j] = hars_petruska_f54_1_random() % n;
> + target[j] = hars_petruska_f54_1_random(&random_state) % n;
> reloc[j].target_handle = target[j];
> reloc[j].presumed_offset = -1;
> }
^ permalink raw reply [flat|nested] 13+ messages in thread
* ✓ Xe.CI.BAT: success for igt: cleanups to random functions
2026-06-18 14:09 [PATCH i-g-t 0/5] igt: cleanups to random functions Jani Nikula
` (4 preceding siblings ...)
2026-06-18 14:09 ` [PATCH i-g-t 5/5] tests/gem_exec_lut_handle: " Jani Nikula
@ 2026-06-18 17:49 ` Patchwork
2026-06-18 18:30 ` ✓ i915.CI.BAT: " Patchwork
6 siblings, 0 replies; 13+ messages in thread
From: Patchwork @ 2026-06-18 17:49 UTC (permalink / raw)
To: Jani Nikula; +Cc: igt-dev
[-- Attachment #1: Type: text/plain, Size: 2148 bytes --]
== Series Details ==
Series: igt: cleanups to random functions
URL : https://patchwork.freedesktop.org/series/168797/
State : success
== Summary ==
CI Bug Log - changes from XEIGT_8973_BAT -> XEIGTPW_15400_BAT
====================================================
Summary
-------
**SUCCESS**
No regressions found.
Participating hosts (13 -> 13)
------------------------------
No changes in participating hosts
Known issues
------------
Here are the changes found in XEIGTPW_15400_BAT that come from known issues:
### IGT changes ###
#### Possible fixes ####
* igt@xe_live_ktest@xe_dma_buf:
- bat-bmg-vm: [ABORT][1] ([Intel XE#8007] / [Intel XE#8023]) -> [PASS][2] +1 other test pass
[1]: https://intel-gfx-ci.01.org/tree/intel-xe/IGT_8973/bat-bmg-vm/igt@xe_live_ktest@xe_dma_buf.html
[2]: https://intel-gfx-ci.01.org/tree/intel-xe/IGTPW_15400/bat-bmg-vm/igt@xe_live_ktest@xe_dma_buf.html
#### Warnings ####
* igt@xe_exec_multi_queue@priority:
- bat-adlp-7: [SKIP][3] ([Intel XE#8377]) -> [SKIP][4] ([Intel XE#8364] / [Intel XE#8377]) +13 other tests skip
[3]: https://intel-gfx-ci.01.org/tree/intel-xe/IGT_8973/bat-adlp-7/igt@xe_exec_multi_queue@priority.html
[4]: https://intel-gfx-ci.01.org/tree/intel-xe/IGTPW_15400/bat-adlp-7/igt@xe_exec_multi_queue@priority.html
[Intel XE#8007]: https://gitlab.freedesktop.org/drm/xe/kernel/issues/8007
[Intel XE#8023]: https://gitlab.freedesktop.org/drm/xe/kernel/issues/8023
[Intel XE#8364]: https://gitlab.freedesktop.org/drm/xe/kernel/issues/8364
[Intel XE#8377]: https://gitlab.freedesktop.org/drm/xe/kernel/issues/8377
Build changes
-------------
* IGT: IGT_8973 -> IGTPW_15400
* Linux: xe-5277-8530e8b67c8dba3eb5b4c025c060a5b3b78262c6 -> xe-5280-24209d838338d162bb25aadfd637b11747a357ca
IGTPW_15400: 15400
IGT_8973: 8973
xe-5277-8530e8b67c8dba3eb5b4c025c060a5b3b78262c6: 8530e8b67c8dba3eb5b4c025c060a5b3b78262c6
xe-5280-24209d838338d162bb25aadfd637b11747a357ca: 24209d838338d162bb25aadfd637b11747a357ca
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/intel-xe/IGTPW_15400/index.html
[-- Attachment #2: Type: text/html, Size: 2801 bytes --]
^ permalink raw reply [flat|nested] 13+ messages in thread* ✓ i915.CI.BAT: success for igt: cleanups to random functions
2026-06-18 14:09 [PATCH i-g-t 0/5] igt: cleanups to random functions Jani Nikula
` (5 preceding siblings ...)
2026-06-18 17:49 ` ✓ Xe.CI.BAT: success for igt: cleanups to random functions Patchwork
@ 2026-06-18 18:30 ` Patchwork
6 siblings, 0 replies; 13+ messages in thread
From: Patchwork @ 2026-06-18 18:30 UTC (permalink / raw)
To: Jani Nikula; +Cc: igt-dev
[-- Attachment #1: Type: text/plain, Size: 7080 bytes --]
== Series Details ==
Series: igt: cleanups to random functions
URL : https://patchwork.freedesktop.org/series/168797/
State : success
== Summary ==
CI Bug Log - changes from IGT_8973 -> IGTPW_15400
====================================================
Summary
-------
**SUCCESS**
No regressions found.
External URL: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_15400/index.html
Participating hosts (41 -> 40)
------------------------------
Additional (1): bat-dg2-14
Missing (2): bat-dg2-13 fi-snb-2520m
Known issues
------------
Here are the changes found in IGTPW_15400 that come from known issues:
### IGT changes ###
#### Issues hit ####
* igt@dmabuf@all-tests:
- bat-dg2-14: NOTRUN -> [SKIP][1] ([i915#15931])
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_15400/bat-dg2-14/igt@dmabuf@all-tests.html
* igt@gem_mmap@basic:
- bat-dg2-14: NOTRUN -> [SKIP][2] ([i915#4083])
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_15400/bat-dg2-14/igt@gem_mmap@basic.html
* igt@gem_render_tiled_blits@basic:
- bat-dg2-14: NOTRUN -> [SKIP][3] ([i915#4079])
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_15400/bat-dg2-14/igt@gem_render_tiled_blits@basic.html
* igt@gem_tiled_fence_blits@basic:
- bat-dg2-14: NOTRUN -> [SKIP][4] ([i915#4077]) +2 other tests skip
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_15400/bat-dg2-14/igt@gem_tiled_fence_blits@basic.html
* igt@gem_tiled_pread_basic@basic:
- bat-dg2-14: NOTRUN -> [SKIP][5] ([i915#15657])
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_15400/bat-dg2-14/igt@gem_tiled_pread_basic@basic.html
* igt@i915_pm_rpm@module-reload:
- bat-adlp-6: [PASS][6] -> [DMESG-WARN][7] ([i915#15673]) +78 other tests dmesg-warn
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_8973/bat-adlp-6/igt@i915_pm_rpm@module-reload.html
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_15400/bat-adlp-6/igt@i915_pm_rpm@module-reload.html
* igt@i915_pm_rps@basic-api:
- bat-dg2-14: NOTRUN -> [SKIP][8] ([i915#11681] / [i915#6621])
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_15400/bat-dg2-14/igt@i915_pm_rps@basic-api.html
* igt@kms_addfb_basic@addfb25-y-tiled-small-legacy:
- bat-dg2-14: NOTRUN -> [SKIP][9] ([i915#5190])
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_15400/bat-dg2-14/igt@kms_addfb_basic@addfb25-y-tiled-small-legacy.html
* igt@kms_addfb_basic@basic-y-tiled-legacy:
- bat-dg2-14: NOTRUN -> [SKIP][10] ([i915#4215] / [i915#5190])
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_15400/bat-dg2-14/igt@kms_addfb_basic@basic-y-tiled-legacy.html
* igt@kms_addfb_basic@tile-pitch-mismatch:
- bat-dg2-14: NOTRUN -> [SKIP][11] ([i915#4212]) +7 other tests skip
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_15400/bat-dg2-14/igt@kms_addfb_basic@tile-pitch-mismatch.html
* igt@kms_cursor_legacy@basic-busy-flip-before-cursor-legacy:
- bat-dg2-14: NOTRUN -> [SKIP][12] ([i915#4103]) +1 other test skip
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_15400/bat-dg2-14/igt@kms_cursor_legacy@basic-busy-flip-before-cursor-legacy.html
* igt@kms_dsc@dsc-basic:
- bat-dg2-14: NOTRUN -> [SKIP][13] ([i915#16361])
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_15400/bat-dg2-14/igt@kms_dsc@dsc-basic.html
* igt@kms_force_connector_basic@force-load-detect:
- bat-dg2-14: NOTRUN -> [SKIP][14]
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_15400/bat-dg2-14/igt@kms_force_connector_basic@force-load-detect.html
* igt@kms_pm_backlight@basic-brightness:
- bat-dg2-14: NOTRUN -> [SKIP][15] ([i915#12343] / [i915#5354])
[15]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_15400/bat-dg2-14/igt@kms_pm_backlight@basic-brightness.html
* igt@kms_psr@psr-sprite-plane-onoff:
- bat-dg2-14: NOTRUN -> [SKIP][16] ([i915#1072] / [i915#9732]) +3 other tests skip
[16]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_15400/bat-dg2-14/igt@kms_psr@psr-sprite-plane-onoff.html
* igt@kms_setmode@basic-clone-single-crtc:
- bat-dg2-14: NOTRUN -> [SKIP][17] ([i915#3555])
[17]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_15400/bat-dg2-14/igt@kms_setmode@basic-clone-single-crtc.html
* igt@prime_vgem@basic-fence-flip:
- bat-dg2-14: NOTRUN -> [SKIP][18] ([i915#3708])
[18]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_15400/bat-dg2-14/igt@prime_vgem@basic-fence-flip.html
* igt@prime_vgem@basic-gtt:
- bat-dg2-14: NOTRUN -> [SKIP][19] ([i915#3708] / [i915#4077]) +1 other test skip
[19]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_15400/bat-dg2-14/igt@prime_vgem@basic-gtt.html
* igt@prime_vgem@basic-write:
- bat-dg2-14: NOTRUN -> [SKIP][20] ([i915#3291] / [i915#3708]) +2 other tests skip
[20]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_15400/bat-dg2-14/igt@prime_vgem@basic-write.html
[i915#1072]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/1072
[i915#11681]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/11681
[i915#12343]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/12343
[i915#15657]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/15657
[i915#15673]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/15673
[i915#15931]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/15931
[i915#16361]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/16361
[i915#3291]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/3291
[i915#3555]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/3555
[i915#3708]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/3708
[i915#4077]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/4077
[i915#4079]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/4079
[i915#4083]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/4083
[i915#4103]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/4103
[i915#4212]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/4212
[i915#4215]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/4215
[i915#5190]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/5190
[i915#5354]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/5354
[i915#6621]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/6621
[i915#9732]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/9732
Build changes
-------------
* CI: CI-20190529 -> None
* IGT: IGT_8973 -> IGTPW_15400
* Linux: CI_DRM_18699 -> CI_DRM_18702
CI-20190529: 20190529
CI_DRM_18699: 8530e8b67c8dba3eb5b4c025c060a5b3b78262c6 @ git://anongit.freedesktop.org/gfx-ci/linux
CI_DRM_18702: 24209d838338d162bb25aadfd637b11747a357ca @ git://anongit.freedesktop.org/gfx-ci/linux
IGTPW_15400: 15400
IGT_8973: 8973
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_15400/index.html
[-- Attachment #2: Type: text/html, Size: 8461 bytes --]
^ permalink raw reply [flat|nested] 13+ messages in thread