u_trace: generate tracepoint name array in perfetto header

The driver glue doesn't have access to that information in a
centralized place. If you want to generate perfetto iid, you need
access to all names.

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Tested-by: Felix DeGrood <felix.j.degrood@intel.com>
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25730>
This commit is contained in:
Lionel Landwerlin
2023-10-14 22:14:43 +03:00
committed by Marge Bot
parent 1afc876afd
commit 6499c43cc7
+8 -1
View File
@@ -568,6 +568,12 @@ perfetto_utils_hdr_template = """\
#include "${header.hdr}"
% endfor
UNUSED static const char *${basename}_names[] = {
% for trace_name, trace in TRACEPOINTS.items():
"${trace_name}",
% endfor
};
% for trace_name, trace in TRACEPOINTS.items():
static void UNUSED
trace_payload_as_extra_${trace_name}(perfetto::protos::pbzero::GpuRenderStageEvent *event,
@@ -598,11 +604,12 @@ trace_payload_as_extra_${trace_name}(perfetto::protos::pbzero::GpuRenderStageEve
#endif /* ${guard_name} */
"""
def utrace_generate_perfetto_utils(hpath):
def utrace_generate_perfetto_utils(hpath,basename="tracepoint"):
if hpath is not None:
hdr = os.path.basename(hpath)
with open(hpath, 'wb') as f:
f.write(Template(perfetto_utils_hdr_template, output_encoding='utf-8').render(
basename=basename,
hdrname=hdr.rstrip('.h').upper(),
HEADERS=[h for h in HEADERS if h.scope & HeaderScope.PERFETTO],
TRACEPOINTS=TRACEPOINTS))