From: Christian Gmeiner Date: Sun, 25 Mar 2018 20:30:06 +0000 (+0200) Subject: etnaviv: add query_group_info for perfmon counters X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=c320b158f516276fed27b793e5d77b78015a2b9b;p=mesa.git etnaviv: add query_group_info for perfmon counters Signed-off-by: Christian Gmeiner Tested-by: Chris Healy --- diff --git a/src/gallium/drivers/etnaviv/etnaviv_query_pm.c b/src/gallium/drivers/etnaviv/etnaviv_query_pm.c index 04d43c39818..981cfd2c4d1 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 23d125f2f7a..e80310cabf8 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