Hi Benjamin,

In my opinion, your commit message is a bit confusing....
I think you meant "unit" instead of "sign", right?

Besides, I'm not sure we want to add a new unit for temperature but I could live with it.
Marek, what do you think?

See my comments, below.

On 09/03/2015 09:43 PM, Benjamin Bellec wrote:
Signed-off-by: Benjamin Bellec <b.bel...@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},

Why did you increase the max value to 120? I'm just curious.

                {"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,

Don't forget to update 'enum pipe_query_result' just above.

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

This change is not needed because r600 doesn't currently expose GL_AMD_performance_monitor (a driver needs to expose a group of perf counters to enable it).

Please, drop this change for now.

              default:
                 unreachable("Invalid driver query type!");
           }

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to