mirror of
https://github.com/tiagovignatti/intel-gpu-tools.git
synced 2026-08-21 21:32:56 +00:00
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>
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user