[Mesa-dev] [PATCH 1/5] nvc0: add a header file for nvc0_query

Samuel Pitoiset samuel.pitoiset at gmail.com
Mon Oct 5 12:27:25 PDT 2015


This will allow to split SW and HW queries in an upcoming patch.

While we are at it, make use of nvc0_query struct instead of pipe_query.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
---
 src/gallium/drivers/nouveau/Makefile.sources       |   1 +
 src/gallium/drivers/nouveau/nvc0/nvc0_context.h    |  12 +-
 src/gallium/drivers/nouveau/nvc0/nvc0_query.c      |  37 +---
 src/gallium/drivers/nouveau/nvc0/nvc0_query.h      | 191 +++++++++++++++++++++
 src/gallium/drivers/nouveau/nvc0/nvc0_screen.h     | 142 ---------------
 .../drivers/nouveau/nvc0/nvc0_shader_state.c       |   4 +-
 src/gallium/drivers/nouveau/nvc0/nvc0_vbo.c        |   4 +-
 7 files changed, 202 insertions(+), 189 deletions(-)
 create mode 100644 src/gallium/drivers/nouveau/nvc0/nvc0_query.h

diff --git a/src/gallium/drivers/nouveau/Makefile.sources b/src/gallium/drivers/nouveau/Makefile.sources
index 9346ea3..350837c 100644
--- a/src/gallium/drivers/nouveau/Makefile.sources
+++ b/src/gallium/drivers/nouveau/Makefile.sources
@@ -151,6 +151,7 @@ NVC0_C_SOURCES := \
 	nvc0/nvc0_program.c \
 	nvc0/nvc0_program.h \
 	nvc0/nvc0_query.c \
+	nvc0/nvc0_query.h \
 	nvc0/nvc0_resource.c \
 	nvc0/nvc0_resource.h \
 	nvc0/nvc0_screen.c \
diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_context.h b/src/gallium/drivers/nouveau/nvc0/nvc0_context.h
index 30bee3a..4af83c5 100644
--- a/src/gallium/drivers/nouveau/nvc0/nvc0_context.h
+++ b/src/gallium/drivers/nouveau/nvc0/nvc0_context.h
@@ -15,6 +15,7 @@
 #include "nvc0/nvc0_screen.h"
 #include "nvc0/nvc0_program.h"
 #include "nvc0/nvc0_resource.h"
+#include "nvc0/nvc0_query.h"
 
 #include "nv50/nv50_transfer.h"
 
@@ -231,17 +232,6 @@ uint32_t nvc0_program_symbol_offset(const struct nvc0_program *,
                                     uint32_t label);
 void nvc0_program_init_tcp_empty(struct nvc0_context *);
 
-/* nvc0_query.c */
-void nvc0_init_query_functions(struct nvc0_context *);
-void nvc0_query_pushbuf_submit(struct nouveau_pushbuf *,
-                               struct pipe_query *, unsigned result_offset);
-void nvc0_query_fifo_wait(struct nouveau_pushbuf *, struct pipe_query *);
-void nvc0_so_target_save_offset(struct pipe_context *,
-                                struct pipe_stream_output_target *, unsigned i,
-                                bool *serialize);
-
-#define NVC0_QUERY_TFB_BUFFER_OFFSET (PIPE_QUERY_TYPES + 0)
-
 /* nvc0_shader_state.c */
 void nvc0_vertprog_validate(struct nvc0_context *);
 void nvc0_tctlprog_validate(struct nvc0_context *);
diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_query.c b/src/gallium/drivers/nouveau/nvc0/nvc0_query.c
index b13df6a..793425b 100644
--- a/src/gallium/drivers/nouveau/nvc0/nvc0_query.c
+++ b/src/gallium/drivers/nouveau/nvc0/nvc0_query.c
@@ -25,6 +25,8 @@
 #define NVC0_PUSH_EXPLICIT_SPACE_CHECKING
 
 #include "nvc0/nvc0_context.h"
+#include "nvc0/nvc0_query.h"
+
 #include "nv_object.xml.h"
 #include "nvc0/nve4_compute.xml.h"
 #include "nvc0/nvc0_compute.xml.h"
@@ -34,26 +36,6 @@
 #define NVC0_QUERY_STATE_ENDED   2
 #define NVC0_QUERY_STATE_FLUSHED 3
 
-struct nvc0_query {
-   uint32_t *data;
-   uint16_t type;
-   uint16_t index;
-   int8_t ctr[4];
-   uint32_t sequence;
-   struct nouveau_bo *bo;
-   uint32_t base;
-   uint32_t offset; /* base + i * rotate */
-   uint8_t state;
-   bool is64bit;
-   uint8_t rotate;
-   int nesting; /* only used for occlusion queries */
-   union {
-      struct nouveau_mm_allocation *mm;
-      uint64_t value;
-   } u;
-   struct nouveau_fence *fence;
-};
-
 #define NVC0_QUERY_ALLOC_SPACE 256
 
 static boolean nvc0_hw_sm_query_begin(struct nvc0_context *,
@@ -62,12 +44,6 @@ static void nvc0_hw_sm_query_end(struct nvc0_context *, struct nvc0_query *);
 static boolean nvc0_hw_sm_query_result(struct nvc0_context *,
                                        struct nvc0_query *, void *, boolean);
 
-static inline struct nvc0_query *
-nvc0_query(struct pipe_query *pipe)
-{
-   return (struct nvc0_query *)pipe;
-}
-
 static bool
 nvc0_query_allocate(struct nvc0_context *nvc0, struct nvc0_query *q, int size)
 {
@@ -523,9 +499,8 @@ nvc0_query_result(struct pipe_context *pipe, struct pipe_query *pq,
 }
 
 void
-nvc0_query_fifo_wait(struct nouveau_pushbuf *push, struct pipe_query *pq)
+nvc0_query_fifo_wait(struct nouveau_pushbuf *push, struct nvc0_query *q)
 {
-   struct nvc0_query *q = nvc0_query(pq);
    unsigned offset = q->offset;
 
    if (q->type == PIPE_QUERY_SO_OVERFLOW_PREDICATE) offset += 0x20;
@@ -596,7 +571,7 @@ nvc0_render_condition(struct pipe_context *pipe,
    }
 
    if (wait)
-      nvc0_query_fifo_wait(push, pq);
+      nvc0_query_fifo_wait(push, q);
 
    PUSH_SPACE(push, 7);
    PUSH_REFN (push, q->bo, NOUVEAU_BO_GART | NOUVEAU_BO_RD);
@@ -611,10 +586,8 @@ nvc0_render_condition(struct pipe_context *pipe,
 
 void
 nvc0_query_pushbuf_submit(struct nouveau_pushbuf *push,
-                          struct pipe_query *pq, unsigned result_offset)
+                          struct nvc0_query *q, unsigned result_offset)
 {
-   struct nvc0_query *q = nvc0_query(pq);
-
 #define NVC0_IB_ENTRY_1_NO_PREFETCH (1 << (31 - 8))
 
    PUSH_REFN(push, q->bo, NOUVEAU_BO_RD | NOUVEAU_BO_GART);
diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_query.h b/src/gallium/drivers/nouveau/nvc0/nvc0_query.h
new file mode 100644
index 0000000..741ad21
--- /dev/null
+++ b/src/gallium/drivers/nouveau/nvc0/nvc0_query.h
@@ -0,0 +1,191 @@
+#ifndef __NVC0_QUERY_H__
+#define __NVC0_QUERY_H__
+
+#include "pipe/p_context.h"
+
+#include "nouveau_context.h"
+#include "nouveau_mm.h"
+
+#define NVC0_QUERY_TFB_BUFFER_OFFSET (PIPE_QUERY_TYPES + 0)
+
+struct nvc0_context;
+
+struct nvc0_query {
+   uint32_t *data;
+   uint16_t type;
+   uint16_t index;
+   int8_t ctr[4];
+   uint32_t sequence;
+   struct nouveau_bo *bo;
+   uint32_t base;
+   uint32_t offset; /* base + i * rotate */
+   uint8_t state;
+   boolean is64bit;
+   uint8_t rotate;
+   int nesting; /* only used for occlusion queries */
+   union {
+      struct nouveau_mm_allocation *mm;
+      uint64_t value;
+   } u;
+   struct nouveau_fence *fence;
+};
+
+static inline struct nvc0_query *
+nvc0_query(struct pipe_query *pipe)
+{
+   return (struct nvc0_query *)pipe;
+}
+
+/*
+ * Performance counters groups:
+ */
+#define NVC0_QUERY_MP_COUNTER_GROUP 0
+#define NVC0_QUERY_DRV_STAT_GROUP   1
+
+/*
+ * Performance counter queries:
+ */
+#define NVE4_HW_SM_QUERY(i)    (PIPE_QUERY_DRIVER_SPECIFIC + (i))
+#define NVE4_HW_SM_QUERY_LAST   NVE4_HW_SM_QUERY(NVE4_HW_SM_QUERY_COUNT - 1)
+enum nve4_pm_queries
+{
+   NVE4_HW_SM_QUERY_ACTIVE_CYCLES = 0,
+   NVE4_HW_SM_QUERY_ACTIVE_WARPS,
+   NVE4_HW_SM_QUERY_ATOM_COUNT,
+   NVE4_HW_SM_QUERY_BRANCH,
+   NVE4_HW_SM_QUERY_DIVERGENT_BRANCH,
+   NVE4_HW_SM_QUERY_GLD_REQUEST,
+   NVE4_HW_SM_QUERY_GLD_MEM_DIV_REPLAY,
+   NVE4_HW_SM_QUERY_GST_TRANSACTIONS,
+   NVE4_HW_SM_QUERY_GST_MEM_DIV_REPLAY,
+   NVE4_HW_SM_QUERY_GRED_COUNT,
+   NVE4_HW_SM_QUERY_GST_REQUEST,
+   NVE4_HW_SM_QUERY_INST_EXECUTED,
+   NVE4_HW_SM_QUERY_INST_ISSUED,
+   NVE4_HW_SM_QUERY_INST_ISSUED1,
+   NVE4_HW_SM_QUERY_INST_ISSUED2,
+   NVE4_HW_SM_QUERY_L1_GLD_HIT,
+   NVE4_HW_SM_QUERY_L1_GLD_MISS,
+   NVE4_HW_SM_QUERY_L1_LOCAL_LD_HIT,
+   NVE4_HW_SM_QUERY_L1_LOCAL_LD_MISS,
+   NVE4_HW_SM_QUERY_L1_LOCAL_ST_HIT,
+   NVE4_HW_SM_QUERY_L1_LOCAL_ST_MISS,
+   NVE4_HW_SM_QUERY_L1_SHARED_LD_TRANSACTIONS,
+   NVE4_HW_SM_QUERY_L1_SHARED_ST_TRANSACTIONS,
+   NVE4_HW_SM_QUERY_LOCAL_LD,
+   NVE4_HW_SM_QUERY_LOCAL_LD_TRANSACTIONS,
+   NVE4_HW_SM_QUERY_LOCAL_ST,
+   NVE4_HW_SM_QUERY_LOCAL_ST_TRANSACTIONS,
+   NVE4_HW_SM_QUERY_PROF_TRIGGER_0,
+   NVE4_HW_SM_QUERY_PROF_TRIGGER_1,
+   NVE4_HW_SM_QUERY_PROF_TRIGGER_2,
+   NVE4_HW_SM_QUERY_PROF_TRIGGER_3,
+   NVE4_HW_SM_QUERY_PROF_TRIGGER_4,
+   NVE4_HW_SM_QUERY_PROF_TRIGGER_5,
+   NVE4_HW_SM_QUERY_PROF_TRIGGER_6,
+   NVE4_HW_SM_QUERY_PROF_TRIGGER_7,
+   NVE4_HW_SM_QUERY_SHARED_LD,
+   NVE4_HW_SM_QUERY_SHARED_LD_REPLAY,
+   NVE4_HW_SM_QUERY_SHARED_ST,
+   NVE4_HW_SM_QUERY_SHARED_ST_REPLAY,
+   NVE4_HW_SM_QUERY_SM_CTA_LAUNCHED,
+   NVE4_HW_SM_QUERY_THREADS_LAUNCHED,
+   NVE4_HW_SM_QUERY_UNCACHED_GLD_TRANSACTIONS,
+   NVE4_HW_SM_QUERY_WARPS_LAUNCHED,
+   NVE4_HW_SM_QUERY_METRIC_IPC,
+   NVE4_HW_SM_QUERY_METRIC_IPAC,
+   NVE4_HW_SM_QUERY_METRIC_IPEC,
+   NVE4_HW_SM_QUERY_METRIC_MP_OCCUPANCY,
+   NVE4_HW_SM_QUERY_METRIC_MP_EFFICIENCY,
+   NVE4_HW_SM_QUERY_METRIC_INST_REPLAY_OHEAD,
+   NVE4_HW_SM_QUERY_COUNT
+};
+
+#define NVC0_HW_SM_QUERY(i)    (PIPE_QUERY_DRIVER_SPECIFIC + 2048 + (i))
+#define NVC0_HW_SM_QUERY_LAST   NVC0_HW_SM_QUERY(NVC0_HW_SM_QUERY_COUNT - 1)
+enum nvc0_pm_queries
+{
+   NVC0_HW_SM_QUERY_ACTIVE_CYCLES = 0,
+   NVC0_HW_SM_QUERY_ACTIVE_WARPS,
+   NVC0_HW_SM_QUERY_ATOM_COUNT,
+   NVC0_HW_SM_QUERY_BRANCH,
+   NVC0_HW_SM_QUERY_DIVERGENT_BRANCH,
+   NVC0_HW_SM_QUERY_GLD_REQUEST,
+   NVC0_HW_SM_QUERY_GRED_COUNT,
+   NVC0_HW_SM_QUERY_GST_REQUEST,
+   NVC0_HW_SM_QUERY_INST_EXECUTED,
+   NVC0_HW_SM_QUERY_INST_ISSUED1_0,
+   NVC0_HW_SM_QUERY_INST_ISSUED1_1,
+   NVC0_HW_SM_QUERY_INST_ISSUED2_0,
+   NVC0_HW_SM_QUERY_INST_ISSUED2_1,
+   NVC0_HW_SM_QUERY_LOCAL_LD,
+   NVC0_HW_SM_QUERY_LOCAL_ST,
+   NVC0_HW_SM_QUERY_PROF_TRIGGER_0,
+   NVC0_HW_SM_QUERY_PROF_TRIGGER_1,
+   NVC0_HW_SM_QUERY_PROF_TRIGGER_2,
+   NVC0_HW_SM_QUERY_PROF_TRIGGER_3,
+   NVC0_HW_SM_QUERY_PROF_TRIGGER_4,
+   NVC0_HW_SM_QUERY_PROF_TRIGGER_5,
+   NVC0_HW_SM_QUERY_PROF_TRIGGER_6,
+   NVC0_HW_SM_QUERY_PROF_TRIGGER_7,
+   NVC0_HW_SM_QUERY_SHARED_LD,
+   NVC0_HW_SM_QUERY_SHARED_ST,
+   NVC0_HW_SM_QUERY_THREADS_LAUNCHED,
+   NVC0_HW_SM_QUERY_TH_INST_EXECUTED_0,
+   NVC0_HW_SM_QUERY_TH_INST_EXECUTED_1,
+   NVC0_HW_SM_QUERY_TH_INST_EXECUTED_2,
+   NVC0_HW_SM_QUERY_TH_INST_EXECUTED_3,
+   NVC0_HW_SM_QUERY_WARPS_LAUNCHED,
+   NVC0_HW_SM_QUERY_COUNT
+};
+
+/*
+ * Driver statistics queries:
+ */
+#define NVC0_QUERY_DRV_STAT(i)    (PIPE_QUERY_DRIVER_SPECIFIC + 1024 + (i))
+#define NVC0_QUERY_DRV_STAT_LAST   NVC0_QUERY_DRV_STAT(NVC0_QUERY_DRV_STAT_COUNT - 1)
+enum nvc0_drv_stats_queries
+{
+#ifdef NOUVEAU_ENABLE_DRIVER_STATISTICS
+   NVC0_QUERY_DRV_STAT_TEX_OBJECT_CURRENT_COUNT = 0,
+   NVC0_QUERY_DRV_STAT_TEX_OBJECT_CURRENT_BYTES,
+   NVC0_QUERY_DRV_STAT_BUF_OBJECT_CURRENT_COUNT,
+   NVC0_QUERY_DRV_STAT_BUF_OBJECT_CURRENT_BYTES_VID,
+   NVC0_QUERY_DRV_STAT_BUF_OBJECT_CURRENT_BYTES_SYS,
+   NVC0_QUERY_DRV_STAT_TEX_TRANSFERS_READ,
+   NVC0_QUERY_DRV_STAT_TEX_TRANSFERS_WRITE,
+   NVC0_QUERY_DRV_STAT_TEX_COPY_COUNT,
+   NVC0_QUERY_DRV_STAT_TEX_BLIT_COUNT,
+   NVC0_QUERY_DRV_STAT_TEX_CACHE_FLUSH_COUNT,
+   NVC0_QUERY_DRV_STAT_BUF_TRANSFERS_READ,
+   NVC0_QUERY_DRV_STAT_BUF_TRANSFERS_WRITE,
+   NVC0_QUERY_DRV_STAT_BUF_READ_BYTES_STAGING_VID,
+   NVC0_QUERY_DRV_STAT_BUF_WRITE_BYTES_DIRECT,
+   NVC0_QUERY_DRV_STAT_BUF_WRITE_BYTES_STAGING_VID,
+   NVC0_QUERY_DRV_STAT_BUF_WRITE_BYTES_STAGING_SYS,
+   NVC0_QUERY_DRV_STAT_BUF_COPY_BYTES,
+   NVC0_QUERY_DRV_STAT_BUF_NON_KERNEL_FENCE_SYNC_COUNT,
+   NVC0_QUERY_DRV_STAT_ANY_NON_KERNEL_FENCE_SYNC_COUNT,
+   NVC0_QUERY_DRV_STAT_QUERY_SYNC_COUNT,
+   NVC0_QUERY_DRV_STAT_GPU_SERIALIZE_COUNT,
+   NVC0_QUERY_DRV_STAT_DRAW_CALLS_ARRAY,
+   NVC0_QUERY_DRV_STAT_DRAW_CALLS_INDEXED,
+   NVC0_QUERY_DRV_STAT_DRAW_CALLS_FALLBACK_COUNT,
+   NVC0_QUERY_DRV_STAT_USER_BUFFER_UPLOAD_BYTES,
+   NVC0_QUERY_DRV_STAT_CONSTBUF_UPLOAD_COUNT,
+   NVC0_QUERY_DRV_STAT_CONSTBUF_UPLOAD_BYTES,
+   NVC0_QUERY_DRV_STAT_PUSHBUF_COUNT,
+   NVC0_QUERY_DRV_STAT_RESOURCE_VALIDATE_COUNT,
+#endif
+   NVC0_QUERY_DRV_STAT_COUNT
+};
+
+void nvc0_init_query_functions(struct nvc0_context *);
+void nvc0_query_pushbuf_submit(struct nouveau_pushbuf *, struct nvc0_query *,
+                               unsigned);
+void nvc0_query_fifo_wait(struct nouveau_pushbuf *, struct nvc0_query *);
+void nvc0_so_target_save_offset(struct pipe_context *,
+                                struct pipe_stream_output_target *, unsigned,
+                                bool *);
+
+#endif
diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.h b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.h
index f57a316..fa4f864 100644
--- a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.h
+++ b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.h
@@ -112,148 +112,6 @@ nvc0_screen(struct pipe_screen *screen)
    return (struct nvc0_screen *)screen;
 }
 
-/*
- * Performance counters groups:
- */
-#define NVC0_QUERY_MP_COUNTER_GROUP 0
-#define NVC0_QUERY_DRV_STAT_GROUP   1
-
-/* Performance counter queries:
- */
-#define NVE4_HW_SM_QUERY(i)    (PIPE_QUERY_DRIVER_SPECIFIC + (i))
-#define NVE4_HW_SM_QUERY_LAST   NVE4_HW_SM_QUERY(NVE4_HW_SM_QUERY_COUNT - 1)
-enum nve4_pm_queries
-{
-    NVE4_HW_SM_QUERY_ACTIVE_CYCLES = 0,
-    NVE4_HW_SM_QUERY_ACTIVE_WARPS,
-    NVE4_HW_SM_QUERY_ATOM_COUNT,
-    NVE4_HW_SM_QUERY_BRANCH,
-    NVE4_HW_SM_QUERY_DIVERGENT_BRANCH,
-    NVE4_HW_SM_QUERY_GLD_REQUEST,
-    NVE4_HW_SM_QUERY_GLD_MEM_DIV_REPLAY,
-    NVE4_HW_SM_QUERY_GST_TRANSACTIONS,
-    NVE4_HW_SM_QUERY_GST_MEM_DIV_REPLAY,
-    NVE4_HW_SM_QUERY_GRED_COUNT,
-    NVE4_HW_SM_QUERY_GST_REQUEST,
-    NVE4_HW_SM_QUERY_INST_EXECUTED,
-    NVE4_HW_SM_QUERY_INST_ISSUED,
-    NVE4_HW_SM_QUERY_INST_ISSUED1,
-    NVE4_HW_SM_QUERY_INST_ISSUED2,
-    NVE4_HW_SM_QUERY_L1_GLD_HIT,
-    NVE4_HW_SM_QUERY_L1_GLD_MISS,
-    NVE4_HW_SM_QUERY_L1_LOCAL_LD_HIT,
-    NVE4_HW_SM_QUERY_L1_LOCAL_LD_MISS,
-    NVE4_HW_SM_QUERY_L1_LOCAL_ST_HIT,
-    NVE4_HW_SM_QUERY_L1_LOCAL_ST_MISS,
-    NVE4_HW_SM_QUERY_L1_SHARED_LD_TRANSACTIONS,
-    NVE4_HW_SM_QUERY_L1_SHARED_ST_TRANSACTIONS,
-    NVE4_HW_SM_QUERY_LOCAL_LD,
-    NVE4_HW_SM_QUERY_LOCAL_LD_TRANSACTIONS,
-    NVE4_HW_SM_QUERY_LOCAL_ST,
-    NVE4_HW_SM_QUERY_LOCAL_ST_TRANSACTIONS,
-    NVE4_HW_SM_QUERY_PROF_TRIGGER_0,
-    NVE4_HW_SM_QUERY_PROF_TRIGGER_1,
-    NVE4_HW_SM_QUERY_PROF_TRIGGER_2,
-    NVE4_HW_SM_QUERY_PROF_TRIGGER_3,
-    NVE4_HW_SM_QUERY_PROF_TRIGGER_4,
-    NVE4_HW_SM_QUERY_PROF_TRIGGER_5,
-    NVE4_HW_SM_QUERY_PROF_TRIGGER_6,
-    NVE4_HW_SM_QUERY_PROF_TRIGGER_7,
-    NVE4_HW_SM_QUERY_SHARED_LD,
-    NVE4_HW_SM_QUERY_SHARED_LD_REPLAY,
-    NVE4_HW_SM_QUERY_SHARED_ST,
-    NVE4_HW_SM_QUERY_SHARED_ST_REPLAY,
-    NVE4_HW_SM_QUERY_SM_CTA_LAUNCHED,
-    NVE4_HW_SM_QUERY_THREADS_LAUNCHED,
-    NVE4_HW_SM_QUERY_UNCACHED_GLD_TRANSACTIONS,
-    NVE4_HW_SM_QUERY_WARPS_LAUNCHED,
-    NVE4_HW_SM_QUERY_METRIC_IPC,
-    NVE4_HW_SM_QUERY_METRIC_IPAC,
-    NVE4_HW_SM_QUERY_METRIC_IPEC,
-    NVE4_HW_SM_QUERY_METRIC_MP_OCCUPANCY,
-    NVE4_HW_SM_QUERY_METRIC_MP_EFFICIENCY,
-    NVE4_HW_SM_QUERY_METRIC_INST_REPLAY_OHEAD,
-    NVE4_HW_SM_QUERY_COUNT
-};
-
-#define NVC0_HW_SM_QUERY(i)    (PIPE_QUERY_DRIVER_SPECIFIC + 2048 + (i))
-#define NVC0_HW_SM_QUERY_LAST   NVC0_HW_SM_QUERY(NVC0_HW_SM_QUERY_COUNT - 1)
-enum nvc0_pm_queries
-{
-    NVC0_HW_SM_QUERY_ACTIVE_CYCLES = 0,
-    NVC0_HW_SM_QUERY_ACTIVE_WARPS,
-    NVC0_HW_SM_QUERY_ATOM_COUNT,
-    NVC0_HW_SM_QUERY_BRANCH,
-    NVC0_HW_SM_QUERY_DIVERGENT_BRANCH,
-    NVC0_HW_SM_QUERY_GLD_REQUEST,
-    NVC0_HW_SM_QUERY_GRED_COUNT,
-    NVC0_HW_SM_QUERY_GST_REQUEST,
-    NVC0_HW_SM_QUERY_INST_EXECUTED,
-    NVC0_HW_SM_QUERY_INST_ISSUED1_0,
-    NVC0_HW_SM_QUERY_INST_ISSUED1_1,
-    NVC0_HW_SM_QUERY_INST_ISSUED2_0,
-    NVC0_HW_SM_QUERY_INST_ISSUED2_1,
-    NVC0_HW_SM_QUERY_LOCAL_LD,
-    NVC0_HW_SM_QUERY_LOCAL_ST,
-    NVC0_HW_SM_QUERY_PROF_TRIGGER_0,
-    NVC0_HW_SM_QUERY_PROF_TRIGGER_1,
-    NVC0_HW_SM_QUERY_PROF_TRIGGER_2,
-    NVC0_HW_SM_QUERY_PROF_TRIGGER_3,
-    NVC0_HW_SM_QUERY_PROF_TRIGGER_4,
-    NVC0_HW_SM_QUERY_PROF_TRIGGER_5,
-    NVC0_HW_SM_QUERY_PROF_TRIGGER_6,
-    NVC0_HW_SM_QUERY_PROF_TRIGGER_7,
-    NVC0_HW_SM_QUERY_SHARED_LD,
-    NVC0_HW_SM_QUERY_SHARED_ST,
-    NVC0_HW_SM_QUERY_THREADS_LAUNCHED,
-    NVC0_HW_SM_QUERY_TH_INST_EXECUTED_0,
-    NVC0_HW_SM_QUERY_TH_INST_EXECUTED_1,
-    NVC0_HW_SM_QUERY_TH_INST_EXECUTED_2,
-    NVC0_HW_SM_QUERY_TH_INST_EXECUTED_3,
-    NVC0_HW_SM_QUERY_WARPS_LAUNCHED,
-    NVC0_HW_SM_QUERY_COUNT
-};
-
-/* Driver statistics queries:
- */
-#define NVC0_QUERY_DRV_STAT(i)    (PIPE_QUERY_DRIVER_SPECIFIC + 1024 + (i))
-#define NVC0_QUERY_DRV_STAT_LAST   NVC0_QUERY_DRV_STAT(NVC0_QUERY_DRV_STAT_COUNT - 1)
-enum nvc0_drv_stats_queries
-{
-#ifdef NOUVEAU_ENABLE_DRIVER_STATISTICS
-    NVC0_QUERY_DRV_STAT_TEX_OBJECT_CURRENT_COUNT = 0,
-    NVC0_QUERY_DRV_STAT_TEX_OBJECT_CURRENT_BYTES,
-    NVC0_QUERY_DRV_STAT_BUF_OBJECT_CURRENT_COUNT,
-    NVC0_QUERY_DRV_STAT_BUF_OBJECT_CURRENT_BYTES_VID,
-    NVC0_QUERY_DRV_STAT_BUF_OBJECT_CURRENT_BYTES_SYS,
-    NVC0_QUERY_DRV_STAT_TEX_TRANSFERS_READ,
-    NVC0_QUERY_DRV_STAT_TEX_TRANSFERS_WRITE,
-    NVC0_QUERY_DRV_STAT_TEX_COPY_COUNT,
-    NVC0_QUERY_DRV_STAT_TEX_BLIT_COUNT,
-    NVC0_QUERY_DRV_STAT_TEX_CACHE_FLUSH_COUNT,
-    NVC0_QUERY_DRV_STAT_BUF_TRANSFERS_READ,
-    NVC0_QUERY_DRV_STAT_BUF_TRANSFERS_WRITE,
-    NVC0_QUERY_DRV_STAT_BUF_READ_BYTES_STAGING_VID,
-    NVC0_QUERY_DRV_STAT_BUF_WRITE_BYTES_DIRECT,
-    NVC0_QUERY_DRV_STAT_BUF_WRITE_BYTES_STAGING_VID,
-    NVC0_QUERY_DRV_STAT_BUF_WRITE_BYTES_STAGING_SYS,
-    NVC0_QUERY_DRV_STAT_BUF_COPY_BYTES,
-    NVC0_QUERY_DRV_STAT_BUF_NON_KERNEL_FENCE_SYNC_COUNT,
-    NVC0_QUERY_DRV_STAT_ANY_NON_KERNEL_FENCE_SYNC_COUNT,
-    NVC0_QUERY_DRV_STAT_QUERY_SYNC_COUNT,
-    NVC0_QUERY_DRV_STAT_GPU_SERIALIZE_COUNT,
-    NVC0_QUERY_DRV_STAT_DRAW_CALLS_ARRAY,
-    NVC0_QUERY_DRV_STAT_DRAW_CALLS_INDEXED,
-    NVC0_QUERY_DRV_STAT_DRAW_CALLS_FALLBACK_COUNT,
-    NVC0_QUERY_DRV_STAT_USER_BUFFER_UPLOAD_BYTES,
-    NVC0_QUERY_DRV_STAT_CONSTBUF_UPLOAD_COUNT,
-    NVC0_QUERY_DRV_STAT_CONSTBUF_UPLOAD_BYTES,
-    NVC0_QUERY_DRV_STAT_PUSHBUF_COUNT,
-    NVC0_QUERY_DRV_STAT_RESOURCE_VALIDATE_COUNT,
-#endif
-    NVC0_QUERY_DRV_STAT_COUNT
-};
-
 int nvc0_screen_get_driver_query_info(struct pipe_screen *, unsigned,
                                       struct pipe_driver_query_info *);
 
diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_shader_state.c b/src/gallium/drivers/nouveau/nvc0/nvc0_shader_state.c
index 8f8ac2d..2fade98 100644
--- a/src/gallium/drivers/nouveau/nvc0/nvc0_shader_state.c
+++ b/src/gallium/drivers/nouveau/nvc0/nvc0_shader_state.c
@@ -272,14 +272,14 @@ nvc0_tfb_validate(struct nvc0_context *nvc0)
          continue;
 
       if (!targ->clean)
-         nvc0_query_fifo_wait(push, targ->pq);
+         nvc0_query_fifo_wait(push, nvc0_query(targ->pq));
       BEGIN_NVC0(push, NVC0_3D(TFB_BUFFER_ENABLE(b)), 5);
       PUSH_DATA (push, 1);
       PUSH_DATAh(push, buf->address + targ->pipe.buffer_offset);
       PUSH_DATA (push, buf->address + targ->pipe.buffer_offset);
       PUSH_DATA (push, targ->pipe.buffer_size);
       if (!targ->clean) {
-         nvc0_query_pushbuf_submit(push, targ->pq, 0x4);
+         nvc0_query_pushbuf_submit(push, nvc0_query(targ->pq), 0x4);
       } else {
          PUSH_DATA(push, 0); /* TFB_BUFFER_OFFSET */
          targ->clean = false;
diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_vbo.c b/src/gallium/drivers/nouveau/nvc0/nvc0_vbo.c
index 188c7d7..9be25cf 100644
--- a/src/gallium/drivers/nouveau/nvc0/nvc0_vbo.c
+++ b/src/gallium/drivers/nouveau/nvc0/nvc0_vbo.c
@@ -775,7 +775,7 @@ nvc0_draw_stream_output(struct nvc0_context *nvc0,
       res->status &= ~NOUVEAU_BUFFER_STATUS_GPU_WRITING;
       PUSH_SPACE(push, 2);
       IMMED_NVC0(push, NVC0_3D(SERIALIZE), 0);
-      nvc0_query_fifo_wait(push, so->pq);
+      nvc0_query_fifo_wait(push, nvc0_query(so->pq));
       if (nvc0->screen->eng3d->oclass < GM107_3D_CLASS)
          IMMED_NVC0(push, NVC0_3D(VERTEX_ARRAY_FLUSH), 0);
 
@@ -791,7 +791,7 @@ nvc0_draw_stream_output(struct nvc0_context *nvc0,
       BEGIN_NVC0(push, NVC0_3D(DRAW_TFB_STRIDE), 1);
       PUSH_DATA (push, so->stride);
       BEGIN_NVC0(push, NVC0_3D(DRAW_TFB_BYTES), 1);
-      nvc0_query_pushbuf_submit(push, so->pq, 0x4);
+      nvc0_query_pushbuf_submit(push, nvc0_query(so->pq), 0x4);
       IMMED_NVC0(push, NVC0_3D(VERTEX_END_GL), 0);
 
       mode |= NVC0_3D_VERTEX_BEGIN_GL_INSTANCE_NEXT;
-- 
2.6.0



More information about the mesa-dev mailing list