[igt-dev] [PATCH i-g-t v3 47/52] tests/kms_flip: Adopt to use allocator
Zbigniew Kempczyński
zbigniew.kempczynski at intel.com
Mon Jul 26 20:00:21 UTC 2021
From: Bhanuprakash Modem <bhanuprakash.modem at intel.com>
For newer gens kernel will reject relocations returning -EINVAL
so we should just provide the allocator handle to inject the hang.
Signed-off-by: Bhanuprakash Modem <bhanuprakash.modem at intel.com>
Cc: Zbigniew Kempczyński <zbigniew.kempczynski at intel.com>
Cc: Petri Latvala <petri.latvala at intel.com>
Cc: Ashutosh Dixit <ashutosh.dixit at intel.com>
---
tests/kms_flip.c | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/tests/kms_flip.c b/tests/kms_flip.c
index 09762ae8e..d63b5f16a 100755
--- a/tests/kms_flip.c
+++ b/tests/kms_flip.c
@@ -614,9 +614,9 @@ static void recreate_fb(struct test_output *o)
o->fb_info[o->current_fb_id].fb_id = new_fb_id;
}
-static igt_hang_t hang_gpu(int fd)
+static igt_hang_t hang_gpu(int fd, uint64_t ahnd)
{
- return igt_hang_ring(fd, I915_EXEC_DEFAULT);
+ return igt_hang_ring_with_ahnd(fd, I915_EXEC_DEFAULT, ahnd);
}
static void unhang_gpu(int fd, igt_hang_t hang)
@@ -673,6 +673,7 @@ static bool run_test_step(struct test_output *o, unsigned int *events)
struct vblank_reply vbl_reply;
unsigned int target_seq;
igt_hang_t hang;
+ uint64_t ahnd = 0;
target_seq = o->vblank_state.seq_step;
/* Absolute waits only works once we have a frame counter. */
@@ -774,8 +775,11 @@ static bool run_test_step(struct test_output *o, unsigned int *events)
igt_print_activity();
memset(&hang, 0, sizeof(hang));
- if (do_flip && (o->flags & TEST_HANG))
- hang = hang_gpu(drm_fd);
+ if (do_flip && (o->flags & TEST_HANG)) {
+ if (is_i915_device(drm_fd))
+ ahnd = get_reloc_ahnd(drm_fd, 0);
+ hang = hang_gpu(drm_fd, ahnd);
+ }
/* try to make sure we can issue two flips during the same frame */
if (do_flip && (o->flags & TEST_EBUSY)) {
@@ -845,6 +849,8 @@ static bool run_test_step(struct test_output *o, unsigned int *events)
igt_assert(do_page_flip(o, new_fb_id, false) == expected_einval);
unhang_gpu(drm_fd, hang);
+ if (is_i915_device(drm_fd))
+ put_ahnd(ahnd);
*events = completed_events;
--
2.26.0
More information about the igt-dev
mailing list