summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/radeon/r600_query.c
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2015-02-24 01:26:13 +0100
committerMarek Olšák <[email protected]>2015-04-28 16:05:45 +0200
commit6d05396b0047c74d740c53156eda1a8574403498 (patch)
tree72ef5fdda0559f8c693acd8ebc7f98e85bdbc8fe /src/gallium/drivers/radeon/r600_query.c
parent0b8e73a6ae2a77d0e9a7810cca5b181ba5f0893e (diff)
r600g,radeonsi: add a driver query returning GPU load
Reviewed-by: Alex Deucher <[email protected]>
Diffstat (limited to 'src/gallium/drivers/radeon/r600_query.c')
-rw-r--r--src/gallium/drivers/radeon/r600_query.c11
1 files changed, 11 insertions, 0 deletions
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,