• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright © 2021 Google, Inc.
3  * SPDX-License-Identifier: MIT
4  */
5 
6 #ifndef TU_PERFETTO_H_
7 #define TU_PERFETTO_H_
8 
9 #ifdef HAVE_PERFETTO
10 
11 /* we can't include tu_common.h because ir3 headers are not C++-compatible */
12 #include <stdint.h>
13 
14 #ifdef __cplusplus
15 extern "C" {
16 #endif
17 
18 #define TU_PERFETTO_MAX_STACK_DEPTH 8
19 
20 struct tu_device;
21 struct tu_u_trace_submission_data;
22 
23 struct tu_perfetto_stage {
24    int stage_id;
25    /* dynamically allocated stage iid, for app_events.  0 if stage_id should be
26     * used instead.
27     */
28    uint64_t stage_iid;
29    uint64_t start_ts;
30    const void* payload;
31    void* start_payload_function;
32 };
33 
34 struct tu_perfetto_state {
35    struct tu_perfetto_stage stages[TU_PERFETTO_MAX_STACK_DEPTH];
36    unsigned stage_depth;
37    unsigned skipped_depth;
38 };
39 
40 void tu_perfetto_init(void);
41 
42 struct tu_perfetto_clocks
43 {
44    uint64_t cpu;
45    uint64_t gpu_ts;
46    uint64_t gpu_ts_offset;
47 };
48 
49 struct tu_perfetto_clocks
50 tu_perfetto_submit(struct tu_device *dev,
51                    uint32_t submission_id,
52                    struct tu_perfetto_clocks *clocks);
53 
54 #ifdef __cplusplus
55 }
56 #endif
57 
58 #endif /* HAVE_PERFETTO */
59 
60 #endif /* TU_PERFETTO_H_ */
61