aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/nouveau/nvc0
diff options
context:
space:
mode:
authorSamuel Pitoiset <[email protected]>2014-07-04 11:43:53 +0200
committerMartin Peres <[email protected]>2015-05-06 00:03:36 +0300
commited7d3886cc25240ad92055b7813e038ba1a5e77c (patch)
treeb9babd8e106da682ee2a34c1cf4d8c7fe722894e /src/gallium/drivers/nouveau/nvc0
parent4cd1cfb9831d4d4081cbe80b0d72b340c8fd0c2c (diff)
nvc0: define driver-specific query groups
This patch defines "Driver statistics" and "MP counters" groups, but only the latter will be exposed through GL_AMD_performance_monitor. Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Martin Peres <[email protected]>
Diffstat (limited to 'src/gallium/drivers/nouveau/nvc0')
-rw-r--r--src/gallium/drivers/nouveau/nvc0/nvc0_query.c67
-rw-r--r--src/gallium/drivers/nouveau/nvc0/nvc0_screen.c1
-rw-r--r--src/gallium/drivers/nouveau/nvc0/nvc0_screen.h8
3 files changed, 76 insertions, 0 deletions
diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_query.c b/src/gallium/drivers/nouveau/nvc0/nvc0_query.c
index 01e7b37b55f..071d1793816 100644
--- a/src/gallium/drivers/nouveau/nvc0/nvc0_query.c
+++ b/src/gallium/drivers/nouveau/nvc0/nvc0_query.c
@@ -1422,6 +1422,7 @@ nvc0_screen_get_driver_query_info(struct pipe_screen *pscreen,
info->max_value.u64 = 0;
if (strstr(info->name, "bytes"))
info->type = PIPE_DRIVER_QUERY_TYPE_BYTES;
+ info->group_id = NVC0_QUERY_DRV_STAT_GROUP;
return 1;
} else
#endif
@@ -1431,22 +1432,88 @@ nvc0_screen_get_driver_query_info(struct pipe_screen *pscreen,
info->query_type = NVE4_PM_QUERY(id - NVC0_QUERY_DRV_STAT_COUNT);
info->max_value.u64 =
(id < NVE4_PM_QUERY_METRIC_MP_OCCUPANCY) ? 0 : 100;
+ info->group_id = NVC0_QUERY_MP_COUNTER_GROUP;
return 1;
} else
if (screen->compute) {
info->name = nvc0_pm_query_names[id - NVC0_QUERY_DRV_STAT_COUNT];
info->query_type = NVC0_PM_QUERY(id - NVC0_QUERY_DRV_STAT_COUNT);
info->max_value.u64 = 0;
+ info->group_id = NVC0_QUERY_MP_COUNTER_GROUP;
return 1;
}
}
/* user asked for info about non-existing query */
info->name = "this_is_not_the_query_you_are_looking_for";
info->query_type = 0xdeadd01d;
+ info->group_id = -1;
info->max_value.u64 = 0;
return 0;
}
+int
+nvc0_screen_get_driver_query_group_info(struct pipe_screen *pscreen,
+ unsigned id,
+ struct pipe_driver_query_group_info *info)
+{
+ struct nvc0_screen *screen = nvc0_screen(pscreen);
+ int count = 0;
+
+#ifdef NOUVEAU_ENABLE_DRIVER_STATISTICS
+ count++;
+#endif
+
+ if (screen->base.device->drm_version >= 0x01000101) {
+ if (screen->base.class_3d >= NVE4_3D_CLASS) {
+ count++;
+ } else if (screen->compute) {
+ count++; /* NVC0_COMPUTE is not always enabled */
+ }
+ }
+
+ if (!info)
+ return count;
+
+ if (id == NVC0_QUERY_MP_COUNTER_GROUP) {
+ info->name = "MP counters";
+ info->type = PIPE_DRIVER_QUERY_GROUP_TYPE_GPU;
+
+ if (screen->base.class_3d >= NVE4_3D_CLASS) {
+ info->num_queries = NVE4_PM_QUERY_COUNT;
+
+ /* On NVE4+, each multiprocessor have 8 hardware counters separated
+ * in two distinct domains, but we allow only one active query
+ * simultaneously because some of them use more than one hardware
+ * counter and this will result in an undefined behaviour. */
+ info->max_active_queries = 1; /* TODO: handle multiple hw counters */
+ return 1;
+ } else if (screen->compute) {
+ info->num_queries = NVC0_PM_QUERY_COUNT;
+
+ /* On NVC0:NVE4, each multiprocessor have 8 hardware counters
+ * in a single domain. */
+ info->max_active_queries = 8;
+ return 1;
+ }
+ }
+#ifdef NOUVEAU_ENABLE_DRIVER_STATISTICS
+ else if (id == NVC0_QUERY_DRV_STAT_GROUP) {
+ info->name = "Driver statistics";
+ info->type = PIPE_DRIVER_QUERY_GROUP_TYPE_CPU;
+ info->max_active_queries = NVC0_QUERY_DRV_STAT_COUNT;
+ info->num_queries = NVC0_QUERY_DRV_STAT_COUNT;
+ return 1;
+ }
+#endif
+
+ /* user asked for info about non-existing query group */
+ 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;
+}
+
void
nvc0_init_query_functions(struct nvc0_context *nvc0)
{
diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
index 7a9f649c487..748c9e7c8b9 100644
--- a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
+++ b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
@@ -651,6 +651,7 @@ nvc0_screen_create(struct nouveau_device *dev)
pscreen->get_shader_param = nvc0_screen_get_shader_param;
pscreen->get_paramf = nvc0_screen_get_paramf;
pscreen->get_driver_query_info = nvc0_screen_get_driver_query_info;
+ pscreen->get_driver_query_group_info = nvc0_screen_get_driver_query_group_info;
nvc0_screen_init_resource_functions(pscreen);
diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.h b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.h
index 8a1991f52eb..1a7d5027a7c 100644
--- a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.h
+++ b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.h
@@ -86,6 +86,11 @@ nvc0_screen(struct pipe_screen *screen)
return (struct nvc0_screen *)screen;
}
+/*
+ * Performance counters groups:
+ */
+#define NVC0_QUERY_MP_COUNTER_GROUP 0
+#define NVC0_QUERY_DRV_STAT_GROUP 1
/* Performance counter queries:
*/
@@ -243,6 +248,9 @@ nvc0_screen(struct pipe_screen *screen)
int nvc0_screen_get_driver_query_info(struct pipe_screen *, unsigned,
struct pipe_driver_query_info *);
+int nvc0_screen_get_driver_query_group_info(struct pipe_screen *, unsigned,
+ struct pipe_driver_query_group_info *);
+
boolean nvc0_blitter_create(struct nvc0_screen *);
void nvc0_blitter_destroy(struct nvc0_screen *);