if (id == NVC0_HW_SM_QUERY_GROUP) {
if (screen->compute) {
info->name = "MP counters";
- info->type = PIPE_DRIVER_QUERY_GROUP_TYPE_GPU;
/* Because we can't expose the number of hardware counters needed for
* each different query, we don't want to allow more than one active
if (screen->compute) {
if (screen->base.class_3d < NVE4_3D_CLASS) {
info->name = "Performance metrics";
- info->type = PIPE_DRIVER_QUERY_GROUP_TYPE_GPU;
info->max_active_queries = 1;
info->num_queries = NVC0_HW_METRIC_QUERY_COUNT;
return 1;
#ifdef NOUVEAU_ENABLE_DRIVER_STATISTICS
else if (id == NVC0_SW_QUERY_DRV_STAT_GROUP) {
info->name = "Driver statistics";
- info->type = PIPE_DRIVER_QUERY_GROUP_TYPE_CPU;
info->max_active_queries = NVC0_SW_QUERY_DRV_STAT_COUNT;
info->num_queries = NVC0_SW_QUERY_DRV_STAT_COUNT;
return 1;
info->name = "this_is_not_the_query_group_you_are_looking_for";
info->max_active_queries = 0;
info->num_queries = 0;
- info->type = 0;
return 0;
}
PIPE_DRIVER_QUERY_TYPE_HZ = 6,
};
-enum pipe_driver_query_group_type
-{
- PIPE_DRIVER_QUERY_GROUP_TYPE_CPU = 0,
- PIPE_DRIVER_QUERY_GROUP_TYPE_GPU = 1,
-};
-
/* Whether an average value per frame or a cumulative value should be
* displayed.
*/
struct pipe_driver_query_group_info
{
const char *name;
- enum pipe_driver_query_group_type type;
unsigned max_active_queries;
unsigned num_queries;
};
return type;
}
-/**
- * Return TRUE if the underlying driver expose GPU counters.
- */
-static bool
-has_gpu_counters(struct pipe_screen *screen)
-{
- int num_groups, gid;
-
- num_groups = screen->get_driver_query_group_info(screen, 0, NULL);
- for (gid = 0; gid < num_groups; gid++) {
- struct pipe_driver_query_group_info group_info;
-
- if (!screen->get_driver_query_group_info(screen, gid, &group_info))
- continue;
-
- if (group_info.type == PIPE_DRIVER_QUERY_GROUP_TYPE_GPU)
- return true;
- }
- return false;
-}
-
static bool
init_perf_monitor(struct gl_context *ctx, struct gl_perf_monitor_object *m)
{
if (!screen->get_driver_query_info || !screen->get_driver_query_group_info)
return false;
- if (!has_gpu_counters(screen)) {
- /* According to the spec, GL_AMD_performance_monitor must only
- * expose GPU counters. */
- return false;
- }
-
/* Get the number of available queries. */
num_counters = screen->get_driver_query_info(screen, 0, NULL);
if (!num_counters)
if (!screen->get_driver_query_group_info(screen, gid, &group_info))
continue;
- if (group_info.type != PIPE_DRIVER_QUERY_GROUP_TYPE_GPU)
- continue;
-
g->Name = group_info.name;
g->MaxActiveCounters = group_info.max_active_queries;
g->NumCounters = 0;