Skip to content

Commit c46c320

Browse files
committed
drm/i915/selftests: Use igt_random_offset()
Switch igt_vm_isolation() to using igt_random_offset(). Signed-off-by: Chris Wilson <[email protected]> Cc: Matthew Auld <[email protected]> Cc: Akeem G Abodunrin <[email protected]> Reviewed-by: Matthew Auld <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent 7dc8f11 commit c46c320

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

drivers/gpu/drm/i915/gem/selftests/i915_gem_context.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1809,7 +1809,6 @@ static int igt_vm_isolation(void *arg)
18091809

18101810
vm_total = ctx_vm(ctx_a)->total;
18111811
GEM_BUG_ON(ctx_vm(ctx_b)->total != vm_total);
1812-
vm_total -= I915_GTT_PAGE_SIZE;
18131812

18141813
count = 0;
18151814
num_engines = 0;
@@ -1828,10 +1827,10 @@ static int igt_vm_isolation(void *arg)
18281827
u32 value = 0xc5c5c5c5;
18291828
u64 offset;
18301829

1831-
div64_u64_rem(i915_prandom_u64_state(&prng),
1832-
vm_total, &offset);
1833-
offset = round_down(offset, alignof_dword);
1834-
offset += I915_GTT_PAGE_SIZE;
1830+
/* Leave enough space at offset 0 for the batch */
1831+
offset = igt_random_offset(&prng,
1832+
I915_GTT_PAGE_SIZE, vm_total,
1833+
sizeof(u32), alignof_dword);
18351834

18361835
err = write_to_scratch(ctx_a, engine,
18371836
offset, 0xdeadbeef);

0 commit comments

Comments
 (0)