summaryrefslogtreecommitdiff
path: root/tools/intel_guc_logger.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2017-03-21 17:16:03 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2017-03-21 17:36:02 +0000
commit83884e97e18739e3588c6467a210838099d42073 (patch)
tree778bab4b309c852d3649cc901952267d0cbb5992 /tools/intel_guc_logger.c
parent25fbae15262cf570e207e62f50e7c5233e06bc67 (diff)
Restore "lib: Open debugfs files for the given DRM device"
This reverts commit 25fbae15262cf570e207e62f50e7c5233e06bc67, restoring commit 301ad44cdf1b868b1ab89096721da91fa8541fdc Author: Tomeu Vizoso <tomeu.vizoso@collabora.com> Date: Thu Mar 2 10:37:11 2017 +0100 lib: Open debugfs files for the given DRM device with fixes. Signed-off-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();
}