From 52bc6baebec178cf1447090000befd6263fa39b3 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Wed, 3 Jan 2018 17:57:28 +0000 Subject: igt/kms_flip: Do igt_require_gem() just once Since igt_spin_batch_new() will do a stalling GEM check, it is not advisable to use it within loops. Perform the igt_require_gem() upfront and then use __igt_spin_batch_new() inside the test loop. Signed-off-by: Chris Wilson Reviewed-by: Arkadiusz Hiler --- tests/kms_flip.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'tests/kms_flip.c') diff --git a/tests/kms_flip.c b/tests/kms_flip.c index 39ee68d2..2899f20e 100644 --- a/tests/kms_flip.c +++ b/tests/kms_flip.c @@ -692,15 +692,15 @@ static unsigned int run_test_step(struct test_output *o) o->current_fb_id = !o->current_fb_id; if (o->flags & TEST_WITH_DUMMY_BCS) { - spin_bcs = igt_spin_batch_new(drm_fd, 0, I915_EXEC_BLT, - o->fb_info[o->current_fb_id].gem_handle); + spin_bcs = __igt_spin_batch_new(drm_fd, 0, I915_EXEC_BLT, + o->fb_info[o->current_fb_id].gem_handle); igt_spin_batch_set_timeout(spin_bcs, NSEC_PER_SEC); } if (o->flags & TEST_WITH_DUMMY_RCS) { - spin_rcs = igt_spin_batch_new(drm_fd, 0, I915_EXEC_RENDER, - o->fb_info[o->current_fb_id].gem_handle); + spin_rcs = __igt_spin_batch_new(drm_fd, 0, I915_EXEC_RENDER, + o->fb_info[o->current_fb_id].gem_handle); igt_spin_batch_set_timeout(spin_rcs, NSEC_PER_SEC); } @@ -1099,6 +1099,9 @@ static unsigned event_loop(struct test_output *o, unsigned duration_ms) igt_hang_t hang; int count = 0; + if (o->flags & (TEST_WITH_DUMMY_BCS | TEST_WITH_DUMMY_RCS)) + igt_require_gem(drm_fd); + memset(&hang, 0, sizeof(hang)); if (o->flags & TEST_HANG_ONCE) hang = hang_gpu(drm_fd); -- cgit v1.2.3