From 8ae86621d6fff60b6e20c6b0f9b336785c935b0f Mon Sep 17 00:00:00 2001 From: Michał Winiarski Date: Tue, 12 Mar 2019 13:48:13 +0100 Subject: lib/igt_device: Move intel_get_pci_device under igt_device MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It allows us to make things a little bit more generic. Also, we now require fd rather than doing guesswork when it comes to pci address. v2: Use readlinkat rather than string concat, move stuff around, provide a version that does not assert. (Chris) v3: Print addr on failure, avoid assignment in conditionals. (Chris) Signed-off-by: Michał Winiarski Cc: Chris Wilson Reviewed-by: Chris Wilson --- tools/intel_gpu_time.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'tools/intel_gpu_time.c') diff --git a/tools/intel_gpu_time.c b/tools/intel_gpu_time.c index 56d65fe0..0fc73f92 100644 --- a/tools/intel_gpu_time.c +++ b/tools/intel_gpu_time.c @@ -34,8 +34,9 @@ #include #include +#include "drmtest.h" +#include "igt_device.h" #include "intel_io.h" -#include "intel_chipset.h" #include "intel_reg.h" #define SAMPLES_PER_SEC 10000 @@ -66,8 +67,11 @@ int main(int argc, char **argv) struct timeval start, end; static struct rusage rusage; int status; + int fd; - intel_mmio_use_pci_bar(intel_get_pci_device()); + fd = drm_open_driver(DRIVER_INTEL); + intel_mmio_use_pci_bar(igt_device_get_pci_device(fd)); + close(fd); if (argc == 1) { fprintf(stderr, "usage: %s cmd [args...]\n", argv[0]); -- cgit v1.2.3