gallium/radeon: add GPIN driver query group

This group was used by older versions of AMD GPUPerfStudio (via
AMD_performance_monitor) to identify the GPU family, and GPUPerfStudio
still complains when it isn't available.

Reviewed-by: Edward O'Callaghan <eocallaghan@alterapraxis.com>
Acked-by: Marek Olšák <marek.olsak@amd.com>
This commit is contained in:
Nicolai Hähnle 2015-12-11 15:39:23 -05:00
parent 4b672b8310
commit b0e32548c8
2 changed files with 87 additions and 3 deletions

View File

@ -100,6 +100,12 @@ static boolean r600_query_sw_begin(struct r600_common_context *rctx,
case R600_QUERY_NUM_SHADERS_CREATED:
query->begin_result = p_atomic_read(&rctx->screen->num_shaders_created);
break;
case R600_QUERY_GPIN_ASIC_ID:
case R600_QUERY_GPIN_NUM_SIMD:
case R600_QUERY_GPIN_NUM_RB:
case R600_QUERY_GPIN_NUM_SPI:
case R600_QUERY_GPIN_NUM_SE:
break;
default:
unreachable("r600_query_sw_begin: bad query type");
}
@ -146,6 +152,12 @@ static void r600_query_sw_end(struct r600_common_context *rctx,
case R600_QUERY_NUM_SHADERS_CREATED:
query->end_result = p_atomic_read(&rctx->screen->num_shaders_created);
break;
case R600_QUERY_GPIN_ASIC_ID:
case R600_QUERY_GPIN_NUM_SIMD:
case R600_QUERY_GPIN_NUM_RB:
case R600_QUERY_GPIN_NUM_SPI:
case R600_QUERY_GPIN_NUM_SE:
break;
default:
unreachable("r600_query_sw_end: bad query type");
}
@ -171,6 +183,22 @@ static boolean r600_query_sw_get_result(struct r600_common_context *rctx,
wait ? PIPE_TIMEOUT_INFINITE : 0);
return result->b;
}
case R600_QUERY_GPIN_ASIC_ID:
result->u32 = 0;
return TRUE;
case R600_QUERY_GPIN_NUM_SIMD:
result->u32 = rctx->screen->info.num_good_compute_units;
return TRUE;
case R600_QUERY_GPIN_NUM_RB:
result->u32 = rctx->screen->info.r600_num_backends;
return TRUE;
case R600_QUERY_GPIN_NUM_SPI:
result->u32 = 1; /* all supported chips have one SPI per SE */
return TRUE;
case R600_QUERY_GPIN_NUM_SE:
result->u32 = rctx->screen->info.max_se;
return TRUE;
}
result->u64 = query->end_result - query->begin_result;
@ -1096,15 +1124,21 @@ err:
return;
}
#define X(name_, query_type_, type_, result_type_) \
#define XFULL(name_, query_type_, type_, result_type_, group_id_) \
{ \
.name = name_, \
.query_type = R600_QUERY_##query_type_, \
.type = PIPE_DRIVER_QUERY_TYPE_##type_, \
.result_type = PIPE_DRIVER_QUERY_RESULT_TYPE_##result_type_, \
.group_id = ~(unsigned)0 \
.group_id = group_id_ \
}
#define X(name_, query_type_, type_, result_type_) \
XFULL(name_, query_type_, type_, result_type_, ~(unsigned)0)
#define XG(group_, name_, query_type_, type_, result_type_) \
XFULL(name_, query_type_, type_, result_type_, R600_QUERY_GROUP_##group_)
static struct pipe_driver_query_info r600_driver_query_list[] = {
X("num-compilations", NUM_COMPILATIONS, UINT64, CUMULATIVE),
X("num-shaders-created", NUM_SHADERS_CREATED, UINT64, CUMULATIVE),
@ -1116,6 +1150,20 @@ static struct pipe_driver_query_info r600_driver_query_list[] = {
X("num-bytes-moved", NUM_BYTES_MOVED, BYTES, CUMULATIVE),
X("VRAM-usage", VRAM_USAGE, BYTES, AVERAGE),
X("GTT-usage", GTT_USAGE, BYTES, AVERAGE),
/* GPIN queries are for the benefit of old versions of GPUPerfStudio,
* which use it as a fallback path to detect the GPU type.
*
* Note: The names of these queries are significant for GPUPerfStudio
* (and possibly their order as well). */
XG(GPIN, "GPIN_000", GPIN_ASIC_ID, UINT, AVERAGE),
XG(GPIN, "GPIN_001", GPIN_NUM_SIMD, UINT, AVERAGE),
XG(GPIN, "GPIN_002", GPIN_NUM_RB, UINT, AVERAGE),
XG(GPIN, "GPIN_003", GPIN_NUM_SPI, UINT, AVERAGE),
XG(GPIN, "GPIN_004", GPIN_NUM_SE, UINT, AVERAGE),
/* The following queries must be at the end of the list because their
* availability is adjusted dynamically based on the DRM version. */
X("GPU-load", GPU_LOAD, UINT64, AVERAGE),
X("temperature", GPU_TEMPERATURE, UINT64, AVERAGE),
X("shader-clock", CURRENT_GPU_SCLK, HZ, AVERAGE),
@ -1123,6 +1171,8 @@ static struct pipe_driver_query_info r600_driver_query_list[] = {
};
#undef X
#undef XG
#undef XFULL
static unsigned r600_get_num_queries(struct r600_common_screen *rscreen)
{
@ -1167,16 +1217,40 @@ static int r600_get_driver_query_info(struct pipe_screen *screen,
break;
}
if (info->group_id != ~(unsigned)0 && rscreen->perfcounters)
info->group_id += rscreen->perfcounters->num_groups;
return 1;
}
/* Note: Unfortunately, GPUPerfStudio hardcodes the order of hardware
* performance counter groups, so be careful when changing this and related
* functions.
*/
static int r600_get_driver_query_group_info(struct pipe_screen *screen,
unsigned index,
struct pipe_driver_query_group_info *info)
{
struct r600_common_screen *rscreen = (struct r600_common_screen *)screen;
unsigned num_pc_groups = 0;
return r600_get_perfcounter_group_info(rscreen, index, info);
if (rscreen->perfcounters)
num_pc_groups = rscreen->perfcounters->num_groups;
if (!info)
return num_pc_groups + R600_NUM_SW_QUERY_GROUPS;
if (index < num_pc_groups)
return r600_get_perfcounter_group_info(rscreen, index, info);
index -= num_pc_groups;
if (index >= R600_NUM_SW_QUERY_GROUPS)
return 0;
info->name = "GPIN";
info->max_active_queries = 5;
info->num_queries = 5;
return 1;
}
void r600_query_init(struct r600_common_context *rctx)

View File

@ -54,8 +54,18 @@ struct r600_resource;
#define R600_QUERY_GPU_LOAD (PIPE_QUERY_DRIVER_SPECIFIC + 11)
#define R600_QUERY_NUM_COMPILATIONS (PIPE_QUERY_DRIVER_SPECIFIC + 12)
#define R600_QUERY_NUM_SHADERS_CREATED (PIPE_QUERY_DRIVER_SPECIFIC + 13)
#define R600_QUERY_GPIN_ASIC_ID (PIPE_QUERY_DRIVER_SPECIFIC + 14)
#define R600_QUERY_GPIN_NUM_SIMD (PIPE_QUERY_DRIVER_SPECIFIC + 15)
#define R600_QUERY_GPIN_NUM_RB (PIPE_QUERY_DRIVER_SPECIFIC + 16)
#define R600_QUERY_GPIN_NUM_SPI (PIPE_QUERY_DRIVER_SPECIFIC + 17)
#define R600_QUERY_GPIN_NUM_SE (PIPE_QUERY_DRIVER_SPECIFIC + 18)
#define R600_QUERY_FIRST_PERFCOUNTER (PIPE_QUERY_DRIVER_SPECIFIC + 100)
enum {
R600_QUERY_GROUP_GPIN = 0,
R600_NUM_SW_QUERY_GROUPS
};
struct r600_query_ops {
void (*destroy)(struct r600_common_context *, struct r600_query *);
boolean (*begin)(struct r600_common_context *, struct r600_query *);