mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-24 17:30:12 +01:00
radeonsi: add a HUD query showing the number of shaders created
Reviewed-by: Brian Paul <brianp@vmware.com> Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
This commit is contained in:
parent
70f5e49ba5
commit
30a7e0c021
4 changed files with 17 additions and 0 deletions
|
|
@ -691,6 +691,8 @@ static int r600_get_driver_query_info(struct pipe_screen *screen,
|
|||
struct pipe_driver_query_info list[] = {
|
||||
{"num-compilations", R600_QUERY_NUM_COMPILATIONS, {0}, PIPE_DRIVER_QUERY_TYPE_UINT64,
|
||||
PIPE_DRIVER_QUERY_RESULT_TYPE_CUMULATIVE},
|
||||
{"num-shaders-created", R600_QUERY_NUM_SHADERS_CREATED, {0}, PIPE_DRIVER_QUERY_TYPE_UINT64,
|
||||
PIPE_DRIVER_QUERY_RESULT_TYPE_CUMULATIVE},
|
||||
{"draw-calls", R600_QUERY_DRAW_CALLS, {0}},
|
||||
{"requested-VRAM", R600_QUERY_REQUESTED_VRAM, {rscreen->info.vram_size}, PIPE_DRIVER_QUERY_TYPE_BYTES},
|
||||
{"requested-GTT", R600_QUERY_REQUESTED_GTT, {rscreen->info.gart_size}, PIPE_DRIVER_QUERY_TYPE_BYTES},
|
||||
|
|
|
|||
|
|
@ -60,6 +60,7 @@
|
|||
#define R600_QUERY_CURRENT_GPU_MCLK (PIPE_QUERY_DRIVER_SPECIFIC + 10)
|
||||
#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_CONTEXT_STREAMOUT_FLUSH (1u << 0)
|
||||
#define R600_CONTEXT_PRIVATE_FLAG (1u << 1)
|
||||
|
|
@ -293,6 +294,10 @@ struct r600_common_screen {
|
|||
* compilation and another one for rendering.
|
||||
*/
|
||||
unsigned num_compilations;
|
||||
/* Along with ST_DEBUG=precompile, this should show if applications
|
||||
* are loading shaders on demand. This is a monotonic counter.
|
||||
*/
|
||||
unsigned num_shaders_created;
|
||||
|
||||
/* GPU load thread. */
|
||||
pipe_mutex gpu_load_mutex;
|
||||
|
|
|
|||
|
|
@ -93,6 +93,7 @@ static struct r600_resource *r600_new_query_buffer(struct r600_common_context *c
|
|||
case R600_QUERY_CURRENT_GPU_MCLK:
|
||||
case R600_QUERY_GPU_LOAD:
|
||||
case R600_QUERY_NUM_COMPILATIONS:
|
||||
case R600_QUERY_NUM_SHADERS_CREATED:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
@ -410,6 +411,7 @@ static struct pipe_query *r600_create_query(struct pipe_context *ctx, unsigned q
|
|||
case R600_QUERY_CURRENT_GPU_MCLK:
|
||||
case R600_QUERY_GPU_LOAD:
|
||||
case R600_QUERY_NUM_COMPILATIONS:
|
||||
case R600_QUERY_NUM_SHADERS_CREATED:
|
||||
skip_allocation = true;
|
||||
break;
|
||||
default:
|
||||
|
|
@ -488,6 +490,9 @@ static boolean r600_begin_query(struct pipe_context *ctx,
|
|||
case R600_QUERY_NUM_COMPILATIONS:
|
||||
rquery->begin_result = p_atomic_read(&rctx->screen->num_compilations);
|
||||
return true;
|
||||
case R600_QUERY_NUM_SHADERS_CREATED:
|
||||
rquery->begin_result = p_atomic_read(&rctx->screen->num_shaders_created);
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Discard the old query buffers. */
|
||||
|
|
@ -568,6 +573,9 @@ static void r600_end_query(struct pipe_context *ctx, struct pipe_query *query)
|
|||
case R600_QUERY_NUM_COMPILATIONS:
|
||||
rquery->end_result = p_atomic_read(&rctx->screen->num_compilations);
|
||||
return;
|
||||
case R600_QUERY_NUM_SHADERS_CREATED:
|
||||
rquery->end_result = p_atomic_read(&rctx->screen->num_shaders_created);
|
||||
return;
|
||||
}
|
||||
|
||||
r600_emit_query_end(rctx, rquery);
|
||||
|
|
@ -628,6 +636,7 @@ static boolean r600_get_query_buffer_result(struct r600_common_context *ctx,
|
|||
case R600_QUERY_CURRENT_GPU_SCLK:
|
||||
case R600_QUERY_CURRENT_GPU_MCLK:
|
||||
case R600_QUERY_NUM_COMPILATIONS:
|
||||
case R600_QUERY_NUM_SHADERS_CREATED:
|
||||
result->u64 = query->end_result - query->begin_result;
|
||||
return TRUE;
|
||||
case R600_QUERY_GPU_LOAD:
|
||||
|
|
|
|||
|
|
@ -653,6 +653,7 @@ static void *si_create_shader_state(struct pipe_context *ctx,
|
|||
sel->tokens = tgsi_dup_tokens(state->tokens);
|
||||
sel->so = state->stream_output;
|
||||
tgsi_scan_shader(state->tokens, &sel->info);
|
||||
p_atomic_inc(&sscreen->b.num_shaders_created);
|
||||
|
||||
switch (pipe_shader_type) {
|
||||
case PIPE_SHADER_GEOMETRY:
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue