1/* 2 * Copyright © 2015 Intel Corporation 3 * 4 * Permission is hereby granted, free of charge, to any person obtaining a 5 * copy of this software and associated documentation files (the "Software"), 6 * to deal in the Software without restriction, including without limitation 7 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 * and/or sell copies of the Software, and to permit persons to whom the 9 * Software is furnished to do so, subject to the following conditions: 10 * 11 * The above copyright notice and this permission notice (including the next 12 * paragraph) shall be included in all copies or substantial portions of the 13 * Software. 14 * 15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 21 * IN THE SOFTWARE. 22 */ 23 24#include <stdarg.h> 25#include <stdio.h> 26#include <stdlib.h> 27#include <string.h> 28#include <errno.h> 29#include <assert.h> 30 31#include "anv_private.h" 32#include "vk_enum_to_str.h" 33 34void 35__anv_perf_warn(struct anv_device *device, 36 const struct vk_object_base *object, 37 const char *file, int line, const char *format, ...) 38{ 39 va_list ap; 40 char buffer[256]; 41 42 va_start(ap, format); 43 vsnprintf(buffer, sizeof(buffer), format, ap); 44 va_end(ap); 45 46 if (object) { 47 __vk_log(VK_DEBUG_UTILS_MESSAGE_SEVERITY_WARNING_BIT_EXT, 48 VK_DEBUG_UTILS_MESSAGE_TYPE_PERFORMANCE_BIT_EXT, 49 VK_LOG_OBJS(object), file, line, 50 "PERF: %s", buffer); 51 } else { 52 __vk_log(VK_DEBUG_UTILS_MESSAGE_SEVERITY_WARNING_BIT_EXT, 53 VK_DEBUG_UTILS_MESSAGE_TYPE_PERFORMANCE_BIT_EXT, 54 VK_LOG_NO_OBJS(device->physical->instance), file, line, 55 "PERF: %s", buffer); 56 } 57} 58 59void 60anv_dump_pipe_bits(enum anv_pipe_bits bits) 61{ 62 if (bits & ANV_PIPE_DEPTH_CACHE_FLUSH_BIT) 63 fputs("+depth_flush ", stderr); 64 if (bits & ANV_PIPE_DATA_CACHE_FLUSH_BIT) 65 fputs("+dc_flush ", stderr); 66 if (bits & ANV_PIPE_HDC_PIPELINE_FLUSH_BIT) 67 fputs("+hdc_flush ", stderr); 68 if (bits & ANV_PIPE_RENDER_TARGET_CACHE_FLUSH_BIT) 69 fputs("+rt_flush ", stderr); 70 if (bits & ANV_PIPE_TILE_CACHE_FLUSH_BIT) 71 fputs("+tile_flush ", stderr); 72 if (bits & ANV_PIPE_STATE_CACHE_INVALIDATE_BIT) 73 fputs("+state_inval ", stderr); 74 if (bits & ANV_PIPE_CONSTANT_CACHE_INVALIDATE_BIT) 75 fputs("+const_inval ", stderr); 76 if (bits & ANV_PIPE_VF_CACHE_INVALIDATE_BIT) 77 fputs("+vf_inval ", stderr); 78 if (bits & ANV_PIPE_TEXTURE_CACHE_INVALIDATE_BIT) 79 fputs("+tex_inval ", stderr); 80 if (bits & ANV_PIPE_INSTRUCTION_CACHE_INVALIDATE_BIT) 81 fputs("+ic_inval ", stderr); 82 if (bits & ANV_PIPE_STALL_AT_SCOREBOARD_BIT) 83 fputs("+pb_stall ", stderr); 84 if (bits & ANV_PIPE_PSS_STALL_SYNC_BIT) 85 fputs("+pss_stall ", stderr); 86 if (bits & ANV_PIPE_DEPTH_STALL_BIT) 87 fputs("+depth_stall ", stderr); 88 if (bits & ANV_PIPE_CS_STALL_BIT) 89 fputs("+cs_stall ", stderr); 90} 91