mirror of
https://github.com/tiagovignatti/intel-gpu-tools.git
synced 2025-06-22 15:26:21 +00:00
reg_dumper: change and fix behavior when using dump files
Before this patch, handling dump files was wrong: - when HAS_PCH_SPLIT was specified, intel_reg_dumper segfaulted inside intel_check_pch() - the "devid" variable was used but not set - there was no way to specify the device id of the machine used to generate the dump file This patch fixes this behavior with the following changes: - the HAS_PCH_SPLIT variable is gone - there is now a '-d' argument that can be used to specify the device id used to interpret the results - when a dump file is used but the '-d' argument is not provided, an Ironlake machine is assumed Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
This commit is contained in:
parent
ad87b06fd6
commit
ecad594e02
@ -4,7 +4,7 @@
|
|||||||
.SH NAME
|
.SH NAME
|
||||||
intel_reg_dumper \- Decode a bunch of Intel GPU registers for debugging
|
intel_reg_dumper \- Decode a bunch of Intel GPU registers for debugging
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
.B intel_reg_dumper [ file ]
|
.B intel_reg_dumper [ options ] [ file ]
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
.B intel_reg_dumper
|
.B intel_reg_dumper
|
||||||
is a tool to read and decode the values of many Intel GPU registers. It is
|
is a tool to read and decode the values of many Intel GPU registers. It is
|
||||||
@ -14,11 +14,20 @@ argument is present, the registers will be decoded from the given file
|
|||||||
instead of the current registers. Use the
|
instead of the current registers. Use the
|
||||||
.B intel_reg_snapshot
|
.B intel_reg_snapshot
|
||||||
tool to generate such files.
|
tool to generate such files.
|
||||||
.SH ENVIRONMENT
|
|
||||||
.BR HAS_PCH_SPLIT
|
When the
|
||||||
.PP
|
.B file
|
||||||
If set, decode as though the GPU has a PCH split. This is only necessary for
|
argument is present and the
|
||||||
Intel HD (Ironlake) and later register dumps in files; live decodes get this
|
.B -d
|
||||||
correct automatically.
|
argument is not present,
|
||||||
|
.B intel_reg_dumper
|
||||||
|
will assume the file was generated on an Ironlake machine.
|
||||||
|
.SH OPTIONS
|
||||||
|
.TP
|
||||||
|
.B -d id
|
||||||
|
when a dump file is used, use 'id' as device id (in hex)
|
||||||
|
.TP
|
||||||
|
.B -h
|
||||||
|
prints a help message
|
||||||
.SH SEE ALSO
|
.SH SEE ALSO
|
||||||
.BR intel_reg_snapshot(1)
|
.BR intel_reg_snapshot(1)
|
||||||
|
@ -30,9 +30,10 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <err.h>
|
#include <err.h>
|
||||||
|
#include <unistd.h>
|
||||||
#include "intel_gpu_tools.h"
|
#include "intel_gpu_tools.h"
|
||||||
|
|
||||||
static uint32_t devid;
|
static uint32_t devid = 0;
|
||||||
|
|
||||||
#define DEBUGSTRING(func) static void func(char *result, int len, int reg, uint32_t val)
|
#define DEBUGSTRING(func) static void func(char *result, int len, int reg, uint32_t val)
|
||||||
|
|
||||||
@ -2072,21 +2073,61 @@ intel_dump_regs(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void print_usage(void)
|
||||||
|
{
|
||||||
|
printf("Usage: intel_reg_dumper [options] [file]\n"
|
||||||
|
"Options:\n"
|
||||||
|
" -d id when a dump file is used, use 'id' as device id (in "
|
||||||
|
"hex)\n"
|
||||||
|
" -h prints this help\n");
|
||||||
|
}
|
||||||
|
|
||||||
int main(int argc, char** argv)
|
int main(int argc, char** argv)
|
||||||
{
|
{
|
||||||
struct pci_device *pci_dev;
|
struct pci_device *pci_dev;
|
||||||
|
int opt;
|
||||||
|
char *file = NULL;
|
||||||
|
|
||||||
if (argc == 2)
|
while ((opt = getopt(argc, argv, "d:h")) != -1) {
|
||||||
intel_map_file(argv[1]);
|
switch (opt) {
|
||||||
else {
|
case 'd':
|
||||||
|
devid = strtol(optarg, NULL, 16);
|
||||||
|
break;
|
||||||
|
case 'h':
|
||||||
|
print_usage();
|
||||||
|
return 0;
|
||||||
|
default:
|
||||||
|
print_usage();
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (optind < argc)
|
||||||
|
file = argv[optind];
|
||||||
|
|
||||||
|
if (file) {
|
||||||
|
intel_map_file(file);
|
||||||
|
if (devid) {
|
||||||
|
if (IS_GEN5(devid))
|
||||||
|
pch = PCH_IBX;
|
||||||
|
else
|
||||||
|
pch = PCH_CPT;
|
||||||
|
} else {
|
||||||
|
printf("Dumping from file without -d argument. "
|
||||||
|
"Assuming Ironlake machine.\n");
|
||||||
|
devid = 0x0042;
|
||||||
|
pch = PCH_IBX;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
pci_dev = intel_get_pci_device();
|
pci_dev = intel_get_pci_device();
|
||||||
devid = pci_dev->device_id; /* XXX not true when mapping! */
|
devid = pci_dev->device_id;
|
||||||
|
|
||||||
intel_get_mmio(pci_dev);
|
intel_get_mmio(pci_dev);
|
||||||
|
|
||||||
|
if (HAS_PCH_SPLIT(devid))
|
||||||
|
intel_check_pch();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (HAS_PCH_SPLIT(devid) || getenv("HAS_PCH_SPLIT")) {
|
if (HAS_PCH_SPLIT(devid)) {
|
||||||
intel_check_pch();
|
|
||||||
ironlake_dump_regs();
|
ironlake_dump_regs();
|
||||||
}
|
}
|
||||||
else if (IS_945GM(devid)) {
|
else if (IS_945GM(devid)) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user