[Mesa-dev] [PATCH 2/2] trace: Dump PIPE_QUERY_* enums.

jfonseca at vmware.com jfonseca at vmware.com
Wed Nov 27 09:27:14 PST 2013


From: José Fonseca <jfonseca at vmware.com>

---
 src/gallium/auxiliary/util/u_dump.h         |  3 ++
 src/gallium/auxiliary/util/u_dump_defines.c | 33 ++++++++++++++++
 src/gallium/drivers/trace/tr_context.c      |  3 +-
 src/gallium/drivers/trace/tr_dump_defines.h | 58 +++++++++++++++++++++++++++++
 src/gallium/drivers/trace/tr_dump_state.c   | 10 +----
 src/gallium/drivers/trace/tr_dump_state.h   |  3 --
 src/gallium/drivers/trace/tr_screen.c       |  3 +-
 7 files changed, 98 insertions(+), 15 deletions(-)
 create mode 100644 src/gallium/drivers/trace/tr_dump_defines.h

diff --git a/src/gallium/auxiliary/util/u_dump.h b/src/gallium/auxiliary/util/u_dump.h
index 71750a6..58e7dfd 100644
--- a/src/gallium/auxiliary/util/u_dump.h
+++ b/src/gallium/auxiliary/util/u_dump.h
@@ -85,6 +85,9 @@ util_dump_tex_mipfilter(unsigned value, boolean shortened);
 const char *
 util_dump_tex_filter(unsigned value, boolean shortened);
 
+const char *
+util_dump_query_type(unsigned value, boolean shortened);
+
 
 /*
  * p_state.h, through a FILE
diff --git a/src/gallium/auxiliary/util/u_dump_defines.c b/src/gallium/auxiliary/util/u_dump_defines.c
index cc62687..03fd15d 100644
--- a/src/gallium/auxiliary/util/u_dump_defines.c
+++ b/src/gallium/auxiliary/util/u_dump_defines.c
@@ -359,3 +359,36 @@ util_dump_tex_filter_short_names[] = {
 };
 
 DEFINE_UTIL_DUMP_CONTINUOUS(tex_filter)
+
+
+static const char *
+util_dump_query_type_names[] = {
+   "PIPE_QUERY_OCCLUSION_COUNTER",
+   "PIPE_QUERY_OCCLUSION_PREDICATE",
+   "PIPE_QUERY_TIMESTAMP",
+   "PIPE_QUERY_TIMESTAMP_DISJOINT",
+   "PIPE_QUERY_TIME_ELAPSED",
+   "PIPE_QUERY_PRIMITIVES_GENERATED",
+   "PIPE_QUERY_PRIMITIVES_EMITTED",
+   "PIPE_QUERY_SO_STATISTICS",
+   "PIPE_QUERY_SO_OVERFLOW_PREDICATE",
+   "PIPE_QUERY_GPU_FINISHED",
+   "PIPE_QUERY_PIPELINE_STATISTICS",
+};
+
+static const char *
+util_dump_query_type_short_names[] = {
+   "occlusion_counter",
+   "occlusion_predicate",
+   "timestamp",
+   "timestamp_disjoint",
+   "time_elapsed",
+   "primitives_generated",
+   "primitives_emitted",
+   "so_statistics",
+   "so_overflow_predicate",
+   "gpu_finished",
+   "pipeline_statistics",
+};
+
+DEFINE_UTIL_DUMP_CONTINUOUS(query_type)
diff --git a/src/gallium/drivers/trace/tr_context.c b/src/gallium/drivers/trace/tr_context.c
index d9afb0a..4ac7d9b 100644
--- a/src/gallium/drivers/trace/tr_context.c
+++ b/src/gallium/drivers/trace/tr_context.c
@@ -33,6 +33,7 @@
 #include "pipe/p_screen.h"
 
 #include "tr_dump.h"
+#include "tr_dump_defines.h"
 #include "tr_dump_state.h"
 #include "tr_public.h"
 #include "tr_screen.h"
@@ -135,7 +136,7 @@ trace_context_create_query(struct pipe_context *_pipe,
    trace_dump_call_begin("pipe_context", "create_query");
 
    trace_dump_arg(ptr, pipe);
-   trace_dump_arg(uint, query_type);
+   trace_dump_arg(query_type, query_type);
 
    query = pipe->create_query(pipe, query_type);
 
diff --git a/src/gallium/drivers/trace/tr_dump_defines.h b/src/gallium/drivers/trace/tr_dump_defines.h
new file mode 100644
index 0000000..0c83c2b
--- /dev/null
+++ b/src/gallium/drivers/trace/tr_dump_defines.h
@@ -0,0 +1,58 @@
+/**************************************************************************
+ *
+ * Copyright 2013 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 TR_DUMP_DEFINES_H_
+#define TR_DUMP_DEFINES_H_
+
+#include "pipe/p_compiler.h"
+#include "util/u_format.h"
+#include "util/u_dump.h"
+#include "tr_dump.h"
+
+
+static INLINE void
+trace_dump_format(enum pipe_format format)
+{
+   if (!trace_dumping_enabled_locked())
+      return;
+
+   trace_dump_enum(util_format_name(format));
+}
+
+
+static INLINE void
+trace_dump_query_type(unsigned value)
+{
+   if (!trace_dumping_enabled_locked())
+      return;
+
+   trace_dump_enum(util_dump_query_type(value, FALSE));
+}
+
+
+
+#endif /* TR_DUMP_DEFINES_H_ */
diff --git a/src/gallium/drivers/trace/tr_dump_state.c b/src/gallium/drivers/trace/tr_dump_state.c
index c1e5361..8f32e9e 100644
--- a/src/gallium/drivers/trace/tr_dump_state.c
+++ b/src/gallium/drivers/trace/tr_dump_state.c
@@ -32,18 +32,10 @@
 #include "tgsi/tgsi_dump.h"
 
 #include "tr_dump.h"
+#include "tr_dump_defines.h"
 #include "tr_dump_state.h"
 
 
-void trace_dump_format(enum pipe_format format)
-{
-   if (!trace_dumping_enabled_locked())
-      return;
-
-   trace_dump_enum(util_format_name(format) );
-}
-
-
 void trace_dump_resource_template(const struct pipe_resource *templat)
 {
    if (!trace_dumping_enabled_locked())
diff --git a/src/gallium/drivers/trace/tr_dump_state.h b/src/gallium/drivers/trace/tr_dump_state.h
index 6151a0a..be87f48 100644
--- a/src/gallium/drivers/trace/tr_dump_state.h
+++ b/src/gallium/drivers/trace/tr_dump_state.h
@@ -28,13 +28,10 @@
 #ifndef TR_DUMP_STATE_H_
 #define TR_DUMP_STATE_H_
 
-#include "pipe/p_format.h"
 #include "pipe/p_state.h"
 #include "pipe/p_shader_tokens.h"
 
 
-void trace_dump_format(enum pipe_format format);
-
 void trace_dump_resource_template(const struct pipe_resource *templat);
 
 void trace_dump_box(const struct pipe_box *box);
diff --git a/src/gallium/drivers/trace/tr_screen.c b/src/gallium/drivers/trace/tr_screen.c
index 5281ba8..c6745af 100644
--- a/src/gallium/drivers/trace/tr_screen.c
+++ b/src/gallium/drivers/trace/tr_screen.c
@@ -30,14 +30,13 @@
 #include "util/u_simple_list.h"
 
 #include "tr_dump.h"
+#include "tr_dump_defines.h"
 #include "tr_dump_state.h"
 #include "tr_texture.h"
 #include "tr_context.h"
 #include "tr_screen.h"
 #include "tr_public.h"
 
-#include "pipe/p_format.h"
-
 
 static boolean trace = FALSE;
 
-- 
1.8.3.2



More information about the mesa-dev mailing list