util/u_trace: add end_of_pipe property to tracepoints

In order to capture the timestamp when things actually end on Intel
GPU HW, we need to know whether the timestamp should be capture at the
top or end of pipeline.

v2: use one line python if/else (Danylo)

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13911>
This commit is contained in:
Lionel Landwerlin 2021-11-22 11:30:50 +02:00 committed by Marge Bot
parent 6f54ebe44f
commit 65697d6141
6 changed files with 11 additions and 5 deletions

View File

@ -1313,7 +1313,7 @@ tu_trace_destroy_ts_buffer(struct u_trace_context *utctx, void *timestamps)
static void
tu_trace_record_ts(struct u_trace *ut, void *cs, void *timestamps,
unsigned idx)
unsigned idx, bool end_of_pipe)
{
struct tu_bo *bo = timestamps;
struct tu_cs *ts_cs = cs;

View File

@ -446,7 +446,7 @@ fd_get_device_reset_status(struct pipe_context *pctx)
static void
fd_trace_record_ts(struct u_trace *ut, void *cs, void *timestamps,
unsigned idx)
unsigned idx, bool end_of_pipe)
{
struct fd_batch *batch = container_of(ut, struct fd_batch, trace);
struct fd_ringbuffer *ring = cs;

View File

@ -566,7 +566,7 @@ u_trace_append(struct u_trace *ut, void *cs, const struct u_tracepoint *tp)
}
/* record a timestamp for the trace: */
ut->utctx->record_timestamp(ut, cs, chunk->timestamps, chunk->num_traces);
ut->utctx->record_timestamp(ut, cs, chunk->timestamps, chunk->num_traces, tp->end_of_pipe);
chunk->traces[chunk->num_traces] = (struct u_trace_event) {
.tp = tp,

View File

@ -99,7 +99,8 @@ typedef void (*u_trace_delete_ts_buffer)(struct u_trace_context *utctx,
* GL_TIMESTAMP queries should be appropriate.
*/
typedef void (*u_trace_record_ts)(struct u_trace *ut, void *cs,
void *timestamps, unsigned idx);
void *timestamps, unsigned idx,
bool end_of_pipe);
/**
* Driver provided callback to read back a previously recorded timestamp.

View File

@ -31,7 +31,9 @@ TRACEPOINTS = {}
class Tracepoint(object):
"""Class that represents all the information about a tracepoint
"""
def __init__(self, name, args=[], tp_struct=None, tp_print=None, tp_perfetto=None):
def __init__(self, name, args=[],
tp_struct=None, tp_print=None, tp_perfetto=None,
end_of_pipe=False):
"""Parameters:
- name: the tracepoint name, a tracepoint function with the given
@ -54,6 +56,7 @@ class Tracepoint(object):
self.tp_struct = tp_struct
self.tp_print = tp_print
self.tp_perfetto = tp_perfetto
self.end_of_pipe = end_of_pipe
TRACEPOINTS[name] = self
@ -296,6 +299,7 @@ static void __print_${trace_name}(FILE *out, const void *arg) {
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"},
__print_${trace_name},
% if trace.tp_perfetto is not None:
#ifdef HAVE_PERFETTO

View File

@ -42,6 +42,7 @@
struct u_tracepoint {
unsigned payload_sz;
const char *name;
bool end_of_pipe;
void (*print)(FILE *out, const void *payload);
#ifdef HAVE_PERFETTO
/**