Mesa (main): util: Getting u_debug.h not depends on pipe/*

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Apr 1 03:07:39 UTC 2022


Module: Mesa
Branch: main
Commit: be1b30393bdb59863eb06106614b37c71f471993
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=be1b30393bdb59863eb06106614b37c71f471993

Author: Yonggang Luo <luoyonggang at gmail.com>
Date:   Wed Mar 30 06:10:25 2022 +0800

util: Getting u_debug.h not depends on pipe/*

Move pipe_debug_type into u_debug.h
Move pipe_debug_callback into u_debug.h

Signed-off-by: Yonggang Luo <luoyonggang at gmail.com>
Reviewed-by: Marek Olšák <marek.olsak at amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15657>

---

 src/gallium/drivers/lima/lima_context.h     |  1 +
 src/gallium/frontends/clover/core/queue.cpp |  1 +
 src/gallium/include/pipe/p_state.h          | 31 ---------------------
 src/util/macros.h                           | 14 ----------
 src/util/u_debug.c                          |  4 ---
 src/util/u_debug.h                          | 43 +++++++++++++++++++++++++++--
 6 files changed, 43 insertions(+), 51 deletions(-)

diff --git a/src/gallium/drivers/lima/lima_context.h b/src/gallium/drivers/lima/lima_context.h
index 6a37bfa3a98..6d40e73541c 100644
--- a/src/gallium/drivers/lima/lima_context.h
+++ b/src/gallium/drivers/lima/lima_context.h
@@ -27,6 +27,7 @@
 
 #include "util/list.h"
 #include "util/slab.h"
+#include "util/u_debug.h"
 
 #include "pipe/p_context.h"
 #include "pipe/p_state.h"
diff --git a/src/gallium/frontends/clover/core/queue.cpp b/src/gallium/frontends/clover/core/queue.cpp
index a1962eac8ac..cd4caadb5f9 100644
--- a/src/gallium/frontends/clover/core/queue.cpp
+++ b/src/gallium/frontends/clover/core/queue.cpp
@@ -25,6 +25,7 @@
 #include "pipe/p_screen.h"
 #include "pipe/p_context.h"
 #include "pipe/p_state.h"
+#include "util/u_debug.h"
 
 using namespace clover;
 
diff --git a/src/gallium/include/pipe/p_state.h b/src/gallium/include/pipe/p_state.h
index b2ab438677e..99ae182999c 100644
--- a/src/gallium/include/pipe/p_state.h
+++ b/src/gallium/include/pipe/p_state.h
@@ -1000,37 +1000,6 @@ struct pipe_compute_state
    unsigned req_input_mem; /**< Required size of the INPUT resource. */
 };
 
-/**
- * Structure that contains a callback for debug messages from the driver back
- * to the gallium frontend.
- */
-struct util_debug_callback
-{
-   /**
-    * When set to \c true, the callback may be called asynchronously from a
-    * driver-created thread.
-    */
-   bool async;
-
-   /**
-    * Callback for the driver to report debug/performance/etc information back
-    * to the gallium frontend.
-    *
-    * \param data       user-supplied data pointer
-    * \param id         message type identifier, if pointed value is 0, then a
-    *                   new id is assigned
-    * \param type       UTIL_DEBUG_TYPE_*
-    * \param format     printf-style format string
-    * \param args       args for format string
-    */
-   void (*debug_message)(void *data,
-                         unsigned *id,
-                         enum util_debug_type type,
-                         const char *fmt,
-                         va_list args);
-   void *data;
-};
-
 /**
  * Structure that contains a callback for device reset messages from the driver
  * back to the gallium frontend.
diff --git a/src/util/macros.h b/src/util/macros.h
index fc0c4f3413c..7c6df7e58ba 100644
--- a/src/util/macros.h
+++ b/src/util/macros.h
@@ -425,20 +425,6 @@ u_uintN_max(unsigned bit_size)
    return UINT64_MAX >> (64 - bit_size);
 }
 
-/* TODO: In future we should try to move this to u_debug.h once header
- * dependencies are reorganised to allow this.
- */
-enum util_debug_type
-{
-   UTIL_DEBUG_TYPE_OUT_OF_MEMORY = 1,
-   UTIL_DEBUG_TYPE_ERROR,
-   UTIL_DEBUG_TYPE_SHADER_INFO,
-   UTIL_DEBUG_TYPE_PERF_INFO,
-   UTIL_DEBUG_TYPE_INFO,
-   UTIL_DEBUG_TYPE_FALLBACK,
-   UTIL_DEBUG_TYPE_CONFORMANCE,
-};
-
 #if !defined(alignof) && !defined(__cplusplus)
 #if __STDC_VERSION__ >= 201112L
 #define alignof(t) _Alignof(t)
diff --git a/src/util/u_debug.c b/src/util/u_debug.c
index 9cf1ec7a8fa..9c18928f82b 100644
--- a/src/util/u_debug.c
+++ b/src/util/u_debug.c
@@ -27,11 +27,7 @@
  **************************************************************************/
 
 
-#include "pipe/p_config.h"
-
 #include "util/u_debug.h"
-#include "pipe/p_format.h"
-#include "pipe/p_state.h"
 #include "util/u_string.h"
 #include "util/u_math.h"
 #include <inttypes.h>
diff --git a/src/util/u_debug.h b/src/util/u_debug.h
index 1e0b9ee5623..c8e2f3dbfbf 100644
--- a/src/util/u_debug.h
+++ b/src/util/u_debug.h
@@ -58,6 +58,47 @@
 extern "C" {
 #endif
 
+enum util_debug_type
+{
+   UTIL_DEBUG_TYPE_OUT_OF_MEMORY = 1,
+   UTIL_DEBUG_TYPE_ERROR,
+   UTIL_DEBUG_TYPE_SHADER_INFO,
+   UTIL_DEBUG_TYPE_PERF_INFO,
+   UTIL_DEBUG_TYPE_INFO,
+   UTIL_DEBUG_TYPE_FALLBACK,
+   UTIL_DEBUG_TYPE_CONFORMANCE,
+};
+
+/**
+ * Structure that contains a callback for debug messages from the driver back
+ * to the gallium frontend.
+ */
+struct util_debug_callback
+{
+   /**
+    * When set to \c true, the callback may be called asynchronously from a
+    * driver-created thread.
+    */
+   bool async;
+
+   /**
+    * Callback for the driver to report debug/performance/etc information back
+    * to the gallium frontend.
+    *
+    * \param data       user-supplied data pointer
+    * \param id         message type identifier, if pointed value is 0, then a
+    *                   new id is assigned
+    * \param type       UTIL_DEBUG_TYPE_*
+    * \param format     printf-style format string
+    * \param args       args for format string
+    */
+   void (*debug_message)(void *data,
+                         unsigned *id,
+                         enum util_debug_type type,
+                         const char *fmt,
+                         va_list args);
+   void *data;
+};
 
 #define _util_printf_format(fmt, list) PRINTFLIKE(fmt, list)
 
@@ -275,8 +316,6 @@ void _debug_assert_fail(const char *expr,
    } \
 } while (0)
 
-struct util_debug_callback;
-
 void
 _util_debug_message(
    struct util_debug_callback *cb,



More information about the mesa-commit mailing list