Path: blob/21.2-virgl/src/gallium/drivers/r300/r300_debug.c
4570 views
/*1* Copyright 2009 Nicolai Haehnle <[email protected]>2*3* Permission is hereby granted, free of charge, to any person obtaining a4* copy of this software and associated documentation files (the "Software"),5* to deal in the Software without restriction, including without limitation6* on the rights to use, copy, modify, merge, publish, distribute, sub7* license, and/or sell copies of the Software, and to permit persons to whom8* the Software is furnished to do so, subject to the following conditions:9*10* The above copyright notice and this permission notice (including the next11* paragraph) shall be included in all copies or substantial portions of the12* Software.13*14* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR15* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,16* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL17* THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,18* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR19* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE20* USE OR OTHER DEALINGS IN THE SOFTWARE. */2122#include "r300_context.h"2324#include "util/u_debug.h"2526#include <stdio.h>2728static const struct debug_named_value r300_debug_options[] = {29{ "info", DBG_INFO, "Print hardware info (printed by default on debug builds"},30{ "fp", DBG_FP, "Log fragment program compilation" },31{ "vp", DBG_VP, "Log vertex program compilation" },32{ "pstat", DBG_P_STAT, "Log vertex/fragment program stats" },33{ "draw", DBG_DRAW, "Log draw calls" },34{ "swtcl", DBG_SWTCL, "Log SWTCL-specific info" },35{ "rsblock", DBG_RS_BLOCK, "Log rasterizer registers" },36{ "psc", DBG_PSC, "Log vertex stream registers" },37{ "tex", DBG_TEX, "Log basic info about textures" },38{ "texalloc", DBG_TEXALLOC, "Log texture mipmap tree info" },39{ "rs", DBG_RS, "Log rasterizer" },40{ "fb", DBG_FB, "Log framebuffer" },41{ "cbzb", DBG_CBZB, "Log fast color clear info" },42{ "hyperz", DBG_HYPERZ, "Log HyperZ info" },43{ "scissor", DBG_SCISSOR, "Log scissor info" },44{ "msaa", DBG_MSAA, "Log MSAA resources"},45{ "anisohq", DBG_ANISOHQ, "Use high quality anisotropic filtering" },46{ "notiling", DBG_NO_TILING, "Disable tiling" },47{ "noimmd", DBG_NO_IMMD, "Disable immediate mode" },48{ "noopt", DBG_NO_OPT, "Disable shader optimizations" },49{ "nocbzb", DBG_NO_CBZB, "Disable fast color clear" },50{ "nozmask", DBG_NO_ZMASK, "Disable zbuffer compression" },51{ "nohiz", DBG_NO_HIZ, "Disable hierarchical zbuffer" },52{ "nocmask", DBG_NO_CMASK, "Disable AA compression and fast AA clear" },5354/* must be last */55DEBUG_NAMED_VALUE_END56};5758void r300_init_debug(struct r300_screen * screen)59{60screen->debug = debug_get_flags_option("RADEON_DEBUG", r300_debug_options, 0);61}6263void r500_dump_rs_block(struct r300_rs_block *rs)64{65unsigned count, ip, it_count, ic_count, i, j;66unsigned tex_ptr;67unsigned col_ptr, col_fmt;6869count = rs->inst_count & 0xf;70count++;7172it_count = rs->count & 0x7f;73ic_count = (rs->count >> 7) & 0xf;7475fprintf(stderr, "RS Block: %d texcoords (linear), %d colors (perspective)\n",76it_count, ic_count);77fprintf(stderr, "%d instructions\n", count);7879for (i = 0; i < count; i++) {80if (rs->inst[i] & 0x10) {81ip = rs->inst[i] & 0xf;82fprintf(stderr, "texture: ip %d to psf %d\n",83ip, (rs->inst[i] >> 5) & 0x7f);8485tex_ptr = rs->ip[ip] & 0xffffff;86fprintf(stderr, " : ");8788j = 3;89do {90if ((tex_ptr & 0x3f) == 63) {91fprintf(stderr, "1.0");92} else if ((tex_ptr & 0x3f) == 62) {93fprintf(stderr, "0.0");94} else {95fprintf(stderr, "[%d]", tex_ptr & 0x3f);96}97} while (j-- && fprintf(stderr, "/"));98fprintf(stderr, "\n");99}100101if (rs->inst[i] & 0x10000) {102ip = (rs->inst[i] >> 12) & 0xf;103fprintf(stderr, "color: ip %d to psf %d\n",104ip, (rs->inst[i] >> 18) & 0x7f);105106col_ptr = (rs->ip[ip] >> 24) & 0x7;107col_fmt = (rs->ip[ip] >> 27) & 0xf;108fprintf(stderr, " : offset %d ", col_ptr);109110switch (col_fmt) {111case 0:112fprintf(stderr, "(R/G/B/A)");113break;114case 1:115fprintf(stderr, "(R/G/B/0)");116break;117case 2:118fprintf(stderr, "(R/G/B/1)");119break;120case 4:121fprintf(stderr, "(0/0/0/A)");122break;123case 5:124fprintf(stderr, "(0/0/0/0)");125break;126case 6:127fprintf(stderr, "(0/0/0/1)");128break;129case 8:130fprintf(stderr, "(1/1/1/A)");131break;132case 9:133fprintf(stderr, "(1/1/1/0)");134break;135case 10:136fprintf(stderr, "(1/1/1/1)");137break;138}139fprintf(stderr, "\n");140}141}142}143144145