[Mesa-dev] [PATCH 06/11] gallium: add new counter types to pipe_driver_query_info

Samuel Pitoiset samuel.pitoiset at gmail.com
Mon Jul 7 02:05:54 PDT 2014


On 07/06/2014 01:39 PM, Marek Olšák wrote:
> The same as patch 3 - this will break radeon.
>
> Marek
Thanks for your reviews, I'll fix the radeon part.
>
> On Sat, Jul 5, 2014 at 8:49 PM, Samuel Pitoiset
> <samuel.pitoiset at gmail.com> wrote:
>> This will be used by GL_AMD_performance_monitor.
>>
>> Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
>> ---
>>   src/gallium/auxiliary/hud/hud_driver_query.c  |  2 +-
>>   src/gallium/drivers/nouveau/nvc0/nvc0_query.c | 25 +++++++++++++++++--------
>>   src/gallium/include/pipe/p_defines.h          | 12 +++++++++++-
>>   3 files changed, 29 insertions(+), 10 deletions(-)
>>
>> diff --git a/src/gallium/auxiliary/hud/hud_driver_query.c b/src/gallium/auxiliary/hud/hud_driver_query.c
>> index b48708c..8d82208 100644
>> --- a/src/gallium/auxiliary/hud/hud_driver_query.c
>> +++ b/src/gallium/auxiliary/hud/hud_driver_query.c
>> @@ -205,6 +205,6 @@ hud_driver_query_install(struct hud_pane *pane, struct pipe_context *pipe,
>>         return FALSE;
>>
>>      hud_pipe_query_install(pane, pipe, query.name, query.query_type, 0,
>> -                      query.max_value, query.uses_byte_units);
>> +                      query.max_value.ui, query.uses_byte_units);
>>      return TRUE;
>>   }
>> diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_query.c b/src/gallium/drivers/nouveau/nvc0/nvc0_query.c
>> index 767db00..892e411 100644
>> --- a/src/gallium/drivers/nouveau/nvc0/nvc0_query.c
>> +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_query.c
>> @@ -1405,12 +1405,19 @@ nvc0_screen_get_driver_query_info(struct pipe_screen *pscreen,
>>      if (!info)
>>         return count;
>>
>> +   /* Init default parameters. */
>> +   info->min_value.ui = 0;
>> +   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];
>>         info->query_type = NVC0_QUERY_DRV_STAT(id);
>>         info->group_id = NVC0_QUERY_DRV_STAT_GROUP;
>> -      info->max_value = ~0ULL;
>> +      info->max_value.ui = ~0ULL;
>>         info->uses_byte_units = !!strstr(info->name, "bytes");
>>         return 1;
>>      } else
>> @@ -1420,17 +1427,21 @@ 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 = (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->min_value.f = 0.0;
>> +            info->max_value.f = 100.0;
>> +            info->is_float = 1;
>> +            info->is_percentage = 1;
>> +         }
>>            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->group_id = NVC0_QUERY_PM_GROUP;
>> -         info->max_value = ~0ULL;
>> -         info->uses_byte_units = FALSE;
>> +         info->max_value.ui = ~0ULL;
>>            return 1;
>>         }
>>      }
>> @@ -1438,8 +1449,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 = 0;
>> -   info->uses_byte_units = FALSE;
>>      return 0;
>>   }
>>
>> diff --git a/src/gallium/include/pipe/p_defines.h b/src/gallium/include/pipe/p_defines.h
>> index e8a6f1a..c34c3c0 100644
>> --- a/src/gallium/include/pipe/p_defines.h
>> +++ b/src/gallium/include/pipe/p_defines.h
>> @@ -727,12 +727,22 @@ union pipe_color_union
>>      unsigned int ui[4];
>>   };
>>
>> +union pipe_numeric_type_union
>> +{
>> +   double f;
>> +   uint64_t ui;
>> +   int64_t i;
>> +};
>> +
>>   struct pipe_driver_query_info
>>   {
>>      const char *name;
>>      unsigned query_type; /* PIPE_QUERY_DRIVER_SPECIFIC + i */
>>      unsigned group_id;
>> -   uint64_t max_value; /* max value that can be returned */
>> +   union pipe_numeric_type_union min_value; /* min value that can be returned */
>> +   union pipe_numeric_type_union max_value; /* max value that can be returned */
>> +   boolean is_percentage;
>> +   boolean is_float;
>>      boolean uses_byte_units; /* whether the result is in bytes */
>>   };
>>
>> --
>> 2.0.0
>>
>> _______________________________________________
>> mesa-dev mailing list
>> mesa-dev at lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/mesa-dev



More information about the mesa-dev mailing list