aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/r600/r600_query.c
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2013-03-22 02:39:42 +0100
committerMarek Olšák <[email protected]>2013-03-26 01:28:19 +0100
commit8ddae684aff5bae3f9bf12b35d938fe53aadc1a8 (patch)
tree23900c4e4cc6a00fcceca502e670f4b34b6dd60f /src/gallium/drivers/r600/r600_query.c
parent2504380aafe5ff745c87a2e715bc29a20597ebe4 (diff)
r600g: add a driver query returning the amount of requested VRAM and GTT memory
Diffstat (limited to 'src/gallium/drivers/r600/r600_query.c')
-rw-r--r--src/gallium/drivers/r600/r600_query.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/gallium/drivers/r600/r600_query.c b/src/gallium/drivers/r600/r600_query.c
index 6ee4bbd3a00..e2072ca27a4 100644
--- a/src/gallium/drivers/r600/r600_query.c
+++ b/src/gallium/drivers/r600/r600_query.c
@@ -45,6 +45,8 @@ static struct r600_resource *r600_new_query_buffer(struct r600_context *ctx, uns
/* Non-GPU queries. */
switch (type) {
case R600_QUERY_DRAW_CALLS:
+ case R600_QUERY_REQUESTED_VRAM:
+ case R600_QUERY_REQUESTED_GTT:
return NULL;
}
@@ -310,6 +312,8 @@ static struct pipe_query *r600_create_query(struct pipe_context *ctx, unsigned q
break;
/* Non-GPU queries. */
case R600_QUERY_DRAW_CALLS:
+ case R600_QUERY_REQUESTED_VRAM:
+ case R600_QUERY_REQUESTED_GTT:
skip_allocation = true;
break;
default:
@@ -361,6 +365,10 @@ static void r600_begin_query(struct pipe_context *ctx, struct pipe_query *query)
case R600_QUERY_DRAW_CALLS:
rquery->begin_result = rctx->num_draw_calls;
return;
+ case R600_QUERY_REQUESTED_VRAM:
+ case R600_QUERY_REQUESTED_GTT:
+ rquery->begin_result = 0;
+ return;
}
/* Discard the old query buffers. */
@@ -398,6 +406,12 @@ static void r600_end_query(struct pipe_context *ctx, struct pipe_query *query)
case R600_QUERY_DRAW_CALLS:
rquery->end_result = rctx->num_draw_calls;
return;
+ case R600_QUERY_REQUESTED_VRAM:
+ rquery->end_result = rctx->ws->query_value(rctx->ws, RADEON_REQUESTED_VRAM_MEMORY);
+ return;
+ case R600_QUERY_REQUESTED_GTT:
+ rquery->end_result = rctx->ws->query_value(rctx->ws, RADEON_REQUESTED_GTT_MEMORY);
+ return;
}
r600_emit_query_end(rctx, rquery);
@@ -437,6 +451,8 @@ static boolean r600_get_query_buffer_result(struct r600_context *ctx,
/* Non-GPU queries. */
switch (query->type) {
case R600_QUERY_DRAW_CALLS:
+ case R600_QUERY_REQUESTED_VRAM:
+ case R600_QUERY_REQUESTED_GTT:
result->u64 = query->end_result - query->begin_result;
return TRUE;
}