mirror of
https://github.com/tiagovignatti/intel-gpu-tools.git
synced 2025-06-11 09:56:22 +00:00
error decode: Search for first i915_error_state
Handy for multi-GPU systems where the IGFX may not be first. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
parent
3c5c8ba71c
commit
68a95f0e38
@ -344,10 +344,10 @@ main (int argc, char *argv[])
|
|||||||
|
|
||||||
if (argc == 1) {
|
if (argc == 1) {
|
||||||
if (isatty(0)) {
|
if (isatty(0)) {
|
||||||
path = "/debug/dri/0";
|
path = "/debug/dri";
|
||||||
err = stat (path, &st);
|
err = stat (path, &st);
|
||||||
if (err != 0) {
|
if (err != 0) {
|
||||||
path = "/sys/kernel/debug/dri/0";
|
path = "/sys/kernel/debug/dri";
|
||||||
err = stat (path, &st);
|
err = stat (path, &st);
|
||||||
if (err != 0) {
|
if (err != 0) {
|
||||||
errx(1,
|
errx(1,
|
||||||
@ -370,21 +370,37 @@ main (int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (S_ISDIR (st.st_mode))
|
if (S_ISDIR (st.st_mode)) {
|
||||||
asprintf (&filename, "%s/i915_error_state", path);
|
asprintf (&filename, "%s/i915_error_state", path);
|
||||||
else
|
file = fopen(filename, "r");
|
||||||
filename = (char *) path;
|
if (!file) {
|
||||||
|
int minor;
|
||||||
file = fopen(filename, "r");
|
for (minor = 0; minor < 64; minor++) {
|
||||||
if (file) {
|
free(filename);
|
||||||
read_data_file (file);
|
asprintf(&filename, "%s/%d/i915_error_state", path, minor);
|
||||||
fclose (file);
|
file = fopen(filename, "r");
|
||||||
|
if (file)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!file) {
|
||||||
|
fprintf (stderr, "Failed to find i915_error_state beneath %s\n",
|
||||||
|
path);
|
||||||
|
exit (1);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
fprintf (stderr, "Failed to open %s: %s\n",
|
filename = (char *) path;
|
||||||
filename, strerror (errno));
|
file = fopen(filename, "r");
|
||||||
exit (1);
|
if (!file) {
|
||||||
|
fprintf (stderr, "Failed to open %s: %s\n",
|
||||||
|
filename, strerror (errno));
|
||||||
|
exit (1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
read_data_file (file);
|
||||||
|
fclose (file);
|
||||||
|
|
||||||
if (filename != path)
|
if (filename != path)
|
||||||
free (filename);
|
free (filename);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user