Commit 9eb730a7 authored by Joakim Sindholt's avatar Joakim Sindholt

r300g: use util/u_debug

parent 8413b92a
......@@ -22,16 +22,11 @@
#include "r300_context.h"
#include <stdio.h>
#include "util/u_debug.h"
struct debug_option {
const char * name;
unsigned flag;
const char * description;
};
#include <stdio.h>
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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment