1/* Copyright (C) 2020 Google, Inc. 2 * 3 * Permission is hereby granted, free of charge, to any person obtaining a 4 * copy of this software and associated documentation files (the "Software"), 5 * to deal in the Software without restriction, including without limitation 6 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 7 * and/or sell copies of the Software, and to permit persons to whom the 8 * Software is furnished to do so, subject to the following conditions: 9 * 10 * The above copyright notice and this permission notice (including the next 11 * paragraph) shall be included in all copies or substantial portions of the 12 * Software. 13 * 14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 20 * IN THE SOFTWARE. 21 */ 22 23#include "pipe/p_state.h" 24#include "util/format/u_format.h" 25 26#include "u_tracepoints.h" 27 28#define __NEEDS_TRACE_PRIV 29#include "util/perf/u_trace_priv.h" 30 31/* 32 * surface 33 */ 34static void __print_surface(FILE *out, const void *arg) { 35 const struct trace_surface *__entry = 36 (const struct trace_surface *)arg; 37 fprintf(out, "%ux%u@%u, fmt=%s\n" 38 , __entry->width 39 , __entry->height 40 , __entry->nr_samples 41 , __entry->format 42 ); 43} 44static const struct u_tracepoint __tp_surface = { 45 ALIGN_POT(sizeof(struct trace_surface), 8), /* keep size 64b aligned */ 46 "surface", 47 __print_surface, 48}; 49void __trace_surface(struct u_trace *ut, void *cs 50 , const struct pipe_surface * psurf 51) { 52 struct trace_surface *__entry = 53 (struct trace_surface *)u_trace_append(ut, cs, &__tp_surface); 54 (void)__entry; 55 __entry->width = psurf->width; 56 __entry->height = psurf->height; 57 __entry->nr_samples = psurf->nr_samples; 58 __entry->format = util_format_short_name(psurf->format); 59} 60 61/* 62 * framebuffer 63 */ 64static void __print_framebuffer(FILE *out, const void *arg) { 65 const struct trace_framebuffer *__entry = 66 (const struct trace_framebuffer *)arg; 67 fprintf(out, "%ux%ux%u@%u, nr_cbufs: %u\n" 68 , __entry->width 69 , __entry->height 70 , __entry->layers 71 , __entry->samples 72 , __entry->nr_cbufs 73 ); 74} 75static const struct u_tracepoint __tp_framebuffer = { 76 ALIGN_POT(sizeof(struct trace_framebuffer), 8), /* keep size 64b aligned */ 77 "framebuffer", 78 __print_framebuffer, 79}; 80void __trace_framebuffer(struct u_trace *ut, void *cs 81 , const struct pipe_framebuffer_state * pfb 82) { 83 struct trace_framebuffer *__entry = 84 (struct trace_framebuffer *)u_trace_append(ut, cs, &__tp_framebuffer); 85 (void)__entry; 86 __entry->width = pfb->width; 87 __entry->height = pfb->height; 88 __entry->layers = pfb->layers; 89 __entry->samples = pfb->samples; 90 __entry->nr_cbufs = pfb->nr_cbufs; 91} 92 93/* 94 * grid_info 95 */ 96static void __print_grid_info(FILE *out, const void *arg) { 97 const struct trace_grid_info *__entry = 98 (const struct trace_grid_info *)arg; 99 fprintf(out, "work_dim=%u, block=%ux%ux%u, grid=%ux%ux%u\n" 100 , __entry->work_dim 101 , __entry->block_x 102 , __entry->block_y 103 , __entry->block_z 104 , __entry->grid_x 105 , __entry->grid_y 106 , __entry->grid_z 107 ); 108} 109static const struct u_tracepoint __tp_grid_info = { 110 ALIGN_POT(sizeof(struct trace_grid_info), 8), /* keep size 64b aligned */ 111 "grid_info", 112 __print_grid_info, 113}; 114void __trace_grid_info(struct u_trace *ut, void *cs 115 , const struct pipe_grid_info * pgrid 116) { 117 struct trace_grid_info *__entry = 118 (struct trace_grid_info *)u_trace_append(ut, cs, &__tp_grid_info); 119 (void)__entry; 120 __entry->work_dim = pgrid->work_dim; 121 __entry->block_x = pgrid->block[0]; 122 __entry->block_y = pgrid->block[1]; 123 __entry->block_z = pgrid->block[2]; 124 __entry->grid_x = pgrid->grid[0]; 125 __entry->grid_y = pgrid->grid[1]; 126 __entry->grid_z = pgrid->grid[2]; 127} 128 129