[Mesa-stable] [PATCH v2 2/2] gallium/hud: display the Celsius temperature unit

Brian Paul brianp at vmware.com
Fri Sep 4 11:42:32 PDT 2015


On 09/04/2015 12:30 PM, Benjamin Bellec wrote:
> Signed-off-by: Benjamin Bellec <b.bellec at gmail.com>
> ---
>   src/gallium/auxiliary/hud/hud_context.c | 4 ++++
>   1 file changed, 4 insertions(+)
>
> diff --git a/src/gallium/auxiliary/hud/hud_context.c b/src/gallium/auxiliary/hud/hud_context.c
> index 95eed26..71529bc 100644
> --- a/src/gallium/auxiliary/hud/hud_context.c
> +++ b/src/gallium/auxiliary/hud/hud_context.c
> @@ -243,6 +243,7 @@ number_to_human_readable(uint64_t num, uint64_t max_value,
>      static const char *hz_units[] =
>         {" Hz", " KHz", " MHz", " GHz"};
>      static const char *percent_units[] = {"%"};
> +   static const char *temperature_units[] = {"C"};
>
>      const char **units;
>      unsigned max_unit;
> @@ -271,6 +272,9 @@ number_to_human_readable(uint64_t num, uint64_t max_value,
>         if (max_value == 100) {
>            max_unit = ARRAY_SIZE(percent_units)-1;
>            units = percent_units;
> +      } else if (max_value == 125) {
> +         max_unit = ARRAY_SIZE(temperature_units)-1;
> +         units = temperature_units;
>         } else {
>            max_unit = ARRAY_SIZE(metric_units)-1;
>            units = metric_units;
>


This seems like a bit of a magic number approach here.  At the very 
least, this magic value should be documented somewhere. 
PIPE_DRIVER_QUERY_TYPE_TEMPERATURE seems better to me, actually.

-Brian



More information about the mesa-stable mailing list