diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2016-01-22 17:33:40 +0000 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2016-01-22 17:45:06 +0000 |
commit | 5b675f7b2f6487548a91c01eb9a7e36e808617b4 (patch) | |
tree | 8812e54f7fc5467635b7e9aaf1ccc503d3c87014 /tests/gem_sync.c | |
parent | e0ee36141ed1747f68580559a7cbfbeba902f05c (diff) |
lib: Refactor common detection of missed interrupts
As we have the same function in a few places to read the
debugfs/i915_ring_missed_irq file, move it to the core.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'tests/gem_sync.c')
-rw-r--r-- | tests/gem_sync.c | 27 |
1 files changed, 2 insertions, 25 deletions
diff --git a/tests/gem_sync.c b/tests/gem_sync.c index 7c3b7ee5..8b7490d7 100644 --- a/tests/gem_sync.c +++ b/tests/gem_sync.c @@ -33,29 +33,6 @@ IGT_TEST_DESCRIPTION("Basic check of ring<->ring write synchronisation."); * Extremely efficient at catching missed irqs */ -static unsigned intel_detect_and_clear_missed_irq(int fd) -{ - unsigned missed = 0; - FILE *file; - - gem_quiescent_gpu(fd); - - file = igt_debugfs_fopen("i915_ring_missed_irq", "r"); - if (file) { - igt_assert(fscanf(file, "%x", &missed) == 1); - fclose(file); - } - if (missed) { - file = igt_debugfs_fopen("i915_ring_missed_irq", "w"); - if (file) { - fwrite("0\n", 1, 2, file); - fclose(file); - } - } - - return missed; -} - static double gettime(void) { static clockid_t clock = -1; @@ -105,7 +82,7 @@ sync_ring(int fd, int ring, unsigned flags) double start, elapsed; unsigned long cycles; - intel_detect_and_clear_missed_irq(fd); /* clear before we begin */ + intel_detect_and_clear_missed_interrupts(fd); memset(&object, 0, sizeof(object)); object.handle = gem_create(fd, 4096); @@ -130,7 +107,7 @@ sync_ring(int fd, int ring, unsigned flags) igt_info("Completed %ld cycles: %.3f us\n", cycles, elapsed*1e6/cycles); gem_close(fd, object.handle); - igt_assert_eq(intel_detect_and_clear_missed_irq(fd), 0); + igt_assert_eq(intel_detect_and_clear_missed_interrupts(fd), 0); } igt_main |