u_trace: generate tracepoint index parameter in perfetto callbacks
Useful to figure out what's the tracepoint name you're implementing. We'll use this in the intel perfetto integration glue to index into an array of perfetto iid. 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:
committed by
Marge Bot
parent
960441d5a3
commit
1afc876afd
@@ -602,7 +602,7 @@ process_chunk(void *job, void *gdata, int thread_index)
|
||||
if (evt->tp->perfetto &&
|
||||
(p_atomic_read_relaxed(&utctx->enabled_traces) &
|
||||
U_TRACE_TYPE_PERFETTO_ACTIVE)) {
|
||||
evt->tp->perfetto(utctx->pctx, ns, chunk->flush_data, evt->payload);
|
||||
evt->tp->perfetto(utctx->pctx, ns, evt->tp->tp_idx, chunk->flush_data, evt->payload);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -246,6 +246,7 @@ struct trace_${trace_name} {
|
||||
void ${trace.tp_perfetto}(
|
||||
${ctx_param},
|
||||
uint64_t ts_ns,
|
||||
uint16_t tp_idx,
|
||||
const void *flush_data,
|
||||
const struct trace_${trace_name} *payload);
|
||||
#endif
|
||||
@@ -360,7 +361,7 @@ ${trace_toggle_name}_config_variable(void)
|
||||
}
|
||||
% endif
|
||||
|
||||
% for trace_name, trace in TRACEPOINTS.items():
|
||||
% for index, (trace_name, trace) in enumerate(TRACEPOINTS.items()):
|
||||
/*
|
||||
* ${trace_name}
|
||||
*/
|
||||
@@ -446,11 +447,12 @@ static const struct u_tracepoint __tp_${trace_name} = {
|
||||
ALIGN_POT(sizeof(struct trace_${trace_name}), 8), /* keep size 64b aligned */
|
||||
"${trace_name}",
|
||||
${"true" if trace.end_of_pipe else "false"},
|
||||
${index},
|
||||
__print_${trace_name},
|
||||
__print_json_${trace_name},
|
||||
% if trace.tp_perfetto is not None:
|
||||
#ifdef HAVE_PERFETTO
|
||||
(void (*)(void *pctx, uint64_t, const void *, const void *))${trace.tp_perfetto},
|
||||
(void (*)(void *pctx, uint64_t, uint16_t, const void *, const void *))${trace.tp_perfetto},
|
||||
#endif
|
||||
% endif
|
||||
};
|
||||
|
||||
@@ -45,7 +45,19 @@ extern "C" {
|
||||
struct u_tracepoint {
|
||||
unsigned payload_sz;
|
||||
const char *name;
|
||||
bool end_of_pipe;
|
||||
/**
|
||||
* Whether this tracepoint's timestamp must be recorded with as an
|
||||
* end-of-pipe timestamp (for some GPUs the recording timestamp instruction
|
||||
* might be different for top/end of pipe).
|
||||
*/
|
||||
bool end_of_pipe:1;
|
||||
/**
|
||||
* Index of this tracepoint in <basename>_tracepoint_names in the generated
|
||||
* u_trace perfetto header. By associating these names with iids in setup,
|
||||
* tracepoints can be presented with with their own names by passing that
|
||||
* to event->set_stage_iid().
|
||||
*/
|
||||
uint16_t tp_idx;
|
||||
void (*print)(FILE *out, const void *payload);
|
||||
void (*print_json)(FILE *out, const void *payload);
|
||||
#ifdef HAVE_PERFETTO
|
||||
@@ -54,6 +66,7 @@ struct u_tracepoint {
|
||||
*/
|
||||
void (*perfetto)(void *pctx,
|
||||
uint64_t ts_ns,
|
||||
uint16_t tp_idx,
|
||||
const void *flush_data,
|
||||
const void *payload);
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user