aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/ddebug
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2016-06-30 00:40:01 +0200
committerMarek Olšák <[email protected]>2016-07-05 00:47:12 +0200
commit50b223547814cefc0e7130e199fabc4dbedf97ce (patch)
treecb4cd8429457a6c1ba4f14970d16d2c1871e4abb /src/gallium/drivers/ddebug
parent861ecf1ca98b0db0aeec186a212ac6285dfa47f6 (diff)
ddebug: record and dump apitrace call numbers
Reviewed-by: Bas Nieuwenhuizen <[email protected]> Reviewed-by: Nicolai Hähnle <[email protected]>
Diffstat (limited to 'src/gallium/drivers/ddebug')
-rw-r--r--src/gallium/drivers/ddebug/dd_context.c4
-rw-r--r--src/gallium/drivers/ddebug/dd_draw.c4
-rw-r--r--src/gallium/drivers/ddebug/dd_pipe.h1
-rw-r--r--src/gallium/drivers/ddebug/dd_util.h23
4 files changed, 31 insertions, 1 deletions
diff --git a/src/gallium/drivers/ddebug/dd_context.c b/src/gallium/drivers/ddebug/dd_context.c
index 5fe423b1778..98475b9fe99 100644
--- a/src/gallium/drivers/ddebug/dd_context.c
+++ b/src/gallium/drivers/ddebug/dd_context.c
@@ -665,9 +665,11 @@ static void
dd_context_emit_string_marker(struct pipe_context *_pipe,
const char *string, int len)
{
- struct pipe_context *pipe = dd_context(_pipe)->pipe;
+ struct dd_context *dctx = dd_context(_pipe);
+ struct pipe_context *pipe = dctx->pipe;
pipe->emit_string_marker(pipe, string, len);
+ dd_parse_apitrace_marker(string, len, &dctx->apitrace_call_number);
}
static void
diff --git a/src/gallium/drivers/ddebug/dd_draw.c b/src/gallium/drivers/ddebug/dd_draw.c
index f0c88879643..22337e02a87 100644
--- a/src/gallium/drivers/ddebug/dd_draw.c
+++ b/src/gallium/drivers/ddebug/dd_draw.c
@@ -99,6 +99,10 @@ dd_get_file_stream(struct dd_context *dctx)
fprintf(f, "Driver vendor: %s\n", screen->get_vendor(screen));
fprintf(f, "Device vendor: %s\n", screen->get_device_vendor(screen));
fprintf(f, "Device name: %s\n\n", screen->get_name(screen));
+
+ if (dctx->apitrace_call_number)
+ fprintf(f, "Last apitrace call: %u\n\n",
+ dctx->apitrace_call_number);
return f;
}
diff --git a/src/gallium/drivers/ddebug/dd_pipe.h b/src/gallium/drivers/ddebug/dd_pipe.h
index c9bbd569abe..f94303de7e1 100644
--- a/src/gallium/drivers/ddebug/dd_pipe.h
+++ b/src/gallium/drivers/ddebug/dd_pipe.h
@@ -114,6 +114,7 @@ struct dd_context
float tess_default_levels[6];
unsigned num_draw_calls;
+ unsigned apitrace_call_number;
};
diff --git a/src/gallium/drivers/ddebug/dd_util.h b/src/gallium/drivers/ddebug/dd_util.h
index 093bdff4a92..3649644d28e 100644
--- a/src/gallium/drivers/ddebug/dd_util.h
+++ b/src/gallium/drivers/ddebug/dd_util.h
@@ -71,4 +71,27 @@ dd_get_debug_file(bool verbose)
return f;
}
+static inline void
+dd_parse_apitrace_marker(const char *string, int len, unsigned *call_number)
+{
+ unsigned num;
+ char *s;
+
+ if (len <= 0)
+ return;
+
+ /* Make it zero-terminated. */
+ s = alloca(len + 1);
+ memcpy(s, string, len);
+ s[len] = 0;
+
+ /* Parse the number. */
+ errno = 0;
+ num = strtol(s, NULL, 10);
+ if (errno)
+ return;
+
+ *call_number = num;
+}
+
#endif /* DD_UTIL_H */