1bf215546Sopenharmony_ci/* 2bf215546Sopenharmony_ci * Copyright 2015 Advanced Micro Devices, 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 * on the rights to use, copy, modify, merge, publish, distribute, sub 8bf215546Sopenharmony_ci * license, and/or sell copies of the Software, and to permit persons to whom 9bf215546Sopenharmony_ci * the 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 NON-INFRINGEMENT. IN NO EVENT SHALL 18bf215546Sopenharmony_ci * THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, 19bf215546Sopenharmony_ci * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 20bf215546Sopenharmony_ci * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE 21bf215546Sopenharmony_ci * USE OR OTHER DEALINGS IN THE SOFTWARE. 22bf215546Sopenharmony_ci * 23bf215546Sopenharmony_ci * Authors: 24bf215546Sopenharmony_ci * Marek Olšák <maraeo@gmail.com> 25bf215546Sopenharmony_ci */ 26bf215546Sopenharmony_ci#include "r600_pipe.h" 27bf215546Sopenharmony_ci#include "evergreend.h" 28bf215546Sopenharmony_ci 29bf215546Sopenharmony_ci#include "egd_tables.h" 30bf215546Sopenharmony_ci 31bf215546Sopenharmony_ci#define AC_IS_TRACE_POINT(x) (((x) & 0xcafe0000) == 0xcafe0000) 32bf215546Sopenharmony_ci#define AC_GET_TRACE_POINT_ID(x) ((x) & 0xffff) 33bf215546Sopenharmony_ci 34bf215546Sopenharmony_ci/* Parsed IBs are difficult to read without colors. Use "less -R file" to 35bf215546Sopenharmony_ci * read them, or use "aha -b -f file" to convert them to html. 36bf215546Sopenharmony_ci */ 37bf215546Sopenharmony_ci#define COLOR_RESET "\033[0m" 38bf215546Sopenharmony_ci#define COLOR_RED "\033[31m" 39bf215546Sopenharmony_ci#define COLOR_GREEN "\033[1;32m" 40bf215546Sopenharmony_ci#define COLOR_YELLOW "\033[1;33m" 41bf215546Sopenharmony_ci#define COLOR_CYAN "\033[1;36m" 42bf215546Sopenharmony_ci 43bf215546Sopenharmony_ci#define INDENT_PKT 8 44bf215546Sopenharmony_ci 45bf215546Sopenharmony_citypedef void *(*ac_debug_addr_callback)(void *data, uint64_t addr); 46bf215546Sopenharmony_cistatic void print_spaces(FILE *f, unsigned num) 47bf215546Sopenharmony_ci{ 48bf215546Sopenharmony_ci fprintf(f, "%*s", num, ""); 49bf215546Sopenharmony_ci} 50bf215546Sopenharmony_ci 51bf215546Sopenharmony_cistatic void print_value(FILE *file, uint32_t value, int bits) 52bf215546Sopenharmony_ci{ 53bf215546Sopenharmony_ci /* Guess if it's int or float */ 54bf215546Sopenharmony_ci if (value <= (1 << 15)) { 55bf215546Sopenharmony_ci if (value <= 9) 56bf215546Sopenharmony_ci fprintf(file, "%u\n", value); 57bf215546Sopenharmony_ci else 58bf215546Sopenharmony_ci fprintf(file, "%u (0x%0*x)\n", value, bits / 4, value); 59bf215546Sopenharmony_ci } else { 60bf215546Sopenharmony_ci float f = uif(value); 61bf215546Sopenharmony_ci 62bf215546Sopenharmony_ci if (fabs(f) < 100000 && f*10 == floor(f*10)) 63bf215546Sopenharmony_ci fprintf(file, "%.1ff (0x%0*x)\n", f, bits / 4, value); 64bf215546Sopenharmony_ci else 65bf215546Sopenharmony_ci /* Don't print more leading zeros than there are bits. */ 66bf215546Sopenharmony_ci fprintf(file, "0x%0*x\n", bits / 4, value); 67bf215546Sopenharmony_ci } 68bf215546Sopenharmony_ci} 69bf215546Sopenharmony_ci 70bf215546Sopenharmony_cistatic void print_named_value(FILE *file, const char *name, uint32_t value, 71bf215546Sopenharmony_ci int bits) 72bf215546Sopenharmony_ci{ 73bf215546Sopenharmony_ci print_spaces(file, INDENT_PKT); 74bf215546Sopenharmony_ci fprintf(file, COLOR_YELLOW "%s" COLOR_RESET " <- ", name); 75bf215546Sopenharmony_ci print_value(file, value, bits); 76bf215546Sopenharmony_ci} 77bf215546Sopenharmony_ci 78bf215546Sopenharmony_cistatic void eg_dump_reg(FILE *file, unsigned offset, uint32_t value, 79bf215546Sopenharmony_ci uint32_t field_mask) 80bf215546Sopenharmony_ci{ 81bf215546Sopenharmony_ci unsigned r, f; 82bf215546Sopenharmony_ci 83bf215546Sopenharmony_ci for (r = 0; r < ARRAY_SIZE(egd_reg_table); r++) { 84bf215546Sopenharmony_ci const struct eg_reg *reg = &egd_reg_table[r]; 85bf215546Sopenharmony_ci const char *reg_name = egd_strings + reg->name_offset; 86bf215546Sopenharmony_ci 87bf215546Sopenharmony_ci if (reg->offset == offset) { 88bf215546Sopenharmony_ci bool first_field = true; 89bf215546Sopenharmony_ci 90bf215546Sopenharmony_ci print_spaces(file, INDENT_PKT); 91bf215546Sopenharmony_ci fprintf(file, COLOR_YELLOW "%s" COLOR_RESET " <- ", 92bf215546Sopenharmony_ci reg_name); 93bf215546Sopenharmony_ci 94bf215546Sopenharmony_ci if (!reg->num_fields) { 95bf215546Sopenharmony_ci print_value(file, value, 32); 96bf215546Sopenharmony_ci return; 97bf215546Sopenharmony_ci } 98bf215546Sopenharmony_ci 99bf215546Sopenharmony_ci for (f = 0; f < reg->num_fields; f++) { 100bf215546Sopenharmony_ci const struct eg_field *field = egd_fields_table + reg->fields_offset + f; 101bf215546Sopenharmony_ci const int *values_offsets = egd_strings_offsets + field->values_offset; 102bf215546Sopenharmony_ci uint32_t val = (value & field->mask) >> 103bf215546Sopenharmony_ci (ffs(field->mask) - 1); 104bf215546Sopenharmony_ci 105bf215546Sopenharmony_ci if (!(field->mask & field_mask)) 106bf215546Sopenharmony_ci continue; 107bf215546Sopenharmony_ci 108bf215546Sopenharmony_ci /* Indent the field. */ 109bf215546Sopenharmony_ci if (!first_field) 110bf215546Sopenharmony_ci print_spaces(file, 111bf215546Sopenharmony_ci INDENT_PKT + strlen(reg_name) + 4); 112bf215546Sopenharmony_ci 113bf215546Sopenharmony_ci /* Print the field. */ 114bf215546Sopenharmony_ci fprintf(file, "%s = ", egd_strings + field->name_offset); 115bf215546Sopenharmony_ci 116bf215546Sopenharmony_ci if (val < field->num_values && values_offsets[val] >= 0) 117bf215546Sopenharmony_ci fprintf(file, "%s\n", egd_strings + values_offsets[val]); 118bf215546Sopenharmony_ci else 119bf215546Sopenharmony_ci print_value(file, val, 120bf215546Sopenharmony_ci util_bitcount(field->mask)); 121bf215546Sopenharmony_ci 122bf215546Sopenharmony_ci first_field = false; 123bf215546Sopenharmony_ci } 124bf215546Sopenharmony_ci return; 125bf215546Sopenharmony_ci } 126bf215546Sopenharmony_ci } 127bf215546Sopenharmony_ci 128bf215546Sopenharmony_ci print_spaces(file, INDENT_PKT); 129bf215546Sopenharmony_ci fprintf(file, COLOR_YELLOW "0x%05x" COLOR_RESET " <- 0x%08x\n", offset, value); 130bf215546Sopenharmony_ci} 131bf215546Sopenharmony_ci 132bf215546Sopenharmony_ci 133bf215546Sopenharmony_cistatic void ac_parse_set_reg_packet(FILE *f, uint32_t *ib, unsigned count, 134bf215546Sopenharmony_ci unsigned reg_offset) 135bf215546Sopenharmony_ci{ 136bf215546Sopenharmony_ci unsigned reg = (ib[1] << 2) + reg_offset; 137bf215546Sopenharmony_ci unsigned i; 138bf215546Sopenharmony_ci 139bf215546Sopenharmony_ci for (i = 0; i < count; i++) 140bf215546Sopenharmony_ci eg_dump_reg(f, reg + i*4, ib[2+i], ~0); 141bf215546Sopenharmony_ci} 142bf215546Sopenharmony_ci 143bf215546Sopenharmony_cistatic uint32_t *ac_parse_packet3(FILE *f, uint32_t *ib, int *num_dw, 144bf215546Sopenharmony_ci int trace_id, enum amd_gfx_level gfx_level, 145bf215546Sopenharmony_ci ac_debug_addr_callback addr_callback, 146bf215546Sopenharmony_ci void *addr_callback_data) 147bf215546Sopenharmony_ci{ 148bf215546Sopenharmony_ci unsigned count = PKT_COUNT_G(ib[0]); 149bf215546Sopenharmony_ci unsigned op = PKT3_IT_OPCODE_G(ib[0]); 150bf215546Sopenharmony_ci const char *predicate = PKT3_PREDICATE(ib[0]) ? "(predicate)" : ""; 151bf215546Sopenharmony_ci const char *compute_mode = (ib[0] & 0x2) ? "(C)" : ""; 152bf215546Sopenharmony_ci unsigned i; 153bf215546Sopenharmony_ci 154bf215546Sopenharmony_ci /* Print the name first. */ 155bf215546Sopenharmony_ci for (i = 0; i < ARRAY_SIZE(packet3_table); i++) 156bf215546Sopenharmony_ci if (packet3_table[i].op == op) 157bf215546Sopenharmony_ci break; 158bf215546Sopenharmony_ci 159bf215546Sopenharmony_ci if (i < ARRAY_SIZE(packet3_table)) { 160bf215546Sopenharmony_ci const char *name = egd_strings + packet3_table[i].name_offset; 161bf215546Sopenharmony_ci 162bf215546Sopenharmony_ci if (op == PKT3_SET_CONTEXT_REG || 163bf215546Sopenharmony_ci op == PKT3_SET_CONFIG_REG || 164bf215546Sopenharmony_ci op == PKT3_SET_UCONFIG_REG || 165bf215546Sopenharmony_ci op == PKT3_SET_SH_REG) 166bf215546Sopenharmony_ci fprintf(f, COLOR_CYAN "%s%s%s" COLOR_CYAN ":\n", 167bf215546Sopenharmony_ci name, compute_mode, predicate); 168bf215546Sopenharmony_ci else 169bf215546Sopenharmony_ci fprintf(f, COLOR_GREEN "%s%s%s" COLOR_RESET ":\n", 170bf215546Sopenharmony_ci name, compute_mode, predicate); 171bf215546Sopenharmony_ci } else 172bf215546Sopenharmony_ci fprintf(f, COLOR_RED "PKT3_UNKNOWN 0x%x%s%s" COLOR_RESET ":\n", 173bf215546Sopenharmony_ci op, compute_mode, predicate); 174bf215546Sopenharmony_ci 175bf215546Sopenharmony_ci /* Print the contents. */ 176bf215546Sopenharmony_ci switch (op) { 177bf215546Sopenharmony_ci case PKT3_SET_CONTEXT_REG: 178bf215546Sopenharmony_ci ac_parse_set_reg_packet(f, ib, count, EVERGREEN_CONTEXT_REG_OFFSET); 179bf215546Sopenharmony_ci break; 180bf215546Sopenharmony_ci case PKT3_SET_CONFIG_REG: 181bf215546Sopenharmony_ci ac_parse_set_reg_packet(f, ib, count, EVERGREEN_CONFIG_REG_OFFSET); 182bf215546Sopenharmony_ci break; 183bf215546Sopenharmony_ci case PKT3_SURFACE_SYNC: 184bf215546Sopenharmony_ci eg_dump_reg(f, R_0085F0_CP_COHER_CNTL, ib[1], ~0); 185bf215546Sopenharmony_ci eg_dump_reg(f, R_0085F4_CP_COHER_SIZE, ib[2], ~0); 186bf215546Sopenharmony_ci eg_dump_reg(f, R_0085F8_CP_COHER_BASE, ib[3], ~0); 187bf215546Sopenharmony_ci print_named_value(f, "POLL_INTERVAL", ib[4], 16); 188bf215546Sopenharmony_ci break; 189bf215546Sopenharmony_ci case PKT3_EVENT_WRITE: 190bf215546Sopenharmony_ci /* TODO dump VGT_EVENT_INITIATOR */ 191bf215546Sopenharmony_ci#if 0 192bf215546Sopenharmony_ci eg_dump_reg(f, R_028A90_VGT_EVENT_INITIATOR, ib[1], 193bf215546Sopenharmony_ci S_028A90_EVENT_TYPE(~0)); 194bf215546Sopenharmony_ci#endif 195bf215546Sopenharmony_ci print_named_value(f, "EVENT_TYPE", ib[1] & 0xff, 8); 196bf215546Sopenharmony_ci print_named_value(f, "EVENT_INDEX", (ib[1] >> 8) & 0xf, 4); 197bf215546Sopenharmony_ci print_named_value(f, "INV_L2", (ib[1] >> 20) & 0x1, 1); 198bf215546Sopenharmony_ci if (count > 0) { 199bf215546Sopenharmony_ci print_named_value(f, "ADDRESS_LO", ib[2], 32); 200bf215546Sopenharmony_ci print_named_value(f, "ADDRESS_HI", ib[3], 16); 201bf215546Sopenharmony_ci } 202bf215546Sopenharmony_ci break; 203bf215546Sopenharmony_ci case PKT3_DRAW_INDEX_AUTO: 204bf215546Sopenharmony_ci eg_dump_reg(f, R_008970_VGT_NUM_INDICES, ib[1], ~0); 205bf215546Sopenharmony_ci eg_dump_reg(f, R_0287F0_VGT_DRAW_INITIATOR, ib[2], ~0); 206bf215546Sopenharmony_ci break; 207bf215546Sopenharmony_ci case PKT3_DRAW_INDEX_2: 208bf215546Sopenharmony_ci eg_dump_reg(f, R_028A78_VGT_DMA_MAX_SIZE, ib[1], ~0); 209bf215546Sopenharmony_ci eg_dump_reg(f, R_0287E8_VGT_DMA_BASE, ib[2], ~0); 210bf215546Sopenharmony_ci eg_dump_reg(f, R_0287E4_VGT_DMA_BASE_HI, ib[3], ~0); 211bf215546Sopenharmony_ci eg_dump_reg(f, R_008970_VGT_NUM_INDICES, ib[4], ~0); 212bf215546Sopenharmony_ci eg_dump_reg(f, R_0287F0_VGT_DRAW_INITIATOR, ib[5], ~0); 213bf215546Sopenharmony_ci break; 214bf215546Sopenharmony_ci case PKT3_INDEX_TYPE: 215bf215546Sopenharmony_ci eg_dump_reg(f, R_028A7C_VGT_DMA_INDEX_TYPE, ib[1], ~0); 216bf215546Sopenharmony_ci break; 217bf215546Sopenharmony_ci case PKT3_NUM_INSTANCES: 218bf215546Sopenharmony_ci eg_dump_reg(f, R_028A88_VGT_NUM_INSTANCES, ib[1], ~0); 219bf215546Sopenharmony_ci break; 220bf215546Sopenharmony_ci case PKT3_INDIRECT_BUFFER: 221bf215546Sopenharmony_ci break; 222bf215546Sopenharmony_ci case PKT3_PFP_SYNC_ME: 223bf215546Sopenharmony_ci break; 224bf215546Sopenharmony_ci case PKT3_NOP: 225bf215546Sopenharmony_ci if (ib[0] == 0xffff1000) { 226bf215546Sopenharmony_ci count = -1; /* One dword NOP. */ 227bf215546Sopenharmony_ci break; 228bf215546Sopenharmony_ci } else if (count == 0 && AC_IS_TRACE_POINT(ib[1])) { 229bf215546Sopenharmony_ci unsigned packet_id = AC_GET_TRACE_POINT_ID(ib[1]); 230bf215546Sopenharmony_ci 231bf215546Sopenharmony_ci print_spaces(f, INDENT_PKT); 232bf215546Sopenharmony_ci fprintf(f, COLOR_RED "Trace point ID: %u\n", packet_id); 233bf215546Sopenharmony_ci 234bf215546Sopenharmony_ci if (trace_id == -1) 235bf215546Sopenharmony_ci break; /* tracing was disabled */ 236bf215546Sopenharmony_ci 237bf215546Sopenharmony_ci print_spaces(f, INDENT_PKT); 238bf215546Sopenharmony_ci if (packet_id < trace_id) 239bf215546Sopenharmony_ci fprintf(f, COLOR_RED 240bf215546Sopenharmony_ci "This trace point was reached by the CP." 241bf215546Sopenharmony_ci COLOR_RESET "\n"); 242bf215546Sopenharmony_ci else if (packet_id == trace_id) 243bf215546Sopenharmony_ci fprintf(f, COLOR_RED 244bf215546Sopenharmony_ci "!!!!! This is the last trace point that " 245bf215546Sopenharmony_ci "was reached by the CP !!!!!" 246bf215546Sopenharmony_ci COLOR_RESET "\n"); 247bf215546Sopenharmony_ci else if (packet_id+1 == trace_id) 248bf215546Sopenharmony_ci fprintf(f, COLOR_RED 249bf215546Sopenharmony_ci "!!!!! This is the first trace point that " 250bf215546Sopenharmony_ci "was NOT been reached by the CP !!!!!" 251bf215546Sopenharmony_ci COLOR_RESET "\n"); 252bf215546Sopenharmony_ci else 253bf215546Sopenharmony_ci fprintf(f, COLOR_RED 254bf215546Sopenharmony_ci "!!!!! This trace point was NOT reached " 255bf215546Sopenharmony_ci "by the CP !!!!!" 256bf215546Sopenharmony_ci COLOR_RESET "\n"); 257bf215546Sopenharmony_ci break; 258bf215546Sopenharmony_ci } 259bf215546Sopenharmony_ci FALLTHROUGH; /* print all dwords */ 260bf215546Sopenharmony_ci default: 261bf215546Sopenharmony_ci for (i = 0; i < count+1; i++) { 262bf215546Sopenharmony_ci print_spaces(f, INDENT_PKT); 263bf215546Sopenharmony_ci fprintf(f, "0x%08x\n", ib[1+i]); 264bf215546Sopenharmony_ci } 265bf215546Sopenharmony_ci } 266bf215546Sopenharmony_ci 267bf215546Sopenharmony_ci ib += count + 2; 268bf215546Sopenharmony_ci *num_dw -= count + 2; 269bf215546Sopenharmony_ci return ib; 270bf215546Sopenharmony_ci} 271bf215546Sopenharmony_ci 272bf215546Sopenharmony_ci/** 273bf215546Sopenharmony_ci * Parse and print an IB into a file. 274bf215546Sopenharmony_ci * 275bf215546Sopenharmony_ci * \param f file 276bf215546Sopenharmony_ci * \param ib IB 277bf215546Sopenharmony_ci * \param num_dw size of the IB 278bf215546Sopenharmony_ci * \param gfx_level gfx level 279bf215546Sopenharmony_ci * \param trace_id the last trace ID that is known to have been reached 280bf215546Sopenharmony_ci * and executed by the CP, typically read from a buffer 281bf215546Sopenharmony_ci * \param addr_callback Get a mapped pointer of the IB at a given address. Can 282bf215546Sopenharmony_ci * be NULL. 283bf215546Sopenharmony_ci * \param addr_callback_data user data for addr_callback 284bf215546Sopenharmony_ci */ 285bf215546Sopenharmony_cistatic void eg_parse_ib(FILE *f, uint32_t *ib, int num_dw, int trace_id, 286bf215546Sopenharmony_ci const char *name, enum amd_gfx_level gfx_level, 287bf215546Sopenharmony_ci ac_debug_addr_callback addr_callback, void *addr_callback_data) 288bf215546Sopenharmony_ci{ 289bf215546Sopenharmony_ci fprintf(f, "------------------ %s begin ------------------\n", name); 290bf215546Sopenharmony_ci 291bf215546Sopenharmony_ci while (num_dw > 0) { 292bf215546Sopenharmony_ci unsigned type = PKT_TYPE_G(ib[0]); 293bf215546Sopenharmony_ci 294bf215546Sopenharmony_ci switch (type) { 295bf215546Sopenharmony_ci case 3: 296bf215546Sopenharmony_ci ib = ac_parse_packet3(f, ib, &num_dw, trace_id, 297bf215546Sopenharmony_ci gfx_level, addr_callback, 298bf215546Sopenharmony_ci addr_callback_data); 299bf215546Sopenharmony_ci break; 300bf215546Sopenharmony_ci case 2: 301bf215546Sopenharmony_ci /* type-2 nop */ 302bf215546Sopenharmony_ci if (ib[0] == 0x80000000) { 303bf215546Sopenharmony_ci fprintf(f, COLOR_GREEN "NOP (type 2)" COLOR_RESET "\n"); 304bf215546Sopenharmony_ci ib++; 305bf215546Sopenharmony_ci num_dw--; 306bf215546Sopenharmony_ci break; 307bf215546Sopenharmony_ci } 308bf215546Sopenharmony_ci FALLTHROUGH; 309bf215546Sopenharmony_ci default: 310bf215546Sopenharmony_ci fprintf(f, "Unknown packet type %i\n", type); 311bf215546Sopenharmony_ci return; 312bf215546Sopenharmony_ci } 313bf215546Sopenharmony_ci } 314bf215546Sopenharmony_ci 315bf215546Sopenharmony_ci fprintf(f, "------------------- %s end -------------------\n", name); 316bf215546Sopenharmony_ci if (num_dw < 0) { 317bf215546Sopenharmony_ci printf("Packet ends after the end of IB.\n"); 318bf215546Sopenharmony_ci exit(0); 319bf215546Sopenharmony_ci } 320bf215546Sopenharmony_ci fprintf(f, "\n"); 321bf215546Sopenharmony_ci} 322bf215546Sopenharmony_ci 323bf215546Sopenharmony_cistatic void eg_dump_last_ib(struct r600_context *rctx, FILE *f) 324bf215546Sopenharmony_ci{ 325bf215546Sopenharmony_ci int last_trace_id = -1; 326bf215546Sopenharmony_ci 327bf215546Sopenharmony_ci if (!rctx->last_gfx.ib) 328bf215546Sopenharmony_ci return; 329bf215546Sopenharmony_ci 330bf215546Sopenharmony_ci if (rctx->last_trace_buf) { 331bf215546Sopenharmony_ci /* We are expecting that the ddebug pipe has already 332bf215546Sopenharmony_ci * waited for the context, so this buffer should be idle. 333bf215546Sopenharmony_ci * If the GPU is hung, there is no point in waiting for it. 334bf215546Sopenharmony_ci */ 335bf215546Sopenharmony_ci uint32_t *map = rctx->b.ws->buffer_map(rctx->b.ws, rctx->last_trace_buf->buf, 336bf215546Sopenharmony_ci NULL, 337bf215546Sopenharmony_ci PIPE_MAP_UNSYNCHRONIZED | 338bf215546Sopenharmony_ci PIPE_MAP_READ); 339bf215546Sopenharmony_ci if (map) 340bf215546Sopenharmony_ci last_trace_id = *map; 341bf215546Sopenharmony_ci } 342bf215546Sopenharmony_ci 343bf215546Sopenharmony_ci eg_parse_ib(f, rctx->last_gfx.ib, rctx->last_gfx.num_dw, 344bf215546Sopenharmony_ci last_trace_id, "IB", rctx->b.gfx_level, 345bf215546Sopenharmony_ci NULL, NULL); 346bf215546Sopenharmony_ci} 347bf215546Sopenharmony_ci 348bf215546Sopenharmony_ci 349bf215546Sopenharmony_civoid eg_dump_debug_state(struct pipe_context *ctx, FILE *f, 350bf215546Sopenharmony_ci unsigned flags) 351bf215546Sopenharmony_ci{ 352bf215546Sopenharmony_ci struct r600_context *rctx = (struct r600_context*)ctx; 353bf215546Sopenharmony_ci 354bf215546Sopenharmony_ci eg_dump_last_ib(rctx, f); 355bf215546Sopenharmony_ci 356bf215546Sopenharmony_ci fprintf(f, "Done.\n"); 357bf215546Sopenharmony_ci 358bf215546Sopenharmony_ci /* dump only once */ 359bf215546Sopenharmony_ci radeon_clear_saved_cs(&rctx->last_gfx); 360bf215546Sopenharmony_ci r600_resource_reference(&rctx->last_trace_buf, NULL); 361bf215546Sopenharmony_ci} 362