From 1021abab07ebb29957dec5fa0cc8e90a53efd290 Mon Sep 17 00:00:00 2001 From: Caio Marcelo de Oliveira Filho Date: Mon, 12 Aug 2019 12:55:37 -0700 Subject: [PATCH] intel/tools: Fix aub_file initialization in intel_dump_gpu The `device` can be set earlier either by a command line or a by intercepting an ioctl call to get the I915_PARAM_CHIPSET_ID done by the application early. In both cases `aub_file` and `devinfo` would not be initialized. Fix by splitting the conditions - `device == 0`: use the FD to get both device and devinfo. - Or `devinfo.gen == 0`: use `device` to initialize it. And separatedly, initialize aub_file the first time it is needed. Fixes: d594d2a0524 ("intel/tools: use device info initializer") Acked-by: Jason Ekstrand Reviewed-by: Kenneth Graunke --- src/intel/tools/intel_dump_gpu.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/intel/tools/intel_dump_gpu.c b/src/intel/tools/intel_dump_gpu.c index f9a5668be53..f604c6c62f0 100644 --- a/src/intel/tools/intel_dump_gpu.c +++ b/src/intel/tools/intel_dump_gpu.c @@ -207,6 +207,12 @@ dump_execbuffer2(int fd, struct drm_i915_gem_execbuffer2 *execbuffer2) fail_if(!gen_get_device_info_from_fd(fd, &devinfo), "failed to identify chipset.\n"); device = devinfo.chipset_id; + } else if (devinfo.gen == 0) { + fail_if(!gen_get_device_info_from_pci_id(device, &devinfo), + "failed to identify chipset.\n"); + } + + if (!aub_file.file) { aub_file_init(&aub_file, output_file, verbose == 2 ? stdout : NULL, device, program_invocation_short_name); -- 2.30.2