From 6d05396b0047c74d740c53156eda1a8574403498 Mon Sep 17 00:00:00 2001 From: Marek Olšák Date: Tue, 24 Feb 2015 01:26:13 +0100 Subject: r600g,radeonsi: add a driver query returning GPU load Reviewed-by: Alex Deucher --- src/gallium/drivers/radeon/r600_query.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/gallium/drivers/radeon/r600_query.c') diff --git a/src/gallium/drivers/radeon/r600_query.c b/src/gallium/drivers/radeon/r600_query.c index 758064af712..1335087dafb 100644 --- a/src/gallium/drivers/radeon/r600_query.c +++ b/src/gallium/drivers/radeon/r600_query.c @@ -89,6 +89,7 @@ static struct r600_resource *r600_new_query_buffer(struct r600_common_context *c case R600_QUERY_GPU_TEMPERATURE: case R600_QUERY_CURRENT_GPU_SCLK: case R600_QUERY_CURRENT_GPU_MCLK: + case R600_QUERY_GPU_LOAD: return NULL; } @@ -388,6 +389,7 @@ static struct pipe_query *r600_create_query(struct pipe_context *ctx, unsigned q case R600_QUERY_GPU_TEMPERATURE: case R600_QUERY_CURRENT_GPU_SCLK: case R600_QUERY_CURRENT_GPU_MCLK: + case R600_QUERY_GPU_LOAD: skip_allocation = true; break; default: @@ -459,6 +461,9 @@ static void r600_begin_query(struct pipe_context *ctx, struct pipe_query *query) case R600_QUERY_NUM_BYTES_MOVED: rquery->begin_result = rctx->ws->query_value(rctx->ws, RADEON_NUM_BYTES_MOVED); return; + case R600_QUERY_GPU_LOAD: + rquery->begin_result = r600_gpu_load_begin(rctx->screen); + return; } /* Discard the old query buffers. */ @@ -531,6 +536,9 @@ static void r600_end_query(struct pipe_context *ctx, struct pipe_query *query) case R600_QUERY_CURRENT_GPU_MCLK: rquery->end_result = rctx->ws->query_value(rctx->ws, RADEON_CURRENT_MCLK) * 1000000; return; + case R600_QUERY_GPU_LOAD: + rquery->end_result = r600_gpu_load_end(rctx->screen, rquery->begin_result); + return; } r600_emit_query_end(rctx, rquery); @@ -593,6 +601,9 @@ static boolean r600_get_query_buffer_result(struct r600_common_context *ctx, case R600_QUERY_CURRENT_GPU_MCLK: result->u64 = query->end_result - query->begin_result; return TRUE; + case R600_QUERY_GPU_LOAD: + result->u64 = query->end_result; + return TRUE; } map = r600_buffer_map_sync_with_rings(ctx, qbuf->buf, -- cgit v1.2.3