summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/drivers')
-rw-r--r--src/gallium/drivers/r300/r300_debug.c59
1 files changed, 5 insertions, 54 deletions
diff --git a/src/gallium/drivers/r300/r300_debug.c b/src/gallium/drivers/r300/r300_debug.c
index 024731a22ab..297791f3ffe 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 <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)