17ec681f3Smrg# 27ec681f3Smrg# Copyright (C) 2020 Google, Inc. 37ec681f3Smrg# 47ec681f3Smrg# Permission is hereby granted, free of charge, to any person obtaining a 57ec681f3Smrg# copy of this software and associated documentation files (the "Software"), 67ec681f3Smrg# to deal in the Software without restriction, including without limitation 77ec681f3Smrg# the rights to use, copy, modify, merge, publish, distribute, sublicense, 87ec681f3Smrg# and/or sell copies of the Software, and to permit persons to whom the 97ec681f3Smrg# Software is furnished to do so, subject to the following conditions: 107ec681f3Smrg# 117ec681f3Smrg# The above copyright notice and this permission notice (including the next 127ec681f3Smrg# paragraph) shall be included in all copies or substantial portions of the 137ec681f3Smrg# Software. 147ec681f3Smrg# 157ec681f3Smrg# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 167ec681f3Smrg# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 177ec681f3Smrg# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 187ec681f3Smrg# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 197ec681f3Smrg# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 207ec681f3Smrg# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 217ec681f3Smrg# IN THE SOFTWARE. 227ec681f3Smrg# 237ec681f3Smrg 247ec681f3Smrgimport argparse 257ec681f3Smrgimport sys 267ec681f3Smrg 277ec681f3Smrg# 287ec681f3Smrg# TODO can we do this with less boilerplate? 297ec681f3Smrg# 307ec681f3Smrgparser = argparse.ArgumentParser() 317ec681f3Smrgparser.add_argument('-p', '--import-path', required=True) 327ec681f3Smrgparser.add_argument('-C', '--src') 337ec681f3Smrgparser.add_argument('-H', '--hdr') 347ec681f3Smrgargs = parser.parse_args() 357ec681f3Smrgsys.path.insert(0, args.import_path) 367ec681f3Smrg 377ec681f3Smrg 387ec681f3Smrgfrom u_trace import Header 397ec681f3Smrgfrom u_trace import Tracepoint 407ec681f3Smrgfrom u_trace import TracepointArg as Arg 417ec681f3Smrgfrom u_trace import TracepointArgStruct as ArgStruct 427ec681f3Smrgfrom u_trace import utrace_generate 437ec681f3Smrg 447ec681f3Smrg# 457ec681f3Smrg# Tracepoint definitions: 467ec681f3Smrg# 477ec681f3Smrg 487ec681f3SmrgHeader('pipe/p_state.h') 497ec681f3SmrgHeader('util/format/u_format.h') 507ec681f3Smrg 517ec681f3SmrgTracepoint('surface', 527ec681f3Smrg args=[ArgStruct(type='const struct pipe_surface *', var='psurf')], 537ec681f3Smrg tp_struct=[Arg(type='uint16_t', name='width', var='psurf->width', c_format='%u'), 547ec681f3Smrg Arg(type='uint16_t', name='height', var='psurf->height', c_format='%u'), 557ec681f3Smrg Arg(type='uint8_t', name='nr_samples', var='psurf->nr_samples', c_format='%u'), 567ec681f3Smrg Arg(type='const char *', name='format', var='util_format_short_name(psurf->format)', c_format='%s')], 577ec681f3Smrg tp_print=['%ux%u@%u, fmt=%s', 587ec681f3Smrg '__entry->width', 597ec681f3Smrg '__entry->height', 607ec681f3Smrg '__entry->nr_samples', 617ec681f3Smrg '__entry->format'], 627ec681f3Smrg) 637ec681f3Smrg 647ec681f3Smrg# Note: called internally from trace_framebuffer_state() 657ec681f3SmrgTracepoint('framebuffer', 667ec681f3Smrg args=[ArgStruct(type='const struct pipe_framebuffer_state *', var='pfb')], 677ec681f3Smrg tp_struct=[Arg(type='uint16_t', name='width', var='pfb->width', c_format='%u'), 687ec681f3Smrg Arg(type='uint16_t', name='height', var='pfb->height', c_format='%u'), 697ec681f3Smrg Arg(type='uint8_t', name='layers', var='pfb->layers', c_format='%u'), 707ec681f3Smrg Arg(type='uint8_t', name='samples', var='pfb->samples', c_format='%u'), 717ec681f3Smrg Arg(type='uint8_t', name='nr_cbufs', var='pfb->nr_cbufs', c_format='%u')], 727ec681f3Smrg tp_print=['%ux%ux%u@%u, nr_cbufs: %u', 737ec681f3Smrg '__entry->width', 747ec681f3Smrg '__entry->height', 757ec681f3Smrg '__entry->layers', 767ec681f3Smrg '__entry->samples', 777ec681f3Smrg '__entry->nr_cbufs'], 787ec681f3Smrg) 797ec681f3Smrg 807ec681f3SmrgTracepoint('grid_info', 817ec681f3Smrg args=[ArgStruct(type='const struct pipe_grid_info *', var='pgrid')], 827ec681f3Smrg tp_struct=[Arg(type='uint8_t', name='work_dim', var='pgrid->work_dim', c_format='%u'), 837ec681f3Smrg Arg(type='uint16_t', name='block_x', var='pgrid->block[0]', c_format='%u'), 847ec681f3Smrg Arg(type='uint16_t', name='block_y', var='pgrid->block[1]', c_format='%u'), 857ec681f3Smrg Arg(type='uint16_t', name='block_z', var='pgrid->block[2]', c_format='%u'), 867ec681f3Smrg Arg(type='uint16_t', name='grid_x', var='pgrid->grid[0]', c_format='%u'), 877ec681f3Smrg Arg(type='uint16_t', name='grid_y', var='pgrid->grid[1]', c_format='%u'), 887ec681f3Smrg Arg(type='uint16_t', name='grid_z', var='pgrid->grid[2]', c_format='%u')], 897ec681f3Smrg tp_print=['work_dim=%u, block=%ux%ux%u, grid=%ux%ux%u', '__entry->work_dim', 907ec681f3Smrg '__entry->block_x', '__entry->block_y', '__entry->block_z', 917ec681f3Smrg '__entry->grid_x', '__entry->grid_y', '__entry->grid_z'], 927ec681f3Smrg) 937ec681f3Smrg 947ec681f3Smrgutrace_generate(cpath=args.src, hpath=args.hdr, ctx_param='struct pipe_context *pctx') 95