radeon: Fix multiple definition error with radeon_debug
authorTimur Kristóf <timur.kristof@gmail.com>
Tue, 21 Jan 2020 15:36:54 +0000 (16:36 +0100)
committerTimur Kristóf <timur.kristof@gmail.com>
Wed, 22 Jan 2020 08:36:28 +0000 (09:36 +0100)
Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3488>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3488>

src/mesa/drivers/dri/radeon/radeon_debug.c
src/mesa/drivers/dri/radeon/radeon_debug.h

index 91f86a96b5259e273515d332f2799855e8269991..4ac974473e26aa248c8c02bad450c091a8755fdc 100644 (file)
@@ -57,13 +57,17 @@ static const struct debug_control debug_control[] = {
        {NULL, 0}
 };
 
-radeon_debug_type_t radeon_enabled_debug_types;
+#if defined(RADEON_R200)
+radeon_debug_type_t r200_enabled_debug_types;
+#elif defined(RADEON_R100)
+radeon_debug_type_t r100_enabled_debug_types;
+#endif
 
 void radeon_init_debug(void)
 {
-       radeon_enabled_debug_types = parse_debug_string(getenv("RADEON_DEBUG"), debug_control);
+       RADEON_DEBUG = parse_debug_string(getenv("RADEON_DEBUG"), debug_control);
 
-       radeon_enabled_debug_types |= RADEON_GENERAL;
+       RADEON_DEBUG |= RADEON_GENERAL;
 }
 
 void _radeon_debug_add_indent(void)
index df2f1abfbf2470c10aeab3bfdb137f4fa2c87f21..8f56ec6769b710210742436c8053966ca0feb76f 100644 (file)
@@ -81,18 +81,24 @@ struct radeon_debug {
        char indent[RADEON_MAX_INDENT];
 };
 
-extern radeon_debug_type_t radeon_enabled_debug_types;
-
 /**
  * Compabibility layer for old debug code
  **/
-#define RADEON_DEBUG radeon_enabled_debug_types
+#if defined(RADEON_R200)
+extern radeon_debug_type_t r200_enabled_debug_types;
+#define RADEON_DEBUG r200_enabled_debug_types
+#elif defined(RADEON_R100)
+extern radeon_debug_type_t r100_enabled_debug_types;
+#define RADEON_DEBUG r100_enabled_debug_types
+#else
+#error "Neither RADEON_R100 nor RADEON_R200 are defined."
+#endif
 
 static inline int radeon_is_debug_enabled(const radeon_debug_type_t type,
           const radeon_debug_level_t level)
 {
        return RADEON_DEBUG_LEVEL >= level
-               && (type & radeon_enabled_debug_types);
+               && (type & RADEON_DEBUG);
 }
 
 extern void _radeon_print(const radeon_debug_type_t type,