nvc0: use enumerations for driver queries
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Fri, 28 Aug 2015 16:30:13 +0000 (18:30 +0200)
committerSamuel Pitoiset <samuel.pitoiset@gmail.com>
Sat, 29 Aug 2015 08:24:40 +0000 (10:24 +0200)
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
src/gallium/drivers/nouveau/nvc0/nvc0_screen.h

index 41008d229a1dd9f0b6d9cdc59c1c949e2e508e8b..cc671ef363af5407fd1a6f6477568808549e094a 100644 (file)
@@ -120,136 +120,139 @@ nvc0_screen(struct pipe_screen *screen)
 
 /* Performance counter queries:
  */
-#define NVE4_PM_QUERY_COUNT  49
 #define NVE4_PM_QUERY(i)    (PIPE_QUERY_DRIVER_SPECIFIC + (i))
 #define NVE4_PM_QUERY_LAST   NVE4_PM_QUERY(NVE4_PM_QUERY_COUNT - 1)
-#define NVE4_PM_QUERY_PROF_TRIGGER_0            0
-#define NVE4_PM_QUERY_PROF_TRIGGER_1            1
-#define NVE4_PM_QUERY_PROF_TRIGGER_2            2
-#define NVE4_PM_QUERY_PROF_TRIGGER_3            3
-#define NVE4_PM_QUERY_PROF_TRIGGER_4            4
-#define NVE4_PM_QUERY_PROF_TRIGGER_5            5
-#define NVE4_PM_QUERY_PROF_TRIGGER_6            6
-#define NVE4_PM_QUERY_PROF_TRIGGER_7            7
-#define NVE4_PM_QUERY_LAUNCHED_WARPS            8
-#define NVE4_PM_QUERY_LAUNCHED_THREADS          9
-#define NVE4_PM_QUERY_LAUNCHED_CTA              10
-#define NVE4_PM_QUERY_INST_ISSUED1              11
-#define NVE4_PM_QUERY_INST_ISSUED2              12
-#define NVE4_PM_QUERY_INST_EXECUTED             13
-#define NVE4_PM_QUERY_LD_LOCAL                  14
-#define NVE4_PM_QUERY_ST_LOCAL                  15
-#define NVE4_PM_QUERY_LD_SHARED                 16
-#define NVE4_PM_QUERY_ST_SHARED                 17
-#define NVE4_PM_QUERY_L1_LOCAL_LOAD_HIT         18
-#define NVE4_PM_QUERY_L1_LOCAL_LOAD_MISS        19
-#define NVE4_PM_QUERY_L1_LOCAL_STORE_HIT        20
-#define NVE4_PM_QUERY_L1_LOCAL_STORE_MISS       21
-#define NVE4_PM_QUERY_GLD_REQUEST               22
-#define NVE4_PM_QUERY_GST_REQUEST               23
-#define NVE4_PM_QUERY_L1_GLOBAL_LOAD_HIT        24
-#define NVE4_PM_QUERY_L1_GLOBAL_LOAD_MISS       25
-#define NVE4_PM_QUERY_GLD_TRANSACTIONS_UNCACHED 26
-#define NVE4_PM_QUERY_GST_TRANSACTIONS          27
-#define NVE4_PM_QUERY_BRANCH                    28
-#define NVE4_PM_QUERY_BRANCH_DIVERGENT          29
-#define NVE4_PM_QUERY_ACTIVE_WARPS              30
-#define NVE4_PM_QUERY_ACTIVE_CYCLES             31
-#define NVE4_PM_QUERY_INST_ISSUED               32
-#define NVE4_PM_QUERY_ATOM_COUNT                33
-#define NVE4_PM_QUERY_GRED_COUNT                34
-#define NVE4_PM_QUERY_LD_SHARED_REPLAY          35
-#define NVE4_PM_QUERY_ST_SHARED_REPLAY          36
-#define NVE4_PM_QUERY_LD_LOCAL_TRANSACTIONS     37
-#define NVE4_PM_QUERY_ST_LOCAL_TRANSACTIONS     38
-#define NVE4_PM_QUERY_L1_LD_SHARED_TRANSACTIONS 39
-#define NVE4_PM_QUERY_L1_ST_SHARED_TRANSACTIONS 40
-#define NVE4_PM_QUERY_GLD_MEM_DIV_REPLAY        41
-#define NVE4_PM_QUERY_GST_MEM_DIV_REPLAY        42
-#define NVE4_PM_QUERY_METRIC_IPC                43
-#define NVE4_PM_QUERY_METRIC_IPAC               44
-#define NVE4_PM_QUERY_METRIC_IPEC               45
-#define NVE4_PM_QUERY_METRIC_MP_OCCUPANCY       46
-#define NVE4_PM_QUERY_METRIC_MP_EFFICIENCY      47
-#define NVE4_PM_QUERY_METRIC_INST_REPLAY_OHEAD  48
-
-#define NVC0_PM_QUERY_COUNT 31
+enum nve4_pm_queries
+{
+    NVE4_PM_QUERY_PROF_TRIGGER_0 = 0,
+    NVE4_PM_QUERY_PROF_TRIGGER_1,
+    NVE4_PM_QUERY_PROF_TRIGGER_2,
+    NVE4_PM_QUERY_PROF_TRIGGER_3,
+    NVE4_PM_QUERY_PROF_TRIGGER_4,
+    NVE4_PM_QUERY_PROF_TRIGGER_5,
+    NVE4_PM_QUERY_PROF_TRIGGER_6,
+    NVE4_PM_QUERY_PROF_TRIGGER_7,
+    NVE4_PM_QUERY_LAUNCHED_WARPS,
+    NVE4_PM_QUERY_LAUNCHED_THREADS,
+    NVE4_PM_QUERY_LAUNCHED_CTA,
+    NVE4_PM_QUERY_INST_ISSUED1,
+    NVE4_PM_QUERY_INST_ISSUED2,
+    NVE4_PM_QUERY_INST_EXECUTED,
+    NVE4_PM_QUERY_LD_LOCAL,
+    NVE4_PM_QUERY_ST_LOCAL,
+    NVE4_PM_QUERY_LD_SHARED,
+    NVE4_PM_QUERY_ST_SHARED,
+    NVE4_PM_QUERY_L1_LOCAL_LOAD_HIT,
+    NVE4_PM_QUERY_L1_LOCAL_LOAD_MISS,
+    NVE4_PM_QUERY_L1_LOCAL_STORE_HIT,
+    NVE4_PM_QUERY_L1_LOCAL_STORE_MISS,
+    NVE4_PM_QUERY_GLD_REQUEST,
+    NVE4_PM_QUERY_GST_REQUEST,
+    NVE4_PM_QUERY_L1_GLOBAL_LOAD_HIT,
+    NVE4_PM_QUERY_L1_GLOBAL_LOAD_MISS,
+    NVE4_PM_QUERY_GLD_TRANSACTIONS_UNCACHED,
+    NVE4_PM_QUERY_GST_TRANSACTIONS,
+    NVE4_PM_QUERY_BRANCH,
+    NVE4_PM_QUERY_BRANCH_DIVERGENT,
+    NVE4_PM_QUERY_ACTIVE_WARPS,
+    NVE4_PM_QUERY_ACTIVE_CYCLES,
+    NVE4_PM_QUERY_INST_ISSUED,
+    NVE4_PM_QUERY_ATOM_COUNT,
+    NVE4_PM_QUERY_GRED_COUNT,
+    NVE4_PM_QUERY_LD_SHARED_REPLAY,
+    NVE4_PM_QUERY_ST_SHARED_REPLAY,
+    NVE4_PM_QUERY_LD_LOCAL_TRANSACTIONS,
+    NVE4_PM_QUERY_ST_LOCAL_TRANSACTIONS,
+    NVE4_PM_QUERY_L1_LD_SHARED_TRANSACTIONS,
+    NVE4_PM_QUERY_L1_ST_SHARED_TRANSACTIONS,
+    NVE4_PM_QUERY_GLD_MEM_DIV_REPLAY,
+    NVE4_PM_QUERY_GST_MEM_DIV_REPLAY,
+    NVE4_PM_QUERY_METRIC_IPC,
+    NVE4_PM_QUERY_METRIC_IPAC,
+    NVE4_PM_QUERY_METRIC_IPEC,
+    NVE4_PM_QUERY_METRIC_MP_OCCUPANCY,
+    NVE4_PM_QUERY_METRIC_MP_EFFICIENCY,
+    NVE4_PM_QUERY_METRIC_INST_REPLAY_OHEAD,
+    NVE4_PM_QUERY_COUNT
+};
+
 #define NVC0_PM_QUERY(i)    (PIPE_QUERY_DRIVER_SPECIFIC + 2048 + (i))
 #define NVC0_PM_QUERY_LAST   NVC0_PM_QUERY(NVC0_PM_QUERY_COUNT - 1)
-#define NVC0_PM_QUERY_INST_EXECUTED             0
-#define NVC0_PM_QUERY_BRANCH                    1
-#define NVC0_PM_QUERY_BRANCH_DIVERGENT          2
-#define NVC0_PM_QUERY_ACTIVE_WARPS              3
-#define NVC0_PM_QUERY_ACTIVE_CYCLES             4
-#define NVC0_PM_QUERY_LAUNCHED_WARPS            5
-#define NVC0_PM_QUERY_LAUNCHED_THREADS          6
-#define NVC0_PM_QUERY_LD_SHARED                 7
-#define NVC0_PM_QUERY_ST_SHARED                 8
-#define NVC0_PM_QUERY_LD_LOCAL                  9
-#define NVC0_PM_QUERY_ST_LOCAL                  10
-#define NVC0_PM_QUERY_GRED_COUNT                11
-#define NVC0_PM_QUERY_ATOM_COUNT                12
-#define NVC0_PM_QUERY_GLD_REQUEST               13
-#define NVC0_PM_QUERY_GST_REQUEST               14
-#define NVC0_PM_QUERY_INST_ISSUED1_0            15
-#define NVC0_PM_QUERY_INST_ISSUED1_1            16
-#define NVC0_PM_QUERY_INST_ISSUED2_0            17
-#define NVC0_PM_QUERY_INST_ISSUED2_1            18
-#define NVC0_PM_QUERY_TH_INST_EXECUTED_0        19
-#define NVC0_PM_QUERY_TH_INST_EXECUTED_1        20
-#define NVC0_PM_QUERY_TH_INST_EXECUTED_2        21
-#define NVC0_PM_QUERY_TH_INST_EXECUTED_3        22
-#define NVC0_PM_QUERY_PROF_TRIGGER_0            23
-#define NVC0_PM_QUERY_PROF_TRIGGER_1            24
-#define NVC0_PM_QUERY_PROF_TRIGGER_2            25
-#define NVC0_PM_QUERY_PROF_TRIGGER_3            26
-#define NVC0_PM_QUERY_PROF_TRIGGER_4            27
-#define NVC0_PM_QUERY_PROF_TRIGGER_5            28
-#define NVC0_PM_QUERY_PROF_TRIGGER_6            29
-#define NVC0_PM_QUERY_PROF_TRIGGER_7            30
+enum nvc0_pm_queries
+{
+    NVC0_PM_QUERY_INST_EXECUTED = 0,
+    NVC0_PM_QUERY_BRANCH,
+    NVC0_PM_QUERY_BRANCH_DIVERGENT,
+    NVC0_PM_QUERY_ACTIVE_WARPS,
+    NVC0_PM_QUERY_ACTIVE_CYCLES,
+    NVC0_PM_QUERY_LAUNCHED_WARPS,
+    NVC0_PM_QUERY_LAUNCHED_THREADS,
+    NVC0_PM_QUERY_LD_SHARED,
+    NVC0_PM_QUERY_ST_SHARED,
+    NVC0_PM_QUERY_LD_LOCAL,
+    NVC0_PM_QUERY_ST_LOCAL,
+    NVC0_PM_QUERY_GRED_COUNT,
+    NVC0_PM_QUERY_ATOM_COUNT,
+    NVC0_PM_QUERY_GLD_REQUEST,
+    NVC0_PM_QUERY_GST_REQUEST,
+    NVC0_PM_QUERY_INST_ISSUED1_0,
+    NVC0_PM_QUERY_INST_ISSUED1_1,
+    NVC0_PM_QUERY_INST_ISSUED2_0,
+    NVC0_PM_QUERY_INST_ISSUED2_1,
+    NVC0_PM_QUERY_TH_INST_EXECUTED_0,
+    NVC0_PM_QUERY_TH_INST_EXECUTED_1,
+    NVC0_PM_QUERY_TH_INST_EXECUTED_2,
+    NVC0_PM_QUERY_TH_INST_EXECUTED_3,
+    NVC0_PM_QUERY_PROF_TRIGGER_0,
+    NVC0_PM_QUERY_PROF_TRIGGER_1,
+    NVC0_PM_QUERY_PROF_TRIGGER_2,
+    NVC0_PM_QUERY_PROF_TRIGGER_3,
+    NVC0_PM_QUERY_PROF_TRIGGER_4,
+    NVC0_PM_QUERY_PROF_TRIGGER_5,
+    NVC0_PM_QUERY_PROF_TRIGGER_6,
+    NVC0_PM_QUERY_PROF_TRIGGER_7,
+    NVC0_PM_QUERY_COUNT
+};
 
 /* Driver statistics queries:
  */
-#ifdef NOUVEAU_ENABLE_DRIVER_STATISTICS
-
 #define NVC0_QUERY_DRV_STAT(i)    (PIPE_QUERY_DRIVER_SPECIFIC + 1024 + (i))
-#define NVC0_QUERY_DRV_STAT_COUNT  29
 #define NVC0_QUERY_DRV_STAT_LAST   NVC0_QUERY_DRV_STAT(NVC0_QUERY_DRV_STAT_COUNT - 1)
-#define NVC0_QUERY_DRV_STAT_TEX_OBJECT_CURRENT_COUNT         0
-#define NVC0_QUERY_DRV_STAT_TEX_OBJECT_CURRENT_BYTES         1
-#define NVC0_QUERY_DRV_STAT_BUF_OBJECT_CURRENT_COUNT         2
-#define NVC0_QUERY_DRV_STAT_BUF_OBJECT_CURRENT_BYTES_VID     3
-#define NVC0_QUERY_DRV_STAT_BUF_OBJECT_CURRENT_BYTES_SYS     4
-#define NVC0_QUERY_DRV_STAT_TEX_TRANSFERS_READ               5
-#define NVC0_QUERY_DRV_STAT_TEX_TRANSFERS_WRITE              6
-#define NVC0_QUERY_DRV_STAT_TEX_COPY_COUNT                   7
-#define NVC0_QUERY_DRV_STAT_TEX_BLIT_COUNT                   8
-#define NVC0_QUERY_DRV_STAT_TEX_CACHE_FLUSH_COUNT            9
-#define NVC0_QUERY_DRV_STAT_BUF_TRANSFERS_READ              10
-#define NVC0_QUERY_DRV_STAT_BUF_TRANSFERS_WRITE             11
-#define NVC0_QUERY_DRV_STAT_BUF_READ_BYTES_STAGING_VID      12
-#define NVC0_QUERY_DRV_STAT_BUF_WRITE_BYTES_DIRECT          13
-#define NVC0_QUERY_DRV_STAT_BUF_WRITE_BYTES_STAGING_VID     14
-#define NVC0_QUERY_DRV_STAT_BUF_WRITE_BYTES_STAGING_SYS     15
-#define NVC0_QUERY_DRV_STAT_BUF_COPY_BYTES                  16
-#define NVC0_QUERY_DRV_STAT_BUF_NON_KERNEL_FENCE_SYNC_COUNT 17
-#define NVC0_QUERY_DRV_STAT_ANY_NON_KERNEL_FENCE_SYNC_COUNT 18
-#define NVC0_QUERY_DRV_STAT_QUERY_SYNC_COUNT                19
-#define NVC0_QUERY_DRV_STAT_GPU_SERIALIZE_COUNT             20
-#define NVC0_QUERY_DRV_STAT_DRAW_CALLS_ARRAY                21
-#define NVC0_QUERY_DRV_STAT_DRAW_CALLS_INDEXED              22
-#define NVC0_QUERY_DRV_STAT_DRAW_CALLS_FALLBACK_COUNT       23
-#define NVC0_QUERY_DRV_STAT_USER_BUFFER_UPLOAD_BYTES        24
-#define NVC0_QUERY_DRV_STAT_CONSTBUF_UPLOAD_COUNT           25
-#define NVC0_QUERY_DRV_STAT_CONSTBUF_UPLOAD_BYTES           26
-#define NVC0_QUERY_DRV_STAT_PUSHBUF_COUNT                   27
-#define NVC0_QUERY_DRV_STAT_RESOURCE_VALIDATE_COUNT         28
-
-#else
-
-#define NVC0_QUERY_DRV_STAT_COUNT 0
-
+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 *);