[Mesa-stable] [PATCH] fix temperature display sign in hud

Benjamin Bellec b.bellec at gmail.com
Thu Sep 3 12:43:46 PDT 2015


Signed-off-by: Benjamin Bellec <b.bellec at gmail.com>
---
 src/gallium/auxiliary/hud/hud_context.c       | 5 +++++
 src/gallium/drivers/radeon/r600_pipe_common.c | 2 +-
 src/gallium/include/pipe/p_defines.h          | 1 +
 src/mesa/state_tracker/st_cb_perfmon.c        | 5 +++++
 4 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/src/gallium/auxiliary/hud/hud_context.c b/src/gallium/auxiliary/hud/hud_context.c
index 95eed26..8cbd322 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;
@@ -267,6 +268,10 @@ number_to_human_readable(uint64_t num, uint64_t max_value,
       max_unit = ARRAY_SIZE(hz_units)-1;
       units = hz_units;
       break;
+   case PIPE_DRIVER_QUERY_TYPE_TEMPERATURE:
+      max_unit = ARRAY_SIZE(temperature_units)-1;
+      units = temperature_units;
+      break;
    default:
       if (max_value == 100) {
          max_unit = ARRAY_SIZE(percent_units)-1;
diff --git a/src/gallium/drivers/radeon/r600_pipe_common.c b/src/gallium/drivers/radeon/r600_pipe_common.c
index ed5d1da..d6155ac 100644
--- a/src/gallium/drivers/radeon/r600_pipe_common.c
+++ b/src/gallium/drivers/radeon/r600_pipe_common.c
@@ -722,7 +722,7 @@ static int r600_get_driver_query_info(struct pipe_screen *screen,
 		{"VRAM-usage", R600_QUERY_VRAM_USAGE, {rscreen->info.vram_size}, PIPE_DRIVER_QUERY_TYPE_BYTES},
 		{"GTT-usage", R600_QUERY_GTT_USAGE, {rscreen->info.gart_size}, PIPE_DRIVER_QUERY_TYPE_BYTES},
 		{"GPU-load", R600_QUERY_GPU_LOAD, {100}},
-		{"temperature", R600_QUERY_GPU_TEMPERATURE, {100}},
+		{"temperature", R600_QUERY_GPU_TEMPERATURE, {120}, PIPE_DRIVER_QUERY_TYPE_TEMPERATURE},
 		{"shader-clock", R600_QUERY_CURRENT_GPU_SCLK, {0}, PIPE_DRIVER_QUERY_TYPE_HZ},
 		{"memory-clock", R600_QUERY_CURRENT_GPU_MCLK, {0}, PIPE_DRIVER_QUERY_TYPE_HZ},
 	};
diff --git a/src/gallium/include/pipe/p_defines.h b/src/gallium/include/pipe/p_defines.h
index 88e37e9..2b0c6be 100644
--- a/src/gallium/include/pipe/p_defines.h
+++ b/src/gallium/include/pipe/p_defines.h
@@ -821,6 +821,7 @@ enum pipe_driver_query_type
    PIPE_DRIVER_QUERY_TYPE_BYTES        = 4,
    PIPE_DRIVER_QUERY_TYPE_MICROSECONDS = 5,
    PIPE_DRIVER_QUERY_TYPE_HZ           = 6,
+   PIPE_DRIVER_QUERY_TYPE_TEMPERATURE  = 7,
 };
 
 enum pipe_driver_query_group_type
diff --git a/src/mesa/state_tracker/st_cb_perfmon.c b/src/mesa/state_tracker/st_cb_perfmon.c
index 1bb5be3..2eec99b 100644
--- a/src/mesa/state_tracker/st_cb_perfmon.c
+++ b/src/mesa/state_tracker/st_cb_perfmon.c
@@ -383,6 +383,11 @@ st_init_perfmon(struct st_context *st)
                c->Maximum.f = 100.0f;
                c->Type = GL_PERCENTAGE_AMD;
                break;
+            case PIPE_DRIVER_QUERY_TYPE_TEMPERATURE:
+               c->Minimum.u32 = 0;
+               c->Maximum.u32 = 120;
+               c->Type = GL_UNSIGNED_INT;
+               break;
             default:
                unreachable("Invalid driver query type!");
          }
-- 
2.4.3



More information about the mesa-stable mailing list