diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2017-03-24 18:11:08 +0000 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2017-03-24 18:12:23 +0000 |
commit | 58de785468782f29e6eb1d32d47b55b3d234dfcf (patch) | |
tree | ea862ef365385096817e1ae7b636fab440d03e4f /tests/gem_exec_whisper.c | |
parent | 137360f75a42042198cf00d35a54cc68660d8c90 (diff) |
Improve utilisation of igt_debugfs_dir()
As we can export igt_debugfs_dir() to cache the path to our debugfs
directory, encourage a few more users to take advantage.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'tests/gem_exec_whisper.c')
-rw-r--r-- | tests/gem_exec_whisper.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/tests/gem_exec_whisper.c b/tests/gem_exec_whisper.c index 53988103..dab3a247 100644 --- a/tests/gem_exec_whisper.c +++ b/tests/gem_exec_whisper.c @@ -29,6 +29,7 @@ #include "igt.h" #include "igt_gt.h" +#include "igt_debugfs.h" #include "igt_sysfs.h" #define LOCAL_I915_EXEC_NO_RELOC (1<<11) @@ -41,16 +42,11 @@ #define VERIFY 0 -static void write_seqno(int fd, unsigned offset) +static void write_seqno(int dir, unsigned offset) { uint32_t seqno = UINT32_MAX - offset; - FILE *file; - file = igt_debugfs_fopen(fd, "i915_next_seqno", "w"); - igt_assert(file); - - igt_assert(fprintf(file, "0x%x", seqno) > 0); - fclose(file); + igt_sysfs_printf(dir, "i915_next_seqno", "0x%x", seqno); igt_debug("next seqno set to: 0x%x\n", seqno); } @@ -217,6 +213,9 @@ static void whisper(int fd, unsigned engine, unsigned flags) unsigned int reloc_interruptions = 0; unsigned int eb_migrations = 0; uint64_t old_offset; + int debugfs; + + debugfs = igt_debugfs_dir(fd); nengine = 0; if (engine == -1) { @@ -341,7 +340,7 @@ static void whisper(int fd, unsigned engine, unsigned flags) uint64_t offset; if (!(flags & FORKED)) - write_seqno(fd, pass); + write_seqno(debugfs, pass); if (flags & HANG) submit_hang(&hang, engines, nengine); @@ -489,6 +488,8 @@ static void whisper(int fd, unsigned engine, unsigned flags) fini_hang(&hang); else igt_assert_eq(intel_detect_and_clear_missed_interrupts(fd), 0); + + close(debugfs); } static void print_welcome(int fd) |