mirror of
https://github.com/tiagovignatti/intel-gpu-tools.git
synced 2025-06-11 09:56:22 +00:00
intel_error_decode: Whitespacing fix
The rest of igt has moved to kernel coding style. People had already been not conforming with the existing formatting in error decode, so we may as well fix it. This addresses two primary issues, tabbing (remove spaces), and space after function in function call. I may have missed some of the latter since that was done by hand. I have upcoming work in this file, and it was annoying me. v2: Fix case alignment (Chris) Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
This commit is contained in:
parent
70afbead46
commit
155aa1e1fa
@ -1,4 +1,3 @@
|
||||
/* -*- c-basic-offset: 4 -*- */
|
||||
/*
|
||||
* Copyright © 2007 Intel Corporation
|
||||
* Copyright © 2009 Intel Corporation
|
||||
@ -57,7 +56,7 @@
|
||||
#include "instdone.h"
|
||||
|
||||
static void
|
||||
print_instdone (uint32_t devid, unsigned int instdone, unsigned int instdone1)
|
||||
print_instdone(uint32_t devid, unsigned int instdone, unsigned int instdone1)
|
||||
{
|
||||
int i;
|
||||
static int once;
|
||||
@ -105,7 +104,7 @@ print_i830_pgtbl_err(unsigned int reg)
|
||||
}
|
||||
|
||||
if (str)
|
||||
printf (" source = %s\n", str);
|
||||
printf(" source = %s\n", str);
|
||||
|
||||
switch(reg & 0x7) {
|
||||
case 0x0: str = "Invalid GTT"; break;
|
||||
@ -117,85 +116,85 @@ print_i830_pgtbl_err(unsigned int reg)
|
||||
case 0x6: str = "Invalid Tiling"; break;
|
||||
case 0x7: str = "Host to CAM"; break;
|
||||
}
|
||||
printf (" error = %s\n", str);
|
||||
printf(" error = %s\n", str);
|
||||
}
|
||||
|
||||
static void
|
||||
print_i915_pgtbl_err(unsigned int reg)
|
||||
{
|
||||
if (reg & (1 << 29))
|
||||
printf (" Cursor A: Invalid GTT PTE\n");
|
||||
printf(" Cursor A: Invalid GTT PTE\n");
|
||||
if (reg & (1 << 28))
|
||||
printf (" Cursor B: Invalid GTT PTE\n");
|
||||
printf(" Cursor B: Invalid GTT PTE\n");
|
||||
if (reg & (1 << 27))
|
||||
printf (" MT: Invalid tiling\n");
|
||||
printf(" MT: Invalid tiling\n");
|
||||
if (reg & (1 << 26))
|
||||
printf (" MT: Invalid GTT PTE\n");
|
||||
printf(" MT: Invalid GTT PTE\n");
|
||||
if (reg & (1 << 25))
|
||||
printf (" LC: Invalid tiling\n");
|
||||
printf(" LC: Invalid tiling\n");
|
||||
if (reg & (1 << 24))
|
||||
printf (" LC: Invalid GTT PTE\n");
|
||||
printf(" LC: Invalid GTT PTE\n");
|
||||
if (reg & (1 << 23))
|
||||
printf (" BIN VertexData: Invalid GTT PTE\n");
|
||||
printf(" BIN VertexData: Invalid GTT PTE\n");
|
||||
if (reg & (1 << 22))
|
||||
printf (" BIN Instruction: Invalid GTT PTE\n");
|
||||
printf(" BIN Instruction: Invalid GTT PTE\n");
|
||||
if (reg & (1 << 21))
|
||||
printf (" CS VertexData: Invalid GTT PTE\n");
|
||||
printf(" CS VertexData: Invalid GTT PTE\n");
|
||||
if (reg & (1 << 20))
|
||||
printf (" CS Instruction: Invalid GTT PTE\n");
|
||||
printf(" CS Instruction: Invalid GTT PTE\n");
|
||||
if (reg & (1 << 19))
|
||||
printf (" CS: Invalid GTT\n");
|
||||
printf(" CS: Invalid GTT\n");
|
||||
if (reg & (1 << 18))
|
||||
printf (" Overlay: Invalid tiling\n");
|
||||
printf(" Overlay: Invalid tiling\n");
|
||||
if (reg & (1 << 16))
|
||||
printf (" Overlay: Invalid GTT PTE\n");
|
||||
printf(" Overlay: Invalid GTT PTE\n");
|
||||
if (reg & (1 << 14))
|
||||
printf (" Display C: Invalid tiling\n");
|
||||
printf(" Display C: Invalid tiling\n");
|
||||
if (reg & (1 << 12))
|
||||
printf (" Display C: Invalid GTT PTE\n");
|
||||
printf(" Display C: Invalid GTT PTE\n");
|
||||
if (reg & (1 << 10))
|
||||
printf (" Display B: Invalid tiling\n");
|
||||
printf(" Display B: Invalid tiling\n");
|
||||
if (reg & (1 << 8))
|
||||
printf (" Display B: Invalid GTT PTE\n");
|
||||
printf(" Display B: Invalid GTT PTE\n");
|
||||
if (reg & (1 << 6))
|
||||
printf (" Display A: Invalid tiling\n");
|
||||
printf(" Display A: Invalid tiling\n");
|
||||
if (reg & (1 << 4))
|
||||
printf (" Display A: Invalid GTT PTE\n");
|
||||
printf(" Display A: Invalid GTT PTE\n");
|
||||
if (reg & (1 << 1))
|
||||
printf (" Host Invalid PTE data\n");
|
||||
printf(" Host Invalid PTE data\n");
|
||||
if (reg & (1 << 0))
|
||||
printf (" Host Invalid GTT PTE\n");
|
||||
printf(" Host Invalid GTT PTE\n");
|
||||
}
|
||||
|
||||
static void
|
||||
print_i965_pgtbl_err(unsigned int reg)
|
||||
{
|
||||
if (reg & (1 << 26))
|
||||
printf (" Invalid Sampler Cache GTT entry\n");
|
||||
printf(" Invalid Sampler Cache GTT entry\n");
|
||||
if (reg & (1 << 24))
|
||||
printf (" Invalid Render Cache GTT entry\n");
|
||||
printf(" Invalid Render Cache GTT entry\n");
|
||||
if (reg & (1 << 23))
|
||||
printf (" Invalid Instruction/State Cache GTT entry\n");
|
||||
printf(" Invalid Instruction/State Cache GTT entry\n");
|
||||
if (reg & (1 << 22))
|
||||
printf (" There is no ROC, this cannot occur!\n");
|
||||
printf(" There is no ROC, this cannot occur!\n");
|
||||
if (reg & (1 << 21))
|
||||
printf (" Invalid GTT entry during Vertex Fetch\n");
|
||||
printf(" Invalid GTT entry during Vertex Fetch\n");
|
||||
if (reg & (1 << 20))
|
||||
printf (" Invalid GTT entry during Command Fetch\n");
|
||||
printf(" Invalid GTT entry during Command Fetch\n");
|
||||
if (reg & (1 << 19))
|
||||
printf (" Invalid GTT entry during CS\n");
|
||||
printf(" Invalid GTT entry during CS\n");
|
||||
if (reg & (1 << 18))
|
||||
printf (" Invalid GTT entry during Cursor Fetch\n");
|
||||
printf(" Invalid GTT entry during Cursor Fetch\n");
|
||||
if (reg & (1 << 17))
|
||||
printf (" Invalid GTT entry during Overlay Fetch\n");
|
||||
printf(" Invalid GTT entry during Overlay Fetch\n");
|
||||
if (reg & (1 << 8))
|
||||
printf (" Invalid GTT entry during Display B Fetch\n");
|
||||
printf(" Invalid GTT entry during Display B Fetch\n");
|
||||
if (reg & (1 << 4))
|
||||
printf (" Invalid GTT entry during Display A Fetch\n");
|
||||
printf(" Invalid GTT entry during Display A Fetch\n");
|
||||
if (reg & (1 << 1))
|
||||
printf (" Valid PTE references illegal memory\n");
|
||||
printf(" Valid PTE references illegal memory\n");
|
||||
if (reg & (1 << 0))
|
||||
printf (" Invalid GTT entry during fetch for host\n");
|
||||
printf(" Invalid GTT entry during fetch for host\n");
|
||||
}
|
||||
|
||||
static void
|
||||
@ -275,7 +274,7 @@ print_fence(unsigned int devid, uint64_t fence)
|
||||
}
|
||||
|
||||
static void
|
||||
read_data_file (FILE *file)
|
||||
read_data_file(FILE *file)
|
||||
{
|
||||
struct drm_intel_decode *decode_ctx = NULL;
|
||||
uint32_t devid = PCI_CHIP_I855_GM;
|
||||
@ -290,7 +289,7 @@ read_data_file (FILE *file)
|
||||
char *ring_name = NULL;
|
||||
int is_batch = 1;
|
||||
|
||||
while (getline (&line, &line_size, file) > 0) {
|
||||
while (getline(&line, &line_size, file) > 0) {
|
||||
char *dashes;
|
||||
line_number++;
|
||||
|
||||
@ -300,7 +299,7 @@ read_data_file (FILE *file)
|
||||
strncpy(new_ring_name, line, dashes - line);
|
||||
new_ring_name[dashes - line - 1] = '\0';
|
||||
|
||||
matched = sscanf (dashes, "--- gtt_offset = 0x%08x\n",
|
||||
matched = sscanf(dashes, "--- gtt_offset = 0x%08x\n",
|
||||
&new_gtt_offset);
|
||||
if (matched == 1) {
|
||||
if (count) {
|
||||
@ -321,7 +320,7 @@ read_data_file (FILE *file)
|
||||
continue;
|
||||
}
|
||||
|
||||
matched = sscanf (dashes, "--- ringbuffer = 0x%08x\n",
|
||||
matched = sscanf(dashes, "--- ringbuffer = 0x%08x\n",
|
||||
&new_gtt_offset);
|
||||
if (matched == 1) {
|
||||
if (count) {
|
||||
@ -343,7 +342,7 @@ read_data_file (FILE *file)
|
||||
}
|
||||
}
|
||||
|
||||
matched = sscanf (line, "%08x : %08x", &offset, &value);
|
||||
matched = sscanf(line, "%08x : %08x", &offset, &value);
|
||||
if (matched != 2) {
|
||||
unsigned int reg;
|
||||
|
||||
@ -362,13 +361,13 @@ read_data_file (FILE *file)
|
||||
|
||||
printf("%s", line);
|
||||
|
||||
matched = sscanf (line, "PCI ID: 0x%04x\n", ®);
|
||||
matched = sscanf(line, "PCI ID: 0x%04x\n", ®);
|
||||
if (matched == 0)
|
||||
matched = sscanf (line, " PCI ID: 0x%04x\n", ®);
|
||||
matched = sscanf(line, " PCI ID: 0x%04x\n", ®);
|
||||
if (matched == 0) {
|
||||
const char *pci_id_start = strstr (line, "PCI ID");
|
||||
const char *pci_id_start = strstr(line, "PCI ID");
|
||||
if (pci_id_start)
|
||||
matched = sscanf (pci_id_start, "PCI ID: 0x%04x\n", ®);
|
||||
matched = sscanf(pci_id_start, "PCI ID: 0x%04x\n", ®);
|
||||
}
|
||||
if (matched == 1) {
|
||||
devid = reg;
|
||||
@ -378,25 +377,25 @@ read_data_file (FILE *file)
|
||||
decode_ctx = drm_intel_decode_context_alloc(devid);
|
||||
}
|
||||
|
||||
matched = sscanf (line, " ACTHD: 0x%08x\n", ®);
|
||||
matched = sscanf(line, " ACTHD: 0x%08x\n", ®);
|
||||
if (matched == 1)
|
||||
drm_intel_decode_set_head_tail(decode_ctx, reg, 0xffffffff);
|
||||
|
||||
matched = sscanf (line, " PGTBL_ER: 0x%08x\n", ®);
|
||||
matched = sscanf(line, " PGTBL_ER: 0x%08x\n", ®);
|
||||
if (matched == 1 && reg)
|
||||
print_pgtbl_err(reg, devid);
|
||||
|
||||
matched = sscanf (line, " INSTDONE: 0x%08x\n", ®);
|
||||
matched = sscanf(line, " INSTDONE: 0x%08x\n", ®);
|
||||
if (matched == 1)
|
||||
print_instdone (devid, reg, -1);
|
||||
print_instdone(devid, reg, -1);
|
||||
|
||||
matched = sscanf (line, " INSTDONE1: 0x%08x\n", ®);
|
||||
matched = sscanf(line, " INSTDONE1: 0x%08x\n", ®);
|
||||
if (matched == 1)
|
||||
print_instdone (devid, -1, reg);
|
||||
print_instdone(devid, -1, reg);
|
||||
|
||||
matched = sscanf (line, " fence[%i] = %Lx\n", ®, &fence);
|
||||
matched = sscanf(line, " fence[%i] = %Lx\n", ®, &fence);
|
||||
if (matched == 2)
|
||||
print_fence (devid, fence);
|
||||
print_fence(devid, fence);
|
||||
|
||||
continue;
|
||||
}
|
||||
@ -405,10 +404,10 @@ read_data_file (FILE *file)
|
||||
|
||||
if (count > data_size) {
|
||||
data_size = data_size ? data_size * 2 : 1024;
|
||||
data = realloc (data, data_size * sizeof (uint32_t));
|
||||
data = realloc(data, data_size * sizeof (uint32_t));
|
||||
if (data == NULL) {
|
||||
fprintf (stderr, "Out of memory.\n");
|
||||
exit (1);
|
||||
fprintf(stderr, "Out of memory.\n");
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
@ -426,13 +425,13 @@ read_data_file (FILE *file)
|
||||
drm_intel_decode(decode_ctx);
|
||||
}
|
||||
|
||||
free (data);
|
||||
free (line);
|
||||
free (ring_name);
|
||||
free(data);
|
||||
free(line);
|
||||
free(ring_name);
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
FILE *file;
|
||||
const char *path;
|
||||
@ -441,7 +440,7 @@ main (int argc, char *argv[])
|
||||
int error;
|
||||
|
||||
if (argc > 2) {
|
||||
fprintf (stderr,
|
||||
fprintf(stderr,
|
||||
"intel_gpu_decode: Parse an Intel GPU i915_error_state\n"
|
||||
"Usage:\n"
|
||||
"\t%s [<file>]\n"
|
||||
@ -459,10 +458,10 @@ main (int argc, char *argv[])
|
||||
if (argc == 1) {
|
||||
if (isatty(0)) {
|
||||
path = "/debug/dri";
|
||||
error = stat (path, &st);
|
||||
error = stat(path, &st);
|
||||
if (error != 0) {
|
||||
path = "/sys/kernel/debug/dri";
|
||||
error = stat (path, &st);
|
||||
error = stat(path, &st);
|
||||
if (error != 0) {
|
||||
errx(1,
|
||||
"Couldn't find i915 debugfs directory.\n\n"
|
||||
@ -476,18 +475,18 @@ main (int argc, char *argv[])
|
||||
}
|
||||
} else {
|
||||
path = argv[1];
|
||||
error = stat (path, &st);
|
||||
error = stat(path, &st);
|
||||
if (error != 0) {
|
||||
fprintf (stderr, "Error opening %s: %s\n",
|
||||
path, strerror (errno));
|
||||
exit (1);
|
||||
fprintf(stderr, "Error opening %s: %s\n",
|
||||
path, strerror(errno));
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
if (S_ISDIR (st.st_mode)) {
|
||||
if (S_ISDIR(st.st_mode)) {
|
||||
int ret;
|
||||
|
||||
ret = asprintf (&filename, "%s/i915_error_state", path);
|
||||
ret = asprintf(&filename, "%s/i915_error_state", path);
|
||||
assert(ret > 0);
|
||||
file = fopen(filename, "r");
|
||||
if (!file) {
|
||||
@ -503,24 +502,26 @@ main (int argc, char *argv[])
|
||||
}
|
||||
}
|
||||
if (!file) {
|
||||
fprintf (stderr, "Failed to find i915_error_state beneath %s\n",
|
||||
fprintf(stderr, "Failed to find i915_error_state beneath %s\n",
|
||||
path);
|
||||
exit (1);
|
||||
}
|
||||
} else {
|
||||
file = fopen(path, "r");
|
||||
if (!file) {
|
||||
fprintf (stderr, "Failed to open %s: %s\n",
|
||||
path, strerror (errno));
|
||||
fprintf(stderr, "Failed to open %s: %s\n",
|
||||
path, strerror(errno));
|
||||
exit (1);
|
||||
}
|
||||
}
|
||||
|
||||
read_data_file (file);
|
||||
fclose (file);
|
||||
read_data_file(file);
|
||||
fclose(file);
|
||||
|
||||
if (filename != path)
|
||||
free (filename);
|
||||
free(filename);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* vim: set ts=8 sw=8 tw=0 noet :*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user