summaryrefslogtreecommitdiff
path: root/tools/intel_guc_logger.c
diff options
context:
space:
mode:
authorTomeu Vizoso <tomeu.vizoso@collabora.com>2017-03-02 10:37:11 +0100
committerTomeu Vizoso <tomeu.vizoso@collabora.com>2017-03-21 15:50:54 +0100
commit301ad44cdf1b868b1ab89096721da91fa8541fdc (patch)
treeef18781db6cadae7f8f49f1fc449dc56b33448ec /tools/intel_guc_logger.c
parente7a0d06730f77842998368660fb45fe5c1738fda (diff)
lib: Open debugfs files for the given DRM device
When opening a DRM debugfs file, locate the right path based on the given DRM device FD. This is needed so, in setups with more than one DRM device, any operations on debugfs files affect the expected DRM device. v2: - rebased and fixed new API additions v3: - updated chamelium test, which was missed previously - use the minor of the device for the debugfs path, not the major - have a proper exit handler for calling igt_hpd_storm_reset with the right device fd. Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com> Reviewed-by: Robert Foss <robert.foss@collabora.com> Acked-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'tools/intel_guc_logger.c')
-rw-r--r--tools/intel_guc_logger.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/tools/intel_guc_logger.c b/tools/intel_guc_logger.c
index c9ea60d0..3079878e 100644
--- a/tools/intel_guc_logger.c
+++ b/tools/intel_guc_logger.c
@@ -47,7 +47,7 @@ int verbosity_level = 3; /* by default capture logs at max verbosity */
uint32_t produced, consumed;
uint64_t total_bytes_written;
int num_buffers = NUM_SUBBUFS;
-int relay_fd, outfile_fd = -1;
+int relay_fd, drm_fd, outfile_fd = -1;
uint32_t test_duration, max_filesize;
pthread_cond_t underflow_cond, overflow_cond;
bool stop_logging, discard_oldlogs, capturing_stopped;
@@ -59,7 +59,7 @@ static void guc_log_control(bool enable_logging)
uint64_t val;
int ret;
- control_fd = igt_debugfs_open(CONTROL_FILE_NAME, O_WRONLY);
+ control_fd = igt_debugfs_open(drm_fd, CONTROL_FILE_NAME, O_WRONLY);
igt_assert_f(control_fd >= 0, "couldn't open the guc log control file\n");
val = enable_logging ? ((verbosity_level << 4) | 0x1) : 0;
@@ -228,7 +228,7 @@ static void init_flusher_thread(void)
static void open_relay_file(void)
{
- relay_fd = igt_debugfs_open(RELAY_FILE_NAME, O_RDONLY);
+ relay_fd = igt_debugfs_open(drm_fd, RELAY_FILE_NAME, O_RDONLY);
igt_assert_f(relay_fd >= 0, "couldn't open the guc log file\n");
/* Purge the old/boot-time logs from the relay buffer.
@@ -374,6 +374,9 @@ int main(int argc, char **argv)
process_command_line(argc, argv);
+ /* Just to make sure we open the right debugfs files */
+ drm_fd = drm_open_driver_master(DRIVER_INTEL);
+
init_main_thread();
/* Use a separate thread for flushing the logs to a file on disk.
@@ -434,5 +437,6 @@ int main(int argc, char **argv)
free(read_buffer);
close(relay_fd);
close(outfile_fd);
+ close(drm_fd);
igt_exit();
}