summaryrefslogtreecommitdiff
path: root/tools/intel_gpu_top.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_gpu_top.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_gpu_top.c')
-rw-r--r--tools/intel_gpu_top.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/tools/intel_gpu_top.c b/tools/intel_gpu_top.c
index 4f327c6d..78488764 100644
--- a/tools/intel_gpu_top.c
+++ b/tools/intel_gpu_top.c
@@ -46,6 +46,7 @@
#include "instdone.h"
#include "intel_reg.h"
#include "intel_chipset.h"
+#include "drmtest.h"
#define FORCEWAKE 0xA18C
#define FORCEWAKE_ACK 0x130090
@@ -410,6 +411,7 @@ usage(const char *appname)
int main(int argc, char **argv)
{
uint32_t devid;
+ int drm_fd;
struct pci_device *pci_dev;
struct ring render_ring = {
.name = "render",
@@ -510,8 +512,11 @@ int main(int argc, char **argv)
top_bits_sorted[i] = &top_bits[i];
}
+ /* Just to make sure we open the right debugfs files */
+ drm_fd = drm_open_driver_master(DRIVER_INTEL);
+
/* Grab access to the registers */
- intel_register_access_init(pci_dev, 0);
+ intel_register_access_init(pci_dev, 0, drm_fd);
ring_init(&render_ring);
if (IS_GEN4(devid) || IS_GEN5(devid))
@@ -714,5 +719,6 @@ int main(int argc, char **argv)
fclose(output);
intel_register_access_fini();
+ close(drm_fd);
return 0;
}