[Mesa-dev] [PATCH 6/6] gallium/radeon: add HUD queries for mapped VRAM/GTT

Nicolai Hähnle nhaehnle at gmail.com
Tue Aug 9 08:38:09 UTC 2016


The objection to patch 1 makes sense. Adding the marketing name (in 
_addition_ to the family name) is something that I'd support as well.

Patches 2 - 6:

Reviewed-by: Nicolai Hähnle <nicolai.haehnle at amd.com>

On 06.08.2016 20:05, Marek Olšák wrote:
> From: Marek Olšák <marek.olsak at amd.com>
>
> mainly for monitoring visible VRAM congestion
> ---
>  src/gallium/drivers/radeon/r600_query.c | 10 ++++++++++
>  src/gallium/drivers/radeon/r600_query.h |  2 ++
>  2 files changed, 12 insertions(+)
>
> diff --git a/src/gallium/drivers/radeon/r600_query.c b/src/gallium/drivers/radeon/r600_query.c
> index c203439..592cec1 100644
> --- a/src/gallium/drivers/radeon/r600_query.c
> +++ b/src/gallium/drivers/radeon/r600_query.c
> @@ -44,20 +44,22 @@ static void r600_query_sw_destroy(struct r600_common_context *rctx,
>
>  	screen->fence_reference(screen, &query->fence, NULL);
>  	FREE(query);
>  }
>
>  static enum radeon_value_id winsys_id_from_type(unsigned type)
>  {
>  	switch (type) {
>  	case R600_QUERY_REQUESTED_VRAM: return RADEON_REQUESTED_VRAM_MEMORY;
>  	case R600_QUERY_REQUESTED_GTT: return RADEON_REQUESTED_GTT_MEMORY;
> +	case R600_QUERY_MAPPED_VRAM: return RADEON_MAPPED_VRAM;
> +	case R600_QUERY_MAPPED_GTT: return RADEON_MAPPED_GTT;
>  	case R600_QUERY_BUFFER_WAIT_TIME: return RADEON_BUFFER_WAIT_TIME_NS;
>  	case R600_QUERY_NUM_CS_FLUSHES: return RADEON_NUM_CS_FLUSHES;
>  	case R600_QUERY_NUM_BYTES_MOVED: return RADEON_NUM_BYTES_MOVED;
>  	case R600_QUERY_VRAM_USAGE: return RADEON_VRAM_USAGE;
>  	case R600_QUERY_GTT_USAGE: return RADEON_GTT_USAGE;
>  	case R600_QUERY_GPU_TEMPERATURE: return RADEON_GPU_TEMPERATURE;
>  	case R600_QUERY_CURRENT_GPU_SCLK: return RADEON_CURRENT_SCLK;
>  	case R600_QUERY_CURRENT_GPU_MCLK: return RADEON_CURRENT_MCLK;
>  	default: unreachable("query type does not correspond to winsys id");
>  	}
> @@ -82,20 +84,22 @@ static bool r600_query_sw_begin(struct r600_common_context *rctx,
>  		query->begin_result = rctx->num_compute_calls;
>  		break;
>  	case R600_QUERY_SPILL_COMPUTE_CALLS:
>  		query->begin_result = rctx->num_spill_compute_calls;
>  		break;
>  	case R600_QUERY_DMA_CALLS:
>  		query->begin_result = rctx->num_dma_calls;
>  		break;
>  	case R600_QUERY_REQUESTED_VRAM:
>  	case R600_QUERY_REQUESTED_GTT:
> +	case R600_QUERY_MAPPED_VRAM:
> +	case R600_QUERY_MAPPED_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:
>  	case R600_QUERY_BACK_BUFFER_PS_DRAW_RATIO:
>  		query->begin_result = 0;
>  		break;
>  	case R600_QUERY_BUFFER_WAIT_TIME:
>  	case R600_QUERY_NUM_CS_FLUSHES:
> @@ -147,20 +151,22 @@ static bool r600_query_sw_end(struct r600_common_context *rctx,
>  		query->end_result = rctx->num_compute_calls;
>  		break;
>  	case R600_QUERY_SPILL_COMPUTE_CALLS:
>  		query->end_result = rctx->num_spill_compute_calls;
>  		break;
>  	case R600_QUERY_DMA_CALLS:
>  		query->end_result = rctx->num_dma_calls;
>  		break;
>  	case R600_QUERY_REQUESTED_VRAM:
>  	case R600_QUERY_REQUESTED_GTT:
> +	case R600_QUERY_MAPPED_VRAM:
> +	case R600_QUERY_MAPPED_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:
>  	case R600_QUERY_BUFFER_WAIT_TIME:
>  	case R600_QUERY_NUM_CS_FLUSHES:
>  	case R600_QUERY_NUM_BYTES_MOVED: {
>  		enum radeon_value_id ws_id = winsys_id_from_type(query->b.type);
>  		query->end_result = rctx->ws->query_value(rctx->ws, ws_id);
> @@ -1168,20 +1174,22 @@ err:
>  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),
>  	X("draw-calls",			DRAW_CALLS,		UINT64, AVERAGE),
>  	X("spill-draw-calls",		SPILL_DRAW_CALLS,	UINT64, AVERAGE),
>  	X("compute-calls",		COMPUTE_CALLS,		UINT64, AVERAGE),
>  	X("spill-compute-calls",	SPILL_COMPUTE_CALLS,	UINT64, AVERAGE),
>  	X("dma-calls",			DMA_CALLS,		UINT64, AVERAGE),
>  	X("requested-VRAM",		REQUESTED_VRAM,		BYTES, AVERAGE),
>  	X("requested-GTT",		REQUESTED_GTT,		BYTES, AVERAGE),
> +	X("mapped-VRAM",		MAPPED_VRAM,		BYTES, AVERAGE),
> +	X("mapped-GTT",			MAPPED_GTT,		BYTES, AVERAGE),
>  	X("buffer-wait-time",		BUFFER_WAIT_TIME,	MICROSECONDS, CUMULATIVE),
>  	X("num-cs-flushes",		NUM_CS_FLUSHES,		UINT64, AVERAGE),
>  	X("num-bytes-moved",		NUM_BYTES_MOVED,	BYTES, CUMULATIVE),
>  	X("VRAM-usage",			VRAM_USAGE,		BYTES, AVERAGE),
>  	X("GTT-usage",			GTT_USAGE,		BYTES, AVERAGE),
>  	X("back-buffer-ps-draw-ratio",	BACK_BUFFER_PS_DRAW_RATIO, UINT64, AVERAGE),
>
>  	/* GPIN queries are for the benefit of old versions of GPUPerfStudio,
>  	 * which use it as a fallback path to detect the GPU type.
>  	 *
> @@ -1230,24 +1238,26 @@ static int r600_get_driver_query_info(struct pipe_screen *screen,
>  	}
>
>  	if (index >= num_queries)
>  		return r600_get_perfcounter_info(rscreen, index - num_queries, info);
>
>  	*info = r600_driver_query_list[index];
>
>  	switch (info->query_type) {
>  	case R600_QUERY_REQUESTED_VRAM:
>  	case R600_QUERY_VRAM_USAGE:
> +	case R600_QUERY_MAPPED_VRAM:
>  		info->max_value.u64 = rscreen->info.vram_size;
>  		break;
>  	case R600_QUERY_REQUESTED_GTT:
>  	case R600_QUERY_GTT_USAGE:
> +	case R600_QUERY_MAPPED_GTT:
>  		info->max_value.u64 = rscreen->info.gart_size;
>  		break;
>  	case R600_QUERY_GPU_TEMPERATURE:
>  		info->max_value.u64 = 125;
>  		break;
>  	}
>
>  	if (info->group_id != ~(unsigned)0 && rscreen->perfcounters)
>  		info->group_id += rscreen->perfcounters->num_groups;
>
> diff --git a/src/gallium/drivers/radeon/r600_query.h b/src/gallium/drivers/radeon/r600_query.h
> index f3c03f5..7aa684c 100644
> --- a/src/gallium/drivers/radeon/r600_query.h
> +++ b/src/gallium/drivers/radeon/r600_query.h
> @@ -41,20 +41,22 @@ struct r600_query_hw;
>  struct r600_resource;
>
>  enum {
>  	R600_QUERY_DRAW_CALLS = PIPE_QUERY_DRIVER_SPECIFIC,
>  	R600_QUERY_SPILL_DRAW_CALLS,
>  	R600_QUERY_COMPUTE_CALLS,
>  	R600_QUERY_SPILL_COMPUTE_CALLS,
>  	R600_QUERY_DMA_CALLS,
>  	R600_QUERY_REQUESTED_VRAM,
>  	R600_QUERY_REQUESTED_GTT,
> +	R600_QUERY_MAPPED_VRAM,
> +	R600_QUERY_MAPPED_GTT,
>  	R600_QUERY_BUFFER_WAIT_TIME,
>  	R600_QUERY_NUM_CS_FLUSHES,
>  	R600_QUERY_NUM_BYTES_MOVED,
>  	R600_QUERY_VRAM_USAGE,
>  	R600_QUERY_GTT_USAGE,
>  	R600_QUERY_GPU_TEMPERATURE,
>  	R600_QUERY_CURRENT_GPU_SCLK,
>  	R600_QUERY_CURRENT_GPU_MCLK,
>  	R600_QUERY_GPU_LOAD,
>  	R600_QUERY_NUM_COMPILATIONS,
>


More information about the mesa-dev mailing list