summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/ddebug/dd_util.h
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/dd_util.h
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/dd_util.h')
-rw-r--r--src/gallium/drivers/ddebug/dd_util.h23
1 files changed, 23 insertions, 0 deletions
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 */