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

Benjamin Bellec b.bellec at gmail.com
Fri Sep 4 11:30:59 PDT 2015


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;
-- 
2.4.3



More information about the mesa-dev mailing list