mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-06 05:08:08 +02:00
radeonsi/sqtt: forward string markers to sqtt
Reviewed-by: Marek Olšák <marek.olsak@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8746>
This commit is contained in:
parent
3bd5120a57
commit
5dc823304b
4 changed files with 66 additions and 0 deletions
|
|
@ -418,4 +418,35 @@ struct rgp_sqtt_marker_layout_transition {
|
||||||
static_assert(sizeof(struct rgp_sqtt_marker_layout_transition) == 8,
|
static_assert(sizeof(struct rgp_sqtt_marker_layout_transition) == 8,
|
||||||
"rgp_sqtt_marker_layout_transition doesn't match RGP spec");
|
"rgp_sqtt_marker_layout_transition doesn't match RGP spec");
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* "User Event" RGP SQTT instrumentation marker (Table 8)
|
||||||
|
*/
|
||||||
|
struct rgp_sqtt_marker_user_event {
|
||||||
|
union {
|
||||||
|
struct {
|
||||||
|
uint32_t identifier : 4;
|
||||||
|
uint32_t reserved0 : 8;
|
||||||
|
uint32_t data_type : 8;
|
||||||
|
uint32_t reserved1 : 12;
|
||||||
|
};
|
||||||
|
uint32_t dword01;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
struct rgp_sqtt_marker_user_event_with_length {
|
||||||
|
struct rgp_sqtt_marker_user_event user_event;
|
||||||
|
uint32_t length;
|
||||||
|
};
|
||||||
|
|
||||||
|
static_assert(sizeof(struct rgp_sqtt_marker_user_event) == 4,
|
||||||
|
"rgp_sqtt_marker_user_event doesn't match RGP spec");
|
||||||
|
|
||||||
|
enum rgp_sqtt_marker_user_event_type
|
||||||
|
{
|
||||||
|
UserEventTrigger = 0,
|
||||||
|
UserEventPop,
|
||||||
|
UserEventPush,
|
||||||
|
UserEventObjectName,
|
||||||
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -386,6 +386,9 @@ static void si_emit_string_marker(struct pipe_context *ctx, const char *string,
|
||||||
|
|
||||||
dd_parse_apitrace_marker(string, len, &sctx->apitrace_call_number);
|
dd_parse_apitrace_marker(string, len, &sctx->apitrace_call_number);
|
||||||
|
|
||||||
|
if (sctx->thread_trace_enabled)
|
||||||
|
si_write_user_event(sctx, &sctx->gfx_cs, UserEventTrigger, string, len);
|
||||||
|
|
||||||
if (sctx->log)
|
if (sctx->log)
|
||||||
u_log_printf(sctx->log, "\nString marker: %*s\n", len, string);
|
u_log_printf(sctx->log, "\nString marker: %*s\n", len, string);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1569,6 +1569,10 @@ void
|
||||||
si_write_event_with_dims_marker(struct si_context* sctx, struct radeon_cmdbuf *rcs,
|
si_write_event_with_dims_marker(struct si_context* sctx, struct radeon_cmdbuf *rcs,
|
||||||
enum rgp_sqtt_marker_event_type api_type,
|
enum rgp_sqtt_marker_event_type api_type,
|
||||||
uint32_t x, uint32_t y, uint32_t z);
|
uint32_t x, uint32_t y, uint32_t z);
|
||||||
|
void
|
||||||
|
si_write_user_event(struct si_context* sctx, struct radeon_cmdbuf *rcs,
|
||||||
|
enum rgp_sqtt_marker_user_event_type type,
|
||||||
|
const char *str, int len);
|
||||||
bool si_init_thread_trace(struct si_context *sctx);
|
bool si_init_thread_trace(struct si_context *sctx);
|
||||||
void si_destroy_thread_trace(struct si_context *sctx);
|
void si_destroy_thread_trace(struct si_context *sctx);
|
||||||
void si_handle_thread_trace(struct si_context *sctx, struct radeon_cmdbuf *rcs);
|
void si_handle_thread_trace(struct si_context *sctx, struct radeon_cmdbuf *rcs);
|
||||||
|
|
|
||||||
|
|
@ -750,3 +750,31 @@ si_write_event_with_dims_marker(struct si_context* sctx, struct radeon_cmdbuf *r
|
||||||
si_emit_thread_trace_userdata(sctx, rcs, &marker, sizeof(marker) / 4);
|
si_emit_thread_trace_userdata(sctx, rcs, &marker, sizeof(marker) / 4);
|
||||||
sctx->sqtt_next_event = EventInvalid;
|
sctx->sqtt_next_event = EventInvalid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
si_write_user_event(struct si_context* sctx, struct radeon_cmdbuf *rcs,
|
||||||
|
enum rgp_sqtt_marker_user_event_type type,
|
||||||
|
const char *str, int len)
|
||||||
|
{
|
||||||
|
if (type == UserEventPop) {
|
||||||
|
assert (str == NULL);
|
||||||
|
struct rgp_sqtt_marker_user_event marker = { 0 };
|
||||||
|
marker.identifier = RGP_SQTT_MARKER_IDENTIFIER_USER_EVENT;
|
||||||
|
marker.data_type = type;
|
||||||
|
|
||||||
|
si_emit_thread_trace_userdata(sctx, rcs, &marker, sizeof(marker) / 4);
|
||||||
|
} else {
|
||||||
|
assert (str != NULL);
|
||||||
|
struct rgp_sqtt_marker_user_event_with_length marker = { 0 };
|
||||||
|
marker.user_event.identifier = RGP_SQTT_MARKER_IDENTIFIER_USER_EVENT;
|
||||||
|
marker.user_event.data_type = type;
|
||||||
|
marker.length = align(len, 4);
|
||||||
|
|
||||||
|
uint8_t *buffer = alloca(sizeof(marker) + marker.length);
|
||||||
|
memset(buffer, 0, sizeof(marker) + marker.length);
|
||||||
|
memcpy(buffer, &marker, sizeof(marker));
|
||||||
|
memcpy(buffer + sizeof(marker), str, len);
|
||||||
|
|
||||||
|
si_emit_thread_trace_userdata(sctx, rcs, buffer, sizeof(marker) / 4 + marker.length / 4);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue