summaryrefslogtreecommitdiff
path: root/tests/gem_ring_sync_loop.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2016-01-22 17:33:40 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2016-01-22 17:45:06 +0000
commit5b675f7b2f6487548a91c01eb9a7e36e808617b4 (patch)
tree8812e54f7fc5467635b7e9aaf1ccc503d3c87014 /tests/gem_ring_sync_loop.c
parente0ee36141ed1747f68580559a7cbfbeba902f05c (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_ring_sync_loop.c')
-rw-r--r--tests/gem_ring_sync_loop.c27
1 files changed, 2 insertions, 25 deletions
diff --git a/tests/gem_ring_sync_loop.c b/tests/gem_ring_sync_loop.c
index 721cce9e..ca9f5687 100644
--- a/tests/gem_ring_sync_loop.c
+++ b/tests/gem_ring_sync_loop.c
@@ -91,39 +91,16 @@ sync_loop(int fd)
gem_close(fd, object[0].handle);
}
-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;
-}
-
igt_simple_main
{
int fd;
fd = drm_open_driver(DRIVER_INTEL);
igt_require(gem_get_num_rings(fd) > 1);
- intel_detect_and_clear_missed_irq(fd); /* clear before we begin */
+ intel_detect_and_clear_missed_interrupts(fd);
sync_loop(fd);
- igt_assert_eq(intel_detect_and_clear_missed_irq(fd), 0);
+ igt_assert_eq(intel_detect_and_clear_missed_interrupts(fd), 0);
close(fd);
}