[PATCH 11/12] etnaviv: add query_group_info for perfmon counters

Christian Gmeiner christian.gmeiner at gmail.com
Sun Mar 25 20:30:06 UTC 2018


Signed-off-by: Christian Gmeiner <christian.gmeiner at gmail.com>
---
 src/gallium/drivers/etnaviv/etnaviv_query_pm.c | 45 ++++++++++++++++++++++++++
 src/gallium/drivers/etnaviv/etnaviv_query_pm.h |  5 +++
 2 files changed, 50 insertions(+)

diff --git a/src/gallium/drivers/etnaviv/etnaviv_query_pm.c b/src/gallium/drivers/etnaviv/etnaviv_query_pm.c
index d5871f8f86..644b8fe6ca 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_query_pm.c
+++ b/src/gallium/drivers/etnaviv/etnaviv_query_pm.c
@@ -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;
+}
diff --git a/src/gallium/drivers/etnaviv/etnaviv_query_pm.h b/src/gallium/drivers/etnaviv/etnaviv_query_pm.h
index 23d125f2f7..e80310cabf 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_query_pm.h
+++ b/src/gallium/drivers/etnaviv/etnaviv_query_pm.h
@@ -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
-- 
2.14.3



More information about the etnaviv mailing list