From 9eb730a735842e6631218ff1c57a60a9f1db1251 Mon Sep 17 00:00:00 2001 From: Joakim Sindholt Date: Wed, 2 Jun 2010 20:37:44 +0200 Subject: r300g: use util/u_debug --- src/gallium/drivers/r300/r300_debug.c | 59 +++-------------------------------- 1 file changed, 5 insertions(+), 54 deletions(-) (limited to 'src/gallium/drivers/r300/r300_debug.c') diff --git a/src/gallium/drivers/r300/r300_debug.c b/src/gallium/drivers/r300/r300_debug.c index 024731a22a..297791f3ff 100644 --- a/src/gallium/drivers/r300/r300_debug.c +++ b/src/gallium/drivers/r300/r300_debug.c @@ -22,16 +22,11 @@ #include "r300_context.h" -#include +#include "util/u_debug.h" -struct debug_option { - const char * name; - unsigned flag; - const char * description; -}; +#include -static struct debug_option debug_options[] = { - { "help", DBG_HELP, "Helpful meta-information about the driver" }, +static const struct debug_named_value debug_options[] = { { "fp", DBG_FP, "Fragment program handling (for debugging)" }, { "vp", DBG_VP, "Vertex program handling (for debugging)" }, { "cs", DBG_CS, "Command submissions (for debugging)" }, @@ -46,57 +41,13 @@ static struct debug_option debug_options[] = { { "noimmd", DBG_NO_IMMD, "Disable immediate mode (for benchmarking)" }, { "stats", DBG_STATS, "Gather statistics (for lulz)" }, - { "all", ~0, "Convenience option that enables all debug flags" }, - /* must be last */ - { 0, 0, 0 } + DEBUG_NAMED_VALUE_END }; void r300_init_debug(struct r300_screen * screen) { - const char * options = debug_get_option("RADEON_DEBUG", 0); - boolean printhint = FALSE; - size_t length; - struct debug_option * opt; - - if (options) { - while(*options) { - if (*options == ' ' || *options == ',') { - options++; - continue; - } - - length = strcspn(options, " ,"); - - for(opt = debug_options; opt->name; ++opt) { - if (!strncmp(options, opt->name, length)) { - screen->debug |= opt->flag; - break; - } - } - - if (!opt->name) { - fprintf(stderr, "Unknown debug option: %s\n", options); - printhint = TRUE; - } - - options += length; - } - - if (!screen->debug) - printhint = TRUE; - } - - if (printhint || screen->debug & DBG_HELP) { - fprintf(stderr, "You can enable debug output by setting " - "the RADEON_DEBUG environment variable\n" - "to a comma-separated list of debug options. " - "Available options are:\n"); - - for(opt = debug_options; opt->name; ++opt) { - fprintf(stderr, " %s: %s\n", opt->name, opt->description); - } - } + screen->debug = debug_get_flags_option("RADEON_DEBUG", debug_options, 0); } void r500_dump_rs_block(struct r300_rs_block *rs) -- cgit v1.2.3