Mesa (master): gallium: add interface for driver queries like performance counters, etc.

Marek Olšák mareko at kemper.freedesktop.org
Tue Mar 26 02:19:40 UTC 2013


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

Author: Marek Olšák <maraeo at gmail.com>
Date:   Thu Mar 21 19:32:24 2013 +0100

gallium: add interface for driver queries like performance counters, etc.

The pipe query interface is reused. The list of available queries can be
obtained using pipe_screen::get_driver_query_info.

Reviewed-by: Brian Paul <brianp at vmware.com>

---

 src/gallium/auxiliary/util/u_inlines.h |    2 +-
 src/gallium/include/pipe/p_defines.h   |   12 ++++++++++++
 src/gallium/include/pipe/p_screen.h    |   11 +++++++++++
 3 files changed, 24 insertions(+), 1 deletions(-)

diff --git a/src/gallium/auxiliary/util/u_inlines.h b/src/gallium/auxiliary/util/u_inlines.h
index ba745eb..719ba25 100644
--- a/src/gallium/auxiliary/util/u_inlines.h
+++ b/src/gallium/auxiliary/util/u_inlines.h
@@ -517,7 +517,7 @@ util_query_clear_result(union pipe_query_result *result, unsigned type)
       memset(&result->pipeline_statistics, 0, sizeof(result->pipeline_statistics));
       break;
    default:
-      assert(0);
+      memset(result, 0, sizeof(*result));
    }
 }
 
diff --git a/src/gallium/include/pipe/p_defines.h b/src/gallium/include/pipe/p_defines.h
index f59e78a..51694ea 100644
--- a/src/gallium/include/pipe/p_defines.h
+++ b/src/gallium/include/pipe/p_defines.h
@@ -397,6 +397,10 @@ enum pipe_flush_flags {
 #define PIPE_QUERY_PIPELINE_STATISTICS  10
 #define PIPE_QUERY_TYPES                11
 
+/* start of driver queries,
+ * see pipe_screen::get_driver_query_info */
+#define PIPE_QUERY_DRIVER_SPECIFIC     256
+
 
 /**
  * Conditional rendering modes
@@ -649,6 +653,14 @@ union pipe_color_union
    unsigned int ui[4];
 };
 
+struct pipe_driver_query_info
+{
+   const char *name;
+   unsigned query_type; /* PIPE_QUERY_DRIVER_SPECIFIC + i */
+   uint64_t max_value; /* max value that can be returned */
+   boolean uses_byte_units; /* whether the result is in bytes */
+};
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/src/gallium/include/pipe/p_screen.h b/src/gallium/include/pipe/p_screen.h
index 754cfd7..c487e8e 100644
--- a/src/gallium/include/pipe/p_screen.h
+++ b/src/gallium/include/pipe/p_screen.h
@@ -206,6 +206,17 @@ struct pipe_screen {
                             struct pipe_fence_handle *fence,
                             uint64_t timeout );
 
+   /**
+    * Returns a driver-specific query.
+    *
+    * If \p info is NULL, the number of available queries is returned.
+    * Otherwise, the driver query at the specified \p index is returned
+    * in \p info. The function returns non-zero on success.
+    */
+   int (*get_driver_query_info)(struct pipe_screen *screen,
+                                unsigned index,
+                                struct pipe_driver_query_info *info);
+
 };
 
 




More information about the mesa-commit mailing list