"GPU hang detected in pipe->flush()");
break;
case DD_DUMP_ALL_CALLS:
+ case DD_DUMP_APITRACE_CALL:
pipe->flush(pipe, fence, flags);
break;
default:
pipe->flush(pipe, NULL, 0);
dd_dump_call(dctx, call, 0);
break;
+ case DD_DUMP_APITRACE_CALL:
+ if (dscreen->apitrace_dump_call == dctx->apitrace_call_number) {
+ dd_dump_call(dctx, call, 0);
+ /* No need to continue. */
+ exit(0);
+ }
+ break;
default:
assert(0);
}
struct dd_screen *dscreen;
const char *option = debug_get_option("GALLIUM_DDEBUG", NULL);
bool dump_always = option && !strncmp(option, "always", 6);
+ bool dump_apitrace = option && !strncmp(option, "apitrace", 8);
bool no_flush = option && strstr(option, "noflush");
bool help = option && !strcmp(option, "help");
unsigned timeout = 0;
+ unsigned apitrace_dump_call = 0;
+
+ if (dump_apitrace)
+ no_flush = true;
if (help) {
puts("Gallium driver debugger");
puts(" fence timeout and dump context and driver information into");
puts(" $HOME/"DD_DIR"/ when a hang is detected.");
puts("");
+ puts(" GALLIUM_DDEBUG=\"apitrace [call#] [verbose]\"");
+ puts(" Dump apitrace draw call information into $HOME/"DD_DIR"/. Implies 'noflush'.");
+ puts("");
puts(" If 'noflush' is specified, do not flush on every draw call. In hang");
puts(" detection mode, this only detect hangs in pipe->flush.");
puts(" If 'verbose' is specified, additional information is written to stderr.");
if (!option)
return screen;
- if (!dump_always && sscanf(option, "%u", &timeout) != 1)
+ if (!dump_always && !dump_apitrace && sscanf(option, "%u", &timeout) != 1)
+ return screen;
+
+ if (dump_apitrace && sscanf(option+8, "%u", &apitrace_dump_call) != 1)
return screen;
dscreen = CALLOC_STRUCT(dd_screen);
dscreen->screen = screen;
dscreen->timeout_ms = timeout;
- dscreen->mode = dump_always ? DD_DUMP_ALL_CALLS : DD_DETECT_HANGS;
+ dscreen->mode = dump_always ? DD_DUMP_ALL_CALLS :
+ dump_apitrace ? DD_DUMP_APITRACE_CALL : DD_DETECT_HANGS;
dscreen->no_flush = no_flush;
dscreen->verbose = strstr(option, "verbose") != NULL;
+ dscreen->apitrace_dump_call = apitrace_dump_call;
switch (dscreen->mode) {
case DD_DUMP_ALL_CALLS:
fprintf(stderr, "Gallium debugger active. "
"The hang detection timout is %i ms.\n", timeout);
break;
+ case DD_DUMP_APITRACE_CALL:
+ fprintf(stderr, "Gallium debugger active. Going to dump an apitrace call.\n");
+ break;
default:
assert(0);
}