diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2018-01-03 17:57:28 +0000 |
---|---|---|
committer | Arkadiusz Hiler <arkadiusz.hiler@intel.com> | 2018-01-04 13:36:34 +0200 |
commit | 52bc6baebec178cf1447090000befd6263fa39b3 (patch) | |
tree | 942898633ba39504a313b35bb67d85b2d330e92c | |
parent | 58bd37d347d1369ecd272ff778057ee8004d6b15 (diff) |
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 <chris@chris-wilson.co.uk>
Reviewed-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
-rw-r--r-- | tests/kms_flip.c | 11 |
1 files changed, 7 insertions, 4 deletions
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); |