[Mesa-dev] [PATCH 08/16] nvc0: implement pipe_context::get_driver_query_group_info
Samuel Pitoiset
samuel.pitoiset at gmail.com
Mon Jul 7 08:47:38 PDT 2014
This adds two groups of queries.
Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
---
src/gallium/drivers/nouveau/nvc0/nvc0_query.c | 52 ++++++++++++++++++++++++++
src/gallium/drivers/nouveau/nvc0/nvc0_screen.c | 1 +
src/gallium/drivers/nouveau/nvc0/nvc0_screen.h | 3 ++
3 files changed, 56 insertions(+)
diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_query.c b/src/gallium/drivers/nouveau/nvc0/nvc0_query.c
index 9f40256..c0824c8 100644
--- a/src/gallium/drivers/nouveau/nvc0/nvc0_query.c
+++ b/src/gallium/drivers/nouveau/nvc0/nvc0_query.c
@@ -1443,6 +1443,58 @@ nvc0_screen_get_driver_query_info(struct pipe_screen *pscreen,
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;
+
+#ifdef NOUVEAU_ENABLE_DRIVER_STATISTICS
+ if (id == NVC0_QUERY_DRV_STAT_GROUP) {
+ info->name = "Driver statistics";
+ info->max_active_queries = 8;
+ info->num_queries = NVC0_QUERY_DRV_STAT_COUNT;
+ return 1;
+ } else
+#endif
+ if (id == NVC0_QUERY_PM_GROUP) {
+ info->name = "Performance counters";
+ info->max_active_queries = 8; /* 8 MP counters for NVC0+ */
+
+ if (screen->base.class_3d >= NVE4_3D_CLASS) {
+ info->num_queries = NVE4_PM_QUERY_COUNT;
+ return 1;
+ } else
+ if (screen->compute) {
+ info->num_queries = NVC0_PM_QUERY_COUNT;
+ 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;
+ 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 dc9b143..63924b4 100644
--- a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
+++ b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
@@ -620,6 +620,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 fc3b73c..405187c 100644
--- a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.h
+++ b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.h
@@ -250,6 +250,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 *);
--
2.0.0
More information about the mesa-dev
mailing list