196c5ddc4Srjs/* Copyright (C) 2020 Google, Inc. 296c5ddc4Srjs * 396c5ddc4Srjs * Permission is hereby granted, free of charge, to any person obtaining a 496c5ddc4Srjs * copy of this software and associated documentation files (the "Software"), 596c5ddc4Srjs * to deal in the Software without restriction, including without limitation 696c5ddc4Srjs * the rights to use, copy, modify, merge, publish, distribute, sublicense, 796c5ddc4Srjs * and/or sell copies of the Software, and to permit persons to whom the 896c5ddc4Srjs * Software is furnished to do so, subject to the following conditions: 996c5ddc4Srjs * 1096c5ddc4Srjs * The above copyright notice and this permission notice (including the next 1196c5ddc4Srjs * paragraph) shall be included in all copies or substantial portions of the 1296c5ddc4Srjs * Software. 1396c5ddc4Srjs * 1496c5ddc4Srjs * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 1596c5ddc4Srjs * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 1696c5ddc4Srjs * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 1796c5ddc4Srjs * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 1896c5ddc4Srjs * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 1996c5ddc4Srjs * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 2096c5ddc4Srjs * IN THE SOFTWARE. 2196c5ddc4Srjs */ 2296c5ddc4Srjs 2396c5ddc4Srjs#include "pipe/p_state.h" 2496c5ddc4Srjs#include "util/format/u_format.h" 2596c5ddc4Srjs 2696c5ddc4Srjs#include "u_tracepoints.h" 2796c5ddc4Srjs 2896c5ddc4Srjs#define __NEEDS_TRACE_PRIV 2996c5ddc4Srjs#include "util/perf/u_trace_priv.h" 3096c5ddc4Srjs 3196c5ddc4Srjs/* 3296c5ddc4Srjs * surface 3396c5ddc4Srjs */ 3496c5ddc4Srjsstatic void __print_surface(FILE *out, const void *arg) { 3596c5ddc4Srjs const struct trace_surface *__entry = 3696c5ddc4Srjs (const struct trace_surface *)arg; 3796c5ddc4Srjs fprintf(out, "%ux%u@%u, fmt=%s\n" 3896c5ddc4Srjs , __entry->width 3996c5ddc4Srjs , __entry->height 4096c5ddc4Srjs , __entry->nr_samples 4196c5ddc4Srjs , __entry->format 4296c5ddc4Srjs ); 4396c5ddc4Srjs} 4496c5ddc4Srjsstatic const struct u_tracepoint __tp_surface = { 4596c5ddc4Srjs ALIGN_POT(sizeof(struct trace_surface), 8), /* keep size 64b aligned */ 4696c5ddc4Srjs "surface", 4796c5ddc4Srjs __print_surface, 4896c5ddc4Srjs}; 4996c5ddc4Srjsvoid __trace_surface(struct u_trace *ut, void *cs 5096c5ddc4Srjs , const struct pipe_surface * psurf 5196c5ddc4Srjs) { 5296c5ddc4Srjs struct trace_surface *__entry = 5396c5ddc4Srjs (struct trace_surface *)u_trace_append(ut, cs, &__tp_surface); 5496c5ddc4Srjs (void)__entry; 5596c5ddc4Srjs __entry->width = psurf->width; 5696c5ddc4Srjs __entry->height = psurf->height; 5796c5ddc4Srjs __entry->nr_samples = psurf->nr_samples; 5896c5ddc4Srjs __entry->format = util_format_short_name(psurf->format); 5996c5ddc4Srjs} 6096c5ddc4Srjs 6196c5ddc4Srjs/* 6296c5ddc4Srjs * framebuffer 6396c5ddc4Srjs */ 6496c5ddc4Srjsstatic void __print_framebuffer(FILE *out, const void *arg) { 6596c5ddc4Srjs const struct trace_framebuffer *__entry = 6696c5ddc4Srjs (const struct trace_framebuffer *)arg; 6796c5ddc4Srjs fprintf(out, "%ux%ux%u@%u, nr_cbufs: %u\n" 6896c5ddc4Srjs , __entry->width 6996c5ddc4Srjs , __entry->height 7096c5ddc4Srjs , __entry->layers 7196c5ddc4Srjs , __entry->samples 7296c5ddc4Srjs , __entry->nr_cbufs 7396c5ddc4Srjs ); 7496c5ddc4Srjs} 7596c5ddc4Srjsstatic const struct u_tracepoint __tp_framebuffer = { 7696c5ddc4Srjs ALIGN_POT(sizeof(struct trace_framebuffer), 8), /* keep size 64b aligned */ 7796c5ddc4Srjs "framebuffer", 7896c5ddc4Srjs __print_framebuffer, 7996c5ddc4Srjs}; 8096c5ddc4Srjsvoid __trace_framebuffer(struct u_trace *ut, void *cs 8196c5ddc4Srjs , const struct pipe_framebuffer_state * pfb 8296c5ddc4Srjs) { 8396c5ddc4Srjs struct trace_framebuffer *__entry = 8496c5ddc4Srjs (struct trace_framebuffer *)u_trace_append(ut, cs, &__tp_framebuffer); 8596c5ddc4Srjs (void)__entry; 8696c5ddc4Srjs __entry->width = pfb->width; 8796c5ddc4Srjs __entry->height = pfb->height; 8896c5ddc4Srjs __entry->layers = pfb->layers; 8996c5ddc4Srjs __entry->samples = pfb->samples; 9096c5ddc4Srjs __entry->nr_cbufs = pfb->nr_cbufs; 9196c5ddc4Srjs} 9296c5ddc4Srjs 9396c5ddc4Srjs/* 9496c5ddc4Srjs * grid_info 9596c5ddc4Srjs */ 9696c5ddc4Srjsstatic void __print_grid_info(FILE *out, const void *arg) { 9796c5ddc4Srjs const struct trace_grid_info *__entry = 9896c5ddc4Srjs (const struct trace_grid_info *)arg; 9996c5ddc4Srjs fprintf(out, "work_dim=%u, block=%ux%ux%u, grid=%ux%ux%u\n" 10096c5ddc4Srjs , __entry->work_dim 10196c5ddc4Srjs , __entry->block_x 10296c5ddc4Srjs , __entry->block_y 10396c5ddc4Srjs , __entry->block_z 10496c5ddc4Srjs , __entry->grid_x 10596c5ddc4Srjs , __entry->grid_y 10696c5ddc4Srjs , __entry->grid_z 10796c5ddc4Srjs ); 10896c5ddc4Srjs} 10996c5ddc4Srjsstatic const struct u_tracepoint __tp_grid_info = { 11096c5ddc4Srjs ALIGN_POT(sizeof(struct trace_grid_info), 8), /* keep size 64b aligned */ 11196c5ddc4Srjs "grid_info", 11296c5ddc4Srjs __print_grid_info, 11396c5ddc4Srjs}; 11496c5ddc4Srjsvoid __trace_grid_info(struct u_trace *ut, void *cs 11596c5ddc4Srjs , const struct pipe_grid_info * pgrid 11696c5ddc4Srjs) { 11796c5ddc4Srjs struct trace_grid_info *__entry = 11896c5ddc4Srjs (struct trace_grid_info *)u_trace_append(ut, cs, &__tp_grid_info); 11996c5ddc4Srjs (void)__entry; 12096c5ddc4Srjs __entry->work_dim = pgrid->work_dim; 12196c5ddc4Srjs __entry->block_x = pgrid->block[0]; 12296c5ddc4Srjs __entry->block_y = pgrid->block[1]; 12396c5ddc4Srjs __entry->block_z = pgrid->block[2]; 12496c5ddc4Srjs __entry->grid_x = pgrid->grid[0]; 12596c5ddc4Srjs __entry->grid_y = pgrid->grid[1]; 12696c5ddc4Srjs __entry->grid_z = pgrid->grid[2]; 12796c5ddc4Srjs} 12896c5ddc4Srjs 129