1bf215546Sopenharmony_ci# 2bf215546Sopenharmony_ci# Copyright (C) 2020 Google, Inc. 3bf215546Sopenharmony_ci# 4bf215546Sopenharmony_ci# Permission is hereby granted, free of charge, to any person obtaining a 5bf215546Sopenharmony_ci# copy of this software and associated documentation files (the "Software"), 6bf215546Sopenharmony_ci# to deal in the Software without restriction, including without limitation 7bf215546Sopenharmony_ci# the rights to use, copy, modify, merge, publish, distribute, sublicense, 8bf215546Sopenharmony_ci# and/or sell copies of the Software, and to permit persons to whom the 9bf215546Sopenharmony_ci# Software is furnished to do so, subject to the following conditions: 10bf215546Sopenharmony_ci# 11bf215546Sopenharmony_ci# The above copyright notice and this permission notice (including the next 12bf215546Sopenharmony_ci# paragraph) shall be included in all copies or substantial portions of the 13bf215546Sopenharmony_ci# Software. 14bf215546Sopenharmony_ci# 15bf215546Sopenharmony_ci# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16bf215546Sopenharmony_ci# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17bf215546Sopenharmony_ci# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 18bf215546Sopenharmony_ci# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19bf215546Sopenharmony_ci# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 20bf215546Sopenharmony_ci# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 21bf215546Sopenharmony_ci# IN THE SOFTWARE. 22bf215546Sopenharmony_ci# 23bf215546Sopenharmony_ci 24bf215546Sopenharmony_ciimport argparse 25bf215546Sopenharmony_ciimport sys 26bf215546Sopenharmony_ci 27bf215546Sopenharmony_ci# 28bf215546Sopenharmony_ci# TODO can we do this with less boilerplate? 29bf215546Sopenharmony_ci# 30bf215546Sopenharmony_ciparser = argparse.ArgumentParser() 31bf215546Sopenharmony_ciparser.add_argument('-p', '--import-path', required=True) 32bf215546Sopenharmony_ciparser.add_argument('-C', '--src') 33bf215546Sopenharmony_ciparser.add_argument('-H', '--hdr') 34bf215546Sopenharmony_ciargs = parser.parse_args() 35bf215546Sopenharmony_cisys.path.insert(0, args.import_path) 36bf215546Sopenharmony_ci 37bf215546Sopenharmony_ci 38bf215546Sopenharmony_cifrom u_trace import Header 39bf215546Sopenharmony_cifrom u_trace import Tracepoint 40bf215546Sopenharmony_cifrom u_trace import TracepointArg as Arg 41bf215546Sopenharmony_cifrom u_trace import TracepointArgStruct as ArgStruct 42bf215546Sopenharmony_cifrom u_trace import utrace_generate 43bf215546Sopenharmony_ci 44bf215546Sopenharmony_ci# 45bf215546Sopenharmony_ci# Tracepoint definitions: 46bf215546Sopenharmony_ci# 47bf215546Sopenharmony_ci 48bf215546Sopenharmony_ciHeader('pipe/p_state.h') 49bf215546Sopenharmony_ciHeader('util/format/u_format.h') 50bf215546Sopenharmony_ci 51bf215546Sopenharmony_ciTracepoint('surface', 52bf215546Sopenharmony_ci args=[ArgStruct(type='const struct pipe_surface *', var='psurf')], 53bf215546Sopenharmony_ci tp_struct=[Arg(type='uint16_t', name='width', var='psurf->width', c_format='%u'), 54bf215546Sopenharmony_ci Arg(type='uint16_t', name='height', var='psurf->height', c_format='%u'), 55bf215546Sopenharmony_ci Arg(type='uint8_t', name='nr_samples', var='psurf->nr_samples', c_format='%u'), 56bf215546Sopenharmony_ci Arg(type='const char *', name='format', var='util_format_short_name(psurf->format)', c_format='%s')], 57bf215546Sopenharmony_ci tp_print=['%ux%u@%u, fmt=%s', 58bf215546Sopenharmony_ci '__entry->width', 59bf215546Sopenharmony_ci '__entry->height', 60bf215546Sopenharmony_ci '__entry->nr_samples', 61bf215546Sopenharmony_ci '__entry->format'], 62bf215546Sopenharmony_ci) 63bf215546Sopenharmony_ci 64bf215546Sopenharmony_ci# Note: called internally from trace_framebuffer_state() 65bf215546Sopenharmony_ciTracepoint('framebuffer', 66bf215546Sopenharmony_ci args=[ArgStruct(type='const struct pipe_framebuffer_state *', var='pfb')], 67bf215546Sopenharmony_ci tp_struct=[Arg(type='uint16_t', name='width', var='pfb->width', c_format='%u'), 68bf215546Sopenharmony_ci Arg(type='uint16_t', name='height', var='pfb->height', c_format='%u'), 69bf215546Sopenharmony_ci Arg(type='uint8_t', name='layers', var='pfb->layers', c_format='%u'), 70bf215546Sopenharmony_ci Arg(type='uint8_t', name='samples', var='pfb->samples', c_format='%u'), 71bf215546Sopenharmony_ci Arg(type='uint8_t', name='nr_cbufs', var='pfb->nr_cbufs', c_format='%u')], 72bf215546Sopenharmony_ci tp_print=['%ux%ux%u@%u, nr_cbufs: %u', 73bf215546Sopenharmony_ci '__entry->width', 74bf215546Sopenharmony_ci '__entry->height', 75bf215546Sopenharmony_ci '__entry->layers', 76bf215546Sopenharmony_ci '__entry->samples', 77bf215546Sopenharmony_ci '__entry->nr_cbufs'], 78bf215546Sopenharmony_ci) 79bf215546Sopenharmony_ci 80bf215546Sopenharmony_ciTracepoint('grid_info', 81bf215546Sopenharmony_ci args=[ArgStruct(type='const struct pipe_grid_info *', var='pgrid')], 82bf215546Sopenharmony_ci tp_struct=[Arg(type='uint8_t', name='work_dim', var='pgrid->work_dim', c_format='%u'), 83bf215546Sopenharmony_ci Arg(type='uint16_t', name='block_x', var='pgrid->block[0]', c_format='%u'), 84bf215546Sopenharmony_ci Arg(type='uint16_t', name='block_y', var='pgrid->block[1]', c_format='%u'), 85bf215546Sopenharmony_ci Arg(type='uint16_t', name='block_z', var='pgrid->block[2]', c_format='%u'), 86bf215546Sopenharmony_ci Arg(type='uint16_t', name='grid_x', var='pgrid->grid[0]', c_format='%u'), 87bf215546Sopenharmony_ci Arg(type='uint16_t', name='grid_y', var='pgrid->grid[1]', c_format='%u'), 88bf215546Sopenharmony_ci Arg(type='uint16_t', name='grid_z', var='pgrid->grid[2]', c_format='%u')], 89bf215546Sopenharmony_ci tp_print=['work_dim=%u, block=%ux%ux%u, grid=%ux%ux%u', '__entry->work_dim', 90bf215546Sopenharmony_ci '__entry->block_x', '__entry->block_y', '__entry->block_z', 91bf215546Sopenharmony_ci '__entry->grid_x', '__entry->grid_y', '__entry->grid_z'], 92bf215546Sopenharmony_ci) 93bf215546Sopenharmony_ci 94bf215546Sopenharmony_ciutrace_generate(cpath=args.src, hpath=args.hdr, ctx_param='struct pipe_context *pctx') 95