Mesa (master): gallium/util: start splitting u_debug into generic and gallium specific components

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Oct 30 21:59:22 UTC 2018


Module: Mesa
Branch: master
Commit: 078b3cdb34202c0d4b23b7f8723cd92081240ed5
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=078b3cdb34202c0d4b23b7f8723cd92081240ed5

Author: Dylan Baker <dylan at pnwbakers.com>
Date:   Thu Sep 20 14:35:36 2018 -0700

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 <brianp at vmware.com>
Reviewed-by: Marek Olšák <marek.olsak at amd.com>

---

 src/gallium/auxiliary/Makefile.sources       |  2 ++
 src/gallium/auxiliary/meson.build            |  2 ++
 src/gallium/auxiliary/util/u_debug.c         | 10 ------
 src/gallium/auxiliary/util/u_debug.h         |  5 ---
 src/gallium/auxiliary/util/u_debug_gallium.c | 42 +++++++++++++++++++++++++
 src/gallium/auxiliary/util/u_debug_gallium.h | 46 ++++++++++++++++++++++++++++
 src/gallium/auxiliary/util/u_pack_color.h    |  2 +-
 7 files changed, 93 insertions(+), 16 deletions(-)

diff --git a/src/gallium/auxiliary/Makefile.sources b/src/gallium/auxiliary/Makefile.sources
index 9485121014..923ffb2383 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 e79089a7d0..656955c621 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 8962050b1d..f17cb1b58f 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 4c3b8ba171..6d1e92b7b9 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 0000000000..977e19375b
--- /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 0000000000..2e05e53c29
--- /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 f9f41609b4..0166126c56 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"
 




More information about the mesa-commit mailing list