[Mesa-dev] [PATCH 11/16] nvc0: use of new counter types

Samuel Pitoiset samuel.pitoiset at gmail.com
Mon Jul 7 08:47:41 PDT 2014


Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
---
 src/gallium/drivers/nouveau/nvc0/nvc0_query.c | 19 +++++++++++++------
 1 file changed, 13 insertions(+), 6 deletions(-)

diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_query.c b/src/gallium/drivers/nouveau/nvc0/nvc0_query.c
index 3e8c90b..2ce4378 100644
--- a/src/gallium/drivers/nouveau/nvc0/nvc0_query.c
+++ b/src/gallium/drivers/nouveau/nvc0/nvc0_query.c
@@ -1405,6 +1405,12 @@ nvc0_screen_get_driver_query_info(struct pipe_screen *pscreen,
    if (!info)
       return count;
 
+   /* Init default parameters. */
+   info->max_value.ui = 0;
+   info->is_percentage = 0;
+   info->is_float = 0;
+   info->uses_byte_units = FALSE;
+
 #ifdef NOUVEAU_ENABLE_DRIVER_STATISTICS
    if (id < NVC0_QUERY_DRV_STAT_COUNT) {
       info->name = nvc0_drv_stat_names[id];
@@ -1420,9 +1426,13 @@ nvc0_screen_get_driver_query_info(struct pipe_screen *pscreen,
          info->name = nve4_pm_query_names[id - NVC0_QUERY_DRV_STAT_COUNT];
          info->query_type = NVE4_PM_QUERY(id - NVC0_QUERY_DRV_STAT_COUNT);
          info->group_id = NVC0_QUERY_PM_GROUP;
-         info->max_value.ui = (id < NVE4_PM_QUERY_METRIC_MP_OCCUPANCY) ?
-            ~0ULL : 100;
-         info->uses_byte_units = FALSE;
+         if (id < NVE4_PM_QUERY_METRIC_MP_OCCUPANCY) {
+             info->max_value.ui = ~0ULL;
+         } else {
+             info->max_value.f = 100.0;
+             info->is_float = 1;
+             info->is_percentage = 1;
+         }
          return 1;
       } else
       if (screen->compute) {
@@ -1430,7 +1440,6 @@ nvc0_screen_get_driver_query_info(struct pipe_screen *pscreen,
          info->query_type = NVC0_PM_QUERY(id - NVC0_QUERY_DRV_STAT_COUNT);
          info->group_id = NVC0_QUERY_PM_GROUP;
          info->max_value.ui = ~0ULL;
-         info->uses_byte_units = FALSE;
          return 1;
       }
    }
@@ -1438,8 +1447,6 @@ nvc0_screen_get_driver_query_info(struct pipe_screen *pscreen,
    info->name = "this_is_not_the_query_you_are_looking_for";
    info->query_type = 0xdeadd01d;
    info->group_id = 0;
-   info->max_value.ui = 0;
-   info->uses_byte_units = FALSE;
    return 0;
 }
 
-- 
2.0.0



More information about the mesa-dev mailing list