diff options
author | Marek Olšák <[email protected]> | 2016-06-30 02:11:04 +0200 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2016-07-05 00:47:12 +0200 |
commit | 642cf400aa806281720acbe599a35a6a176c04b3 (patch) | |
tree | 5c9ab7641deac96a45750b76511e033f7f4458ad /src/gallium/drivers | |
parent | 1daec2b795a2c029b89202a15142376ac701bc39 (diff) |
ddebug: add an option to dump info about a specific apitrace call
Reviewed-by: Bas Nieuwenhuizen <[email protected]>
Reviewed-by: Nicolai Hähnle <[email protected]>
Diffstat (limited to 'src/gallium/drivers')
-rw-r--r-- | src/gallium/drivers/ddebug/dd_draw.c | 8 | ||||
-rw-r--r-- | src/gallium/drivers/ddebug/dd_pipe.h | 4 | ||||
-rw-r--r-- | src/gallium/drivers/ddebug/dd_screen.c | 20 |
3 files changed, 29 insertions, 3 deletions
diff --git a/src/gallium/drivers/ddebug/dd_draw.c b/src/gallium/drivers/ddebug/dd_draw.c index f0f6fb68b2d..f8047ccc852 100644 --- a/src/gallium/drivers/ddebug/dd_draw.c +++ b/src/gallium/drivers/ddebug/dd_draw.c @@ -617,6 +617,7 @@ dd_context_flush(struct pipe_context *_pipe, "GPU hang detected in pipe->flush()"); break; case DD_DUMP_ALL_CALLS: + case DD_DUMP_APITRACE_CALL: pipe->flush(pipe, fence, flags); break; default: @@ -659,6 +660,13 @@ dd_after_draw(struct dd_context *dctx, struct dd_call *call) 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); } diff --git a/src/gallium/drivers/ddebug/dd_pipe.h b/src/gallium/drivers/ddebug/dd_pipe.h index f94303de7e1..69d5c4e2216 100644 --- a/src/gallium/drivers/ddebug/dd_pipe.h +++ b/src/gallium/drivers/ddebug/dd_pipe.h @@ -35,7 +35,8 @@ enum dd_mode { DD_DETECT_HANGS, - DD_DUMP_ALL_CALLS + DD_DUMP_ALL_CALLS, + DD_DUMP_APITRACE_CALL, }; struct dd_screen @@ -47,6 +48,7 @@ struct dd_screen bool no_flush; bool verbose; unsigned skip_count; + unsigned apitrace_dump_call; }; struct dd_query diff --git a/src/gallium/drivers/ddebug/dd_screen.c b/src/gallium/drivers/ddebug/dd_screen.c index 5a883bdd016..db535e9837b 100644 --- a/src/gallium/drivers/ddebug/dd_screen.c +++ b/src/gallium/drivers/ddebug/dd_screen.c @@ -292,9 +292,14 @@ ddebug_screen_create(struct pipe_screen *screen) 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"); @@ -310,6 +315,9 @@ ddebug_screen_create(struct pipe_screen *screen) 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."); @@ -322,7 +330,10 @@ ddebug_screen_create(struct pipe_screen *screen) 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); @@ -363,9 +374,11 @@ ddebug_screen_create(struct pipe_screen *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: @@ -375,6 +388,9 @@ ddebug_screen_create(struct pipe_screen *screen) 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); } |