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

Benjamin Bellec b.bellec at gmail.com
Fri Sep 4 11:57:17 PDT 2015


Currently, the temperature is displayed with a "%" symbol in gallium/hud,
which is quite odd.
Marek suggested to only change the value "100" to another value so that
this symbol is no more displayed. That works very well. This is the patch
#1. I choose "125" because it can be divided nicely by 5, then the
threshold displayed on the hud graph are 25/50/75/100/etc. And also because
with this, the actual temperature value is generally in the middle of the
graph.

This second patch is totally optional. It "catch" the value "125" in order
to display a "C" instead of nothing.

Ref. your suggestion on PIPE_DRIVER_QUERY_TYPE_TEMPERATURE, I'm not skilled
enough to answer.

2015-09-04 20:42 GMT+02:00 Brian Paul <brianp at vmware.com>:

> 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
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20150904/99cb2873/attachment.html>


More information about the mesa-dev mailing list