From: Dylan Baker Date: Thu, 20 Sep 2018 21:35:36 +0000 (-0700) Subject: gallium/util: start splitting u_debug into generic and gallium specific components X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=078b3cdb34202c0d4b23b7f8723cd92081240ed5;p=mesa.git gallium/util: start splitting u_debug into generic and gallium specific components In order to pull u_debug into src/util we need to break the generically useful bits from the bits that are tightly coupled to gallium. Tested-by: Brian Paul Reviewed-by: Marek Olšák --- diff --git a/src/gallium/auxiliary/Makefile.sources b/src/gallium/auxiliary/Makefile.sources index 94851210142..923ffb2383c 100644 --- a/src/gallium/auxiliary/Makefile.sources +++ b/src/gallium/auxiliary/Makefile.sources @@ -228,6 +228,8 @@ C_SOURCES := \ util/u_cpu_detect.h \ util/u_debug.c \ util/u_debug.h \ + util/u_debug_gallium.h \ + util/u_debug_gallium.c \ util/u_debug_describe.c \ util/u_debug_describe.h \ util/u_debug_flush.c \ diff --git a/src/gallium/auxiliary/meson.build b/src/gallium/auxiliary/meson.build index e79089a7d00..656955c621a 100644 --- a/src/gallium/auxiliary/meson.build +++ b/src/gallium/auxiliary/meson.build @@ -248,6 +248,8 @@ files_libgallium = files( 'util/u_cpu_detect.h', 'util/u_debug.c', 'util/u_debug.h', + 'util/u_debug_gallium.h', + 'util/u_debug_gallium.c', 'util/u_debug_describe.c', 'util/u_debug_describe.h', 'util/u_debug_flush.c', diff --git a/src/gallium/auxiliary/util/u_debug.c b/src/gallium/auxiliary/util/u_debug.c index 8962050b1d5..f17cb1b58f5 100644 --- a/src/gallium/auxiliary/util/u_debug.c +++ b/src/gallium/auxiliary/util/u_debug.c @@ -35,7 +35,6 @@ #include "pipe/p_format.h" #include "pipe/p_state.h" #include "util/u_inlines.h" -#include "util/u_format.h" #include "util/u_memory.h" #include "util/u_string.h" #include "util/u_math.h" @@ -403,15 +402,6 @@ debug_dump_flags(const struct debug_named_value *names, unsigned long value) } -#ifdef DEBUG -void -debug_print_format(const char *msg, unsigned fmt ) -{ - debug_printf("%s: %s\n", msg, util_format_name(fmt)); -} -#endif - - #ifdef DEBUG int fl_indent = 0; diff --git a/src/gallium/auxiliary/util/u_debug.h b/src/gallium/auxiliary/util/u_debug.h index 4c3b8ba171c..6d1e92b7b97 100644 --- a/src/gallium/auxiliary/util/u_debug.h +++ b/src/gallium/auxiliary/util/u_debug.h @@ -131,13 +131,8 @@ debug_printf(const char *format, ...) * messages. */ void debug_print_blob( const char *name, const void *blob, unsigned size ); - -/* Print a message along with a prettified format string - */ -void debug_print_format(const char *msg, unsigned fmt ); #else #define debug_print_blob(_name, _blob, _size) ((void)0) -#define debug_print_format(_msg, _fmt) ((void)0) #endif diff --git a/src/gallium/auxiliary/util/u_debug_gallium.c b/src/gallium/auxiliary/util/u_debug_gallium.c new file mode 100644 index 00000000000..977e19375ba --- /dev/null +++ b/src/gallium/auxiliary/util/u_debug_gallium.c @@ -0,0 +1,42 @@ +/************************************************************************** + * + * Copyright 2008 VMware, Inc. + * Copyright (c) 2008 VMware, Inc. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + **************************************************************************/ + + +#include "util/u_debug.h" +#include "u_debug_gallium.h" +#include "u_format.h" + +#ifdef DEBUG + +void +debug_print_format(const char *msg, unsigned fmt) +{ + debug_printf("%s: %s\n", msg, util_format_name(fmt)); +} + +#endif diff --git a/src/gallium/auxiliary/util/u_debug_gallium.h b/src/gallium/auxiliary/util/u_debug_gallium.h new file mode 100644 index 00000000000..2e05e53c29d --- /dev/null +++ b/src/gallium/auxiliary/util/u_debug_gallium.h @@ -0,0 +1,46 @@ +/************************************************************************** + * + * Copyright 2008 VMware, Inc. + * Copyright (c) 2008 VMware, Inc. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + **************************************************************************/ + +#ifndef _U_DEBUG_GALLIUM_H_ +#define _U_DEBUG_GALLIUM_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef DEBUG +void debug_print_format(const char *msg, unsigned fmt); +#else +#define debug_print_format(_msg, _fmt) ((void)0) +#endif + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/src/gallium/auxiliary/util/u_pack_color.h b/src/gallium/auxiliary/util/u_pack_color.h index f9f41609b44..0166126c56f 100644 --- a/src/gallium/auxiliary/util/u_pack_color.h +++ b/src/gallium/auxiliary/util/u_pack_color.h @@ -37,7 +37,7 @@ #include "pipe/p_compiler.h" #include "pipe/p_format.h" -#include "util/u_debug.h" +#include "util/u_debug_gallium.h" #include "util/u_format.h" #include "util/u_math.h"