summaryrefslogtreecommitdiff
path: root/lib/mesa/src/gallium/auxiliary/util/u_tracepoints.py
blob: f8a70d05c0967fae92acc291a60f7884127b4ee8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
#
# Copyright (C) 2020 Google, Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
# and/or sell copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice (including the next
# paragraph) shall be included in all copies or substantial portions of the
# Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
# IN THE SOFTWARE.
#

import argparse
import sys

#
# TODO can we do this with less boilerplate?
#
parser = argparse.ArgumentParser()
parser.add_argument('-p', '--import-path', required=True)
parser.add_argument('-C', '--src')
parser.add_argument('-H', '--hdr')
args = parser.parse_args()
sys.path.insert(0, args.import_path)


from u_trace import Header
from u_trace import Tracepoint
from u_trace import utrace_generate

#
# Tracepoint definitions:
#

Header('pipe/p_state.h')
Header('util/format/u_format.h')

Tracepoint('surface',
    args=[['const struct pipe_surface *', 'psurf']],
    tp_struct=[['uint16_t',     'width',      'psurf->width'],
               ['uint16_t',     'height',     'psurf->height'],
               ['uint8_t',      'nr_samples', 'psurf->nr_samples'],
               ['const char *', 'format',     'util_format_short_name(psurf->format)']],
    tp_print=['%ux%u@%u, fmt=%s',
        '__entry->width',
        '__entry->height',
        '__entry->nr_samples',
        '__entry->format'],
)

# Note: called internally from trace_framebuffer_state()
Tracepoint('framebuffer',
    args=[['const struct pipe_framebuffer_state *', 'pfb']],
    tp_struct=[['uint16_t',     'width',      'pfb->width'],
               ['uint16_t',     'height',     'pfb->height'],
               ['uint8_t',      'layers',     'pfb->layers'],
               ['uint8_t',      'samples',    'pfb->samples'],
               ['uint8_t',      'nr_cbufs',   'pfb->nr_cbufs']],
    tp_print=['%ux%ux%u@%u, nr_cbufs: %u',
        '__entry->width',
        '__entry->height',
        '__entry->layers',
        '__entry->samples',
        '__entry->nr_cbufs'],
)

Tracepoint('grid_info',
    args=[['const struct pipe_grid_info *', 'pgrid']],
    tp_struct=[['uint8_t',  'work_dim',  'pgrid->work_dim'],
               ['uint16_t', 'block_x',   'pgrid->block[0]'],
               ['uint16_t', 'block_y',   'pgrid->block[1]'],
               ['uint16_t', 'block_z',   'pgrid->block[2]'],
               ['uint16_t', 'grid_x',    'pgrid->grid[0]'],
               ['uint16_t', 'grid_y',    'pgrid->grid[1]'],
               ['uint16_t', 'grid_z',    'pgrid->grid[2]']],
    tp_print=['work_dim=%u, block=%ux%ux%u, grid=%ux%ux%u', '__entry->work_dim',
        '__entry->block_x', '__entry->block_y', '__entry->block_z',
        '__entry->grid_x', '__entry->grid_y', '__entry->grid_z'],
)

utrace_generate(cpath=args.src, hpath=args.hdr)