[Mesa-dev] [PATCH v2 7/7] nv50: enable GL_AMD_performance_monitor
Samuel Pitoiset
samuel.pitoiset at gmail.com
Tue Jun 30 15:01:29 PDT 2015
This exposes a group of global performance counters that enables
GL_AMD_performance_monitor. All piglit tests are okay.
Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
---
src/gallium/drivers/nouveau/nv50/nv50_query.c | 35 ++++++++++++++++++++++++++
src/gallium/drivers/nouveau/nv50/nv50_screen.c | 1 +
src/gallium/drivers/nouveau/nv50/nv50_screen.h | 6 +++++
3 files changed, 42 insertions(+)
diff --git a/src/gallium/drivers/nouveau/nv50/nv50_query.c b/src/gallium/drivers/nouveau/nv50/nv50_query.c
index 7dadb77..6d57305 100644
--- a/src/gallium/drivers/nouveau/nv50/nv50_query.c
+++ b/src/gallium/drivers/nouveau/nv50/nv50_query.c
@@ -1563,6 +1563,7 @@ nv50_screen_get_driver_query_info(struct pipe_screen *pscreen,
info->name = cfg->event->name;
info->query_type = NV50_HW_PM_QUERY(id);
+ info->group_id = NV50_HW_PM_QUERY_GROUP;
info->max_value.u64 =
(cfg->event->display == NV50_HW_PM_EVENT_DISPLAY_RATIO) ? 100 : 0;
return 1;
@@ -1573,6 +1574,40 @@ nv50_screen_get_driver_query_info(struct pipe_screen *pscreen,
return 0;
}
+int
+nv50_screen_get_driver_query_group_info(struct pipe_screen *pscreen,
+ unsigned id,
+ struct pipe_driver_query_group_info *info)
+{
+ struct nv50_screen *screen = nv50_screen(pscreen);
+ int count = 0;
+
+ // TODO: Check DRM version when nvif will be merged in libdrm!
+ if (screen->base.perfmon) {
+ count++; /* NV50_HW_PM_QUERY_GROUP */
+ }
+
+ if (!info)
+ return count;
+
+ if (id == NV50_HW_PM_QUERY_GROUP) {
+ if (screen->base.perfmon) {
+ info->name = "Global performance counters";
+ info->type = PIPE_DRIVER_QUERY_GROUP_TYPE_GPU;
+ info->num_queries = NV50_HW_PM_QUERY_COUNT;
+ info->max_active_queries = 1; /* TODO: get rid of this limitation! */
+ return 1;
+ }
+ }
+
+ /* 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
nv50_init_query_functions(struct nv50_context *nv50)
{
diff --git a/src/gallium/drivers/nouveau/nv50/nv50_screen.c b/src/gallium/drivers/nouveau/nv50/nv50_screen.c
index ac1acd1..05f921d 100644
--- a/src/gallium/drivers/nouveau/nv50/nv50_screen.c
+++ b/src/gallium/drivers/nouveau/nv50/nv50_screen.c
@@ -749,6 +749,7 @@ nv50_screen_create(struct nouveau_device *dev)
pscreen->get_shader_param = nv50_screen_get_shader_param;
pscreen->get_paramf = nv50_screen_get_paramf;
pscreen->get_driver_query_info = nv50_screen_get_driver_query_info;
+ pscreen->get_driver_query_group_info = nv50_screen_get_driver_query_group_info;
nv50_screen_init_resource_functions(pscreen);
diff --git a/src/gallium/drivers/nouveau/nv50/nv50_screen.h b/src/gallium/drivers/nouveau/nv50/nv50_screen.h
index 69127c0..807ae0e 100644
--- a/src/gallium/drivers/nouveau/nv50/nv50_screen.h
+++ b/src/gallium/drivers/nouveau/nv50/nv50_screen.h
@@ -114,6 +114,9 @@ nv50_screen(struct pipe_screen *screen)
return (struct nv50_screen *)screen;
}
+/* Hardware global performance counters groups. */
+#define NV50_HW_PM_QUERY_GROUP 0
+
/* Hardware global performance counters. */
#define NV50_HW_PM_QUERY_COUNT 24
#define NV50_HW_PM_QUERY(i) (PIPE_QUERY_DRIVER_SPECIFIC + (i))
@@ -146,6 +149,9 @@ nv50_screen(struct pipe_screen *screen)
int nv50_screen_get_driver_query_info(struct pipe_screen *, unsigned,
struct pipe_driver_query_info *);
+int nv50_screen_get_driver_query_group_info(struct pipe_screen *, unsigned,
+ struct pipe_driver_query_group_info *);
+
boolean nv50_blitter_create(struct nv50_screen *);
void nv50_blitter_destroy(struct nv50_screen *);
--
2.4.4
More information about the mesa-dev
mailing list