[PATCH igt] igt/kms_flip: Do igt_require_gem() just once

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxxxxxx>
---
 tests/kms_flip.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/tests/kms_flip.c b/tests/kms_flip.c
index fb4fe6514..1d73d3a6d 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);
 	}
@@ -1112,6 +1112,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);
-- 
2.15.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux