Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mesa
Path: blob/21.2-virgl/src/gallium/drivers/freedreno/freedreno_tracepoints.py
4570 views
1
#
2
# Copyright (C) 2020 Google, Inc.
3
#
4
# Permission is hereby granted, free of charge, to any person obtaining a
5
# copy of this software and associated documentation files (the "Software"),
6
# to deal in the Software without restriction, including without limitation
7
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
8
# and/or sell copies of the Software, and to permit persons to whom the
9
# Software is furnished to do so, subject to the following conditions:
10
#
11
# The above copyright notice and this permission notice (including the next
12
# paragraph) shall be included in all copies or substantial portions of the
13
# Software.
14
#
15
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
21
# IN THE SOFTWARE.
22
#
23
24
import argparse
25
import sys
26
27
#
28
# TODO can we do this with less boilerplate?
29
#
30
parser = argparse.ArgumentParser()
31
parser.add_argument('-p', '--import-path', required=True)
32
parser.add_argument('-C', '--src', required=True)
33
parser.add_argument('-H', '--hdr', required=True)
34
args = parser.parse_args()
35
sys.path.insert(0, args.import_path)
36
37
38
from u_trace import Header
39
from u_trace import Tracepoint
40
from u_trace import utrace_generate
41
42
#
43
# Tracepoint definitions:
44
#
45
46
Header('util/u_dump.h')
47
Header('freedreno_batch.h')
48
49
Tracepoint('start_state_restore')
50
Tracepoint('end_state_restore')
51
52
Tracepoint('flush_batch',
53
args=[['struct fd_batch *', 'batch'],
54
['uint16_t', 'cleared'],
55
['uint16_t', 'gmem_reason'],
56
['uint16_t', 'num_draws']],
57
tp_print=['%p: cleared=%x, gmem_reason=%x, num_draws=%u', '__entry->batch',
58
'__entry->cleared', '__entry->gmem_reason', '__entry->num_draws'],
59
)
60
61
Tracepoint('render_gmem',
62
args=[['uint16_t', 'nbins_x'],
63
['uint16_t', 'nbins_y'],
64
['uint16_t', 'bin_w'],
65
['uint16_t', 'bin_h']],
66
tp_print=['%ux%u bins of %ux%u',
67
'__entry->nbins_x', '__entry->nbins_y', '__entry->bin_w', '__entry->bin_h'],
68
)
69
70
Tracepoint('render_sysmem')
71
72
# Note that this doesn't include full information about all of the MRTs
73
# but seems to roughly match what I see with a blob trace
74
Tracepoint('start_render_pass',
75
args=[['uint32_t', 'submit_id'],
76
['enum pipe_format', 'cbuf0_format'],
77
['enum pipe_format', 'zs_format'],
78
['uint16_t', 'width'],
79
['uint16_t', 'height'],
80
['uint8_t', 'mrts'],
81
['uint8_t', 'samples'],
82
['uint16_t', 'nbins'],
83
['uint16_t', 'binw'],
84
['uint16_t', 'binh']],
85
tp_perfetto='fd_start_render_pass'
86
)
87
Tracepoint('end_render_pass',
88
tp_perfetto='fd_end_render_pass')
89
90
Tracepoint('start_binning_ib',
91
tp_perfetto='fd_start_binning_ib')
92
Tracepoint('end_binning_ib',
93
tp_perfetto='fd_end_binning_ib')
94
95
Tracepoint('start_vsc_overflow_test')
96
Tracepoint('end_vsc_overflow_test')
97
98
Tracepoint('start_prologue')
99
Tracepoint('end_prologue')
100
101
# For GMEM pass, where this could either be a clear or resolve
102
Tracepoint('start_clear_restore',
103
args=[['uint16_t', 'fast_cleared']],
104
tp_print=['fast_cleared: 0x%x', '__entry->fast_cleared'],
105
tp_perfetto='fd_start_clear_restore',
106
)
107
Tracepoint('end_clear_restore',
108
tp_perfetto='fd_end_clear_restore')
109
110
Tracepoint('start_resolve',
111
tp_perfetto='fd_start_resolve')
112
Tracepoint('end_resolve',
113
tp_perfetto='fd_end_resolve')
114
115
Tracepoint('start_tile',
116
args=[['uint16_t', 'bin_h'],
117
['uint16_t', 'yoff'],
118
['uint16_t', 'bin_w'],
119
['uint16_t', 'xoff']],
120
tp_print=['bin_h=%d, yoff=%d, bin_w=%d, xoff=%d',
121
'__entry->bin_h', '__entry->yoff', '__entry->bin_w', '__entry->xoff'],
122
)
123
124
Tracepoint('start_draw_ib',
125
tp_perfetto='fd_start_draw_ib')
126
Tracepoint('end_draw_ib',
127
tp_perfetto='fd_end_draw_ib')
128
129
Tracepoint('start_blit',
130
args=[['enum pipe_texture_target', 'src_target'],
131
['enum pipe_texture_target', 'dst_target']],
132
tp_print=['%s -> %s', 'util_str_tex_target(__entry->src_target, true)',
133
'util_str_tex_target(__entry->dst_target, true)'],
134
tp_perfetto='fd_start_blit',
135
)
136
Tracepoint('end_blit',
137
tp_perfetto='fd_end_blit')
138
139
Tracepoint('start_compute',
140
tp_perfetto='fd_start_compute')
141
Tracepoint('end_compute',
142
tp_perfetto='fd_end_compute')
143
144
utrace_generate(cpath=args.src, hpath=args.hdr)
145
146