etnaviv: add query_group_info for perfmon counters
authorChristian Gmeiner <christian.gmeiner@gmail.com>
Sun, 25 Mar 2018 20:30:06 +0000 (22:30 +0200)
committerChristian Gmeiner <christian.gmeiner@gmail.com>
Sun, 8 Apr 2018 20:23:38 +0000 (22:23 +0200)
Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Tested-by: Chris Healy <cphealy@gmail.com>
src/gallium/drivers/etnaviv/etnaviv_query_pm.c
src/gallium/drivers/etnaviv/etnaviv_query_pm.h

index 04d43c3981837756e4c2f929de983dfcd8779039..981cfd2c4d175be791a654a7b56549e54b3e4da6 100644 (file)
@@ -46,6 +46,17 @@ struct etna_perfmon_config
    const struct etna_perfmon_source *source;
 };
 
+static const char *group_names[] = {
+   [ETNA_QUERY_HI_GROUP_ID] = "HI",
+   [ETNA_QUERY_PE_GROUP_ID] = "PE",
+   [ETNA_QUERY_SH_GROUP_ID] = "SH",
+   [ETNA_QUERY_PA_GROUP_ID] = "PA",
+   [ETNA_QUERY_SE_GROUP_ID] = "SE",
+   [ETNA_QUERY_RA_GROUP_ID] = "RA",
+   [ETNA_QUERY_TX_GROUP_ID] = "TX",
+   [ETNA_QUERY_MC_GROUP_ID] = "MC",
+};
+
 static const struct etna_perfmon_config query_config[] = {
    {
       .name = "hi-total-cyles",
@@ -631,3 +642,37 @@ etna_pm_get_driver_query_info(struct pipe_screen *pscreen, unsigned index,
 
    return 1;
 }
+
+static
+unsigned query_count(unsigned group)
+{
+   unsigned count = 0;
+
+   for (unsigned i = 0; i < ARRAY_SIZE(query_config); i++)
+      if (query_config[i].group_id == group)
+         count++;
+
+   assert(count);
+
+   return count;
+}
+
+int
+etna_pm_get_driver_query_group_info(struct pipe_screen *pscreen,
+                                    unsigned index,
+                                    struct pipe_driver_query_group_info *info)
+{
+   if (!info)
+      return ARRAY_SIZE(group_names);
+
+   if (index >= ARRAY_SIZE(group_names))
+      return 0;
+
+   unsigned count = query_count(index);
+
+   info->name = group_names[index];
+   info->max_active_queries = count;
+   info->num_queries = count;
+
+   return 1;
+}
index 23d125f2f7a16cfd44391a42b74e14854f983f44..e80310cabf833a827abdc111b2dc64b00a791d89 100644 (file)
@@ -121,4 +121,9 @@ int
 etna_pm_get_driver_query_info(struct pipe_screen *pscreen, unsigned index,
                               struct pipe_driver_query_info *info);
 
+int
+etna_pm_get_driver_query_group_info(struct pipe_screen *pscreen,
+                                    unsigned index,
+                                    struct pipe_driver_query_group_info *info);
+
 #endif