{"num-bytes-moved", R600_QUERY_NUM_BYTES_MOVED, 0, TRUE},
{"VRAM-usage", R600_QUERY_VRAM_USAGE, rscreen->info.vram_size, TRUE},
{"GTT-usage", R600_QUERY_GTT_USAGE, rscreen->info.gart_size, TRUE},
+ {"temperature", R600_QUERY_GPU_TEMPERATURE, 100, FALSE},
+ {"shader-clock", R600_QUERY_CURRENT_GPU_SCLK, 0, FALSE},
+ {"memory-clock", R600_QUERY_CURRENT_GPU_MCLK, 0, FALSE}
};
+ unsigned num_queries;
+
+ if (rscreen->info.drm_major == 2 && rscreen->info.drm_minor >= 42)
+ num_queries = Elements(list);
+ else
+ num_queries = 8;
if (!info)
- return Elements(list);
+ return num_queries;
- if (index >= Elements(list))
+ if (index >= num_queries)
return 0;
*info = list[index];
#define R600_QUERY_NUM_BYTES_MOVED (PIPE_QUERY_DRIVER_SPECIFIC + 5)
#define R600_QUERY_VRAM_USAGE (PIPE_QUERY_DRIVER_SPECIFIC + 6)
#define R600_QUERY_GTT_USAGE (PIPE_QUERY_DRIVER_SPECIFIC + 7)
+#define R600_QUERY_GPU_TEMPERATURE (PIPE_QUERY_DRIVER_SPECIFIC + 8)
+#define R600_QUERY_CURRENT_GPU_SCLK (PIPE_QUERY_DRIVER_SPECIFIC + 9)
+#define R600_QUERY_CURRENT_GPU_MCLK (PIPE_QUERY_DRIVER_SPECIFIC + 10)
#define R600_CONTEXT_STREAMOUT_FLUSH (1u << 0)
#define R600_CONTEXT_PRIVATE_FLAG (1u << 1)
case R600_QUERY_NUM_BYTES_MOVED:
case R600_QUERY_VRAM_USAGE:
case R600_QUERY_GTT_USAGE:
+ case R600_QUERY_GPU_TEMPERATURE:
+ case R600_QUERY_CURRENT_GPU_SCLK:
+ case R600_QUERY_CURRENT_GPU_MCLK:
return NULL;
}
case R600_QUERY_NUM_BYTES_MOVED:
case R600_QUERY_VRAM_USAGE:
case R600_QUERY_GTT_USAGE:
+ case R600_QUERY_GPU_TEMPERATURE:
+ case R600_QUERY_CURRENT_GPU_SCLK:
+ case R600_QUERY_CURRENT_GPU_MCLK:
skip_allocation = true;
break;
default:
case R600_QUERY_REQUESTED_GTT:
case R600_QUERY_VRAM_USAGE:
case R600_QUERY_GTT_USAGE:
+ case R600_QUERY_GPU_TEMPERATURE:
+ case R600_QUERY_CURRENT_GPU_SCLK:
+ case R600_QUERY_CURRENT_GPU_MCLK:
rquery->begin_result = 0;
return;
case R600_QUERY_BUFFER_WAIT_TIME:
case R600_QUERY_GTT_USAGE:
rquery->end_result = rctx->ws->query_value(rctx->ws, RADEON_GTT_USAGE);
return;
+ case R600_QUERY_GPU_TEMPERATURE:
+ rquery->end_result = rctx->ws->query_value(rctx->ws, RADEON_GPU_TEMPERATURE) / 1000;
+ return;
+ case R600_QUERY_CURRENT_GPU_SCLK:
+ rquery->end_result = rctx->ws->query_value(rctx->ws, RADEON_CURRENT_SCLK) * 1000000;
+ return;
+ case R600_QUERY_CURRENT_GPU_MCLK:
+ rquery->end_result = rctx->ws->query_value(rctx->ws, RADEON_CURRENT_MCLK) * 1000000;
+ return;
}
r600_emit_query_end(rctx, rquery);
case R600_QUERY_NUM_BYTES_MOVED:
case R600_QUERY_VRAM_USAGE:
case R600_QUERY_GTT_USAGE:
+ case R600_QUERY_GPU_TEMPERATURE:
+ case R600_QUERY_CURRENT_GPU_SCLK:
+ case R600_QUERY_CURRENT_GPU_MCLK:
result->u64 = query->end_result - query->begin_result;
return TRUE;
}
#define RADEON_INFO_ACTIVE_CU_COUNT 0x20
#endif
+#ifndef RADEON_INFO_CURRENT_GPU_TEMP
+#define RADEON_INFO_CURRENT_GPU_TEMP 0x21
+#define RADEON_INFO_CURRENT_GPU_SCLK 0x22
+#define RADEON_INFO_CURRENT_GPU_MCLK 0x23
+#define RADEON_INFO_READ_REG 0x24
+#endif
+
static struct util_hash_table *fd_tab = NULL;
pipe_static_mutex(fd_tab_mutex);
radeon_get_drm_value(ws->fd, RADEON_INFO_GTT_USAGE,
"gtt-usage", (uint32_t*)&retval);
return retval;
+ case RADEON_GPU_TEMPERATURE:
+ radeon_get_drm_value(ws->fd, RADEON_INFO_CURRENT_GPU_TEMP,
+ "gpu-temp", (uint32_t*)&retval);
+ return retval;
+ case RADEON_CURRENT_SCLK:
+ radeon_get_drm_value(ws->fd, RADEON_INFO_CURRENT_GPU_SCLK,
+ "current-gpu-sclk", (uint32_t*)&retval);
+ return retval;
+ case RADEON_CURRENT_MCLK:
+ radeon_get_drm_value(ws->fd, RADEON_INFO_CURRENT_GPU_MCLK,
+ "current-gpu-mclk", (uint32_t*)&retval);
+ return retval;
}
return 0;
}
RADEON_NUM_CS_FLUSHES,
RADEON_NUM_BYTES_MOVED,
RADEON_VRAM_USAGE,
- RADEON_GTT_USAGE
+ RADEON_GTT_USAGE,
+ RADEON_GPU_TEMPERATURE,
+ RADEON_CURRENT_SCLK,
+ RADEON_CURRENT_MCLK
};
enum radeon_bo_priority {