mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-08 02:38:04 +02:00
Merge branch 'improve_perfetto_timeline' into 'main'
Add payload values to compute/draw Perfetto labels See merge request mesa/mesa!41374
This commit is contained in:
commit
feacf650f9
1 changed files with 66 additions and 10 deletions
|
|
@ -23,6 +23,7 @@
|
|||
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include <string>
|
||||
|
||||
#include "common/intel_gem.h"
|
||||
#include "perf/intel_perf.h"
|
||||
|
|
@ -264,6 +265,13 @@ end_event(struct intel_ds_queue *queue, uint64_t ts_ns,
|
|||
struct intel_ds_stage *stage = &queue->stages[stage_id];
|
||||
uint64_t start_ns = stage->start_ns[level];
|
||||
|
||||
/* Deep copy app_event before the [=] lambda capture. The raw pointer
|
||||
* points to a stack-local char buffer in the caller, which is invalid
|
||||
* by the time the Trace() continuation executes.
|
||||
*/
|
||||
bool has_app_event = app_event != NULL;
|
||||
std::string app_event_copy = has_app_event ? std::string(app_event) : std::string();
|
||||
|
||||
if (!start_ns)
|
||||
return;
|
||||
|
||||
|
|
@ -278,8 +286,8 @@ end_event(struct intel_ds_queue *queue, uint64_t ts_ns,
|
|||
* stage_iid if not already seen. Otherwise, it's a driver event and we
|
||||
* have use the internal stage_iid.
|
||||
*/
|
||||
uint64_t stage_iid = app_event ?
|
||||
tctx.GetDataSourceLocked()->debug_marker_stage(tctx, app_event) :
|
||||
uint64_t stage_iid = has_app_event ?
|
||||
tctx.GetDataSourceLocked()->debug_marker_stage(tctx, app_event_copy.c_str()) :
|
||||
device->tracepoint_iids[tracepoint_idx];
|
||||
|
||||
auto packet = tctx.NewTracePacket();
|
||||
|
|
@ -432,7 +440,24 @@ extern "C" {
|
|||
* collected.
|
||||
*/
|
||||
|
||||
#define CREATE_DUAL_EVENT_CALLBACK(event_name, stage) \
|
||||
static const char *
|
||||
intel_ds_format_event_name(char *buf, size_t buf_size, const char *fmt, ...)
|
||||
{
|
||||
if (fmt == NULL)
|
||||
return NULL;
|
||||
|
||||
va_list ap;
|
||||
va_start(ap, fmt);
|
||||
vsnprintf(buf, buf_size, fmt, ap);
|
||||
va_end(ap);
|
||||
|
||||
return buf;
|
||||
}
|
||||
|
||||
#define CREATE_DUAL_EVENT_CALLBACK(event_name, stage, ...) \
|
||||
CREATE_DUAL_EVENT_CALLBACK_IMPL(event_name, stage, ##__VA_ARGS__, NULL)
|
||||
|
||||
#define CREATE_DUAL_EVENT_CALLBACK_IMPL(event_name, stage, name_fmt, ...) \
|
||||
void \
|
||||
intel_ds_begin_##event_name(struct intel_ds_device *device, \
|
||||
uint64_t ts_ns, \
|
||||
|
|
@ -456,8 +481,16 @@ extern "C" {
|
|||
{ \
|
||||
const struct intel_ds_flush_data *flush = \
|
||||
(const struct intel_ds_flush_data *) flush_data; \
|
||||
char event_name[64]; \
|
||||
UNUSED const uint32_t *indirect = \
|
||||
(const uint32_t *) indirect_data; \
|
||||
const char *name = NULL; \
|
||||
if ((name_fmt) != NULL) { \
|
||||
name = intel_ds_format_event_name(event_name, sizeof(event_name), \
|
||||
(name_fmt), ##__VA_ARGS__); \
|
||||
} \
|
||||
end_event(flush->queue, ts_ns, stage, flush->submission_id, \
|
||||
tp_idx, NULL, payload, indirect_data, \
|
||||
tp_idx, name, payload, indirect_data, \
|
||||
(trace_payload_as_extra_func) \
|
||||
&trace_payload_as_extra_intel_end_##event_name); \
|
||||
} \
|
||||
|
|
@ -469,12 +502,22 @@ CREATE_DUAL_EVENT_CALLBACK(sba, INTEL_DS_QUEUE_STAGE_CMD_BUFFER)
|
|||
CREATE_DUAL_EVENT_CALLBACK(btp, INTEL_DS_QUEUE_STAGE_CMD_BUFFER)
|
||||
CREATE_DUAL_EVENT_CALLBACK(render_pass, INTEL_DS_QUEUE_STAGE_RENDER_PASS)
|
||||
CREATE_DUAL_EVENT_CALLBACK(blorp, INTEL_DS_QUEUE_STAGE_BLORP)
|
||||
CREATE_DUAL_EVENT_CALLBACK(draw, INTEL_DS_QUEUE_STAGE_DRAW)
|
||||
CREATE_DUAL_EVENT_CALLBACK(draw_indexed, INTEL_DS_QUEUE_STAGE_DRAW)
|
||||
CREATE_DUAL_EVENT_CALLBACK(draw, INTEL_DS_QUEUE_STAGE_DRAW,
|
||||
"draw(%u)", payload->count)
|
||||
CREATE_DUAL_EVENT_CALLBACK(draw_indexed, INTEL_DS_QUEUE_STAGE_DRAW,
|
||||
"draw_indexed(%u)", payload->count)
|
||||
CREATE_DUAL_EVENT_CALLBACK(draw_indexed_multi, INTEL_DS_QUEUE_STAGE_DRAW)
|
||||
CREATE_DUAL_EVENT_CALLBACK(draw_indexed_indirect, INTEL_DS_QUEUE_STAGE_DRAW)
|
||||
CREATE_DUAL_EVENT_CALLBACK(draw_indexed_indirect, INTEL_DS_QUEUE_STAGE_DRAW,
|
||||
(p_atomic_read_relaxed(&device->trace_context.enabled_traces) &
|
||||
U_TRACE_TYPE_INDIRECTS) ?
|
||||
"draw_indexed_indirect(%u)" : "draw_indexed_indirect",
|
||||
payload->draw_count)
|
||||
CREATE_DUAL_EVENT_CALLBACK(draw_multi, INTEL_DS_QUEUE_STAGE_DRAW)
|
||||
CREATE_DUAL_EVENT_CALLBACK(draw_indirect, INTEL_DS_QUEUE_STAGE_DRAW)
|
||||
CREATE_DUAL_EVENT_CALLBACK(draw_indirect, INTEL_DS_QUEUE_STAGE_DRAW,
|
||||
(p_atomic_read_relaxed(&device->trace_context.enabled_traces) &
|
||||
U_TRACE_TYPE_INDIRECTS) ?
|
||||
"draw_indirect(%u)" : "draw_indirect",
|
||||
payload->draw_count)
|
||||
CREATE_DUAL_EVENT_CALLBACK(draw_indirect_count, INTEL_DS_QUEUE_STAGE_DRAW)
|
||||
CREATE_DUAL_EVENT_CALLBACK(draw_indirect_byte_count, INTEL_DS_QUEUE_STAGE_DRAW)
|
||||
CREATE_DUAL_EVENT_CALLBACK(draw_indexed_indirect_count, INTEL_DS_QUEUE_STAGE_DRAW)
|
||||
|
|
@ -482,8 +525,21 @@ CREATE_DUAL_EVENT_CALLBACK(draw_mesh, INTEL_DS_QUEUE_STAGE_DRAW_MESH)
|
|||
CREATE_DUAL_EVENT_CALLBACK(draw_mesh_indirect, INTEL_DS_QUEUE_STAGE_DRAW_MESH)
|
||||
CREATE_DUAL_EVENT_CALLBACK(draw_mesh_indirect_count, INTEL_DS_QUEUE_STAGE_DRAW_MESH)
|
||||
CREATE_DUAL_EVENT_CALLBACK(xfb, INTEL_DS_QUEUE_STAGE_CMD_BUFFER)
|
||||
CREATE_DUAL_EVENT_CALLBACK(compute, INTEL_DS_QUEUE_STAGE_COMPUTE)
|
||||
CREATE_DUAL_EVENT_CALLBACK(compute_indirect, INTEL_DS_QUEUE_STAGE_COMPUTE)
|
||||
CREATE_DUAL_EVENT_CALLBACK(compute, INTEL_DS_QUEUE_STAGE_COMPUTE,
|
||||
payload->group_z != 1 ? "compute(%u,%u,%u)" :
|
||||
payload->group_y != 1 ? "compute(%u,%u)" :
|
||||
"compute(%u)",
|
||||
payload->group_x, payload->group_y, payload->group_z)
|
||||
CREATE_DUAL_EVENT_CALLBACK(compute_indirect, INTEL_DS_QUEUE_STAGE_COMPUTE,
|
||||
((p_atomic_read_relaxed(&device->trace_context.enabled_traces) &
|
||||
U_TRACE_TYPE_INDIRECTS) && indirect) ?
|
||||
(indirect[2] != 1 ? "compute_indirect(%u,%u,%u)" :
|
||||
indirect[1] != 1 ? "compute_indirect(%u,%u)" :
|
||||
"compute_indirect(%u)") :
|
||||
"compute_indirect",
|
||||
indirect ? indirect[0] : 0,
|
||||
indirect ? indirect[1] : 0,
|
||||
indirect ? indirect[2] : 0)
|
||||
CREATE_DUAL_EVENT_CALLBACK(generate_draws, INTEL_DS_QUEUE_STAGE_INTERNAL_OPS)
|
||||
CREATE_DUAL_EVENT_CALLBACK(generate_cmds_pre, INTEL_DS_QUEUE_STAGE_INTERNAL_OPS)
|
||||
CREATE_DUAL_EVENT_CALLBACK(generate_cmds_post, INTEL_DS_QUEUE_STAGE_INTERNAL_OPS)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue