summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/radeon/r600_query.c
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2014-02-12 15:13:30 +0100
committerMarek Olšák <[email protected]>2014-04-09 01:45:16 +0200
commitfb5cf3490ebbc173211b6c04c869e3fb9f4dbecc (patch)
tree82c6e4174fd507206ed2673c5d738ca6fa9a9381 /src/gallium/drivers/radeon/r600_query.c
parent4a5519f1e019dbf1103e4f3abe0a695637a87518 (diff)
r600g,radeonsi: add a bunch of useful queries for the HUD
Diffstat (limited to 'src/gallium/drivers/radeon/r600_query.c')
-rw-r--r--src/gallium/drivers/radeon/r600_query.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/gallium/drivers/radeon/r600_query.c b/src/gallium/drivers/radeon/r600_query.c
index e9218a2e8ec..38889fdf2a5 100644
--- a/src/gallium/drivers/radeon/r600_query.c
+++ b/src/gallium/drivers/radeon/r600_query.c
@@ -79,6 +79,10 @@ static struct r600_resource *r600_new_query_buffer(struct r600_common_context *c
case R600_QUERY_REQUESTED_VRAM:
case R600_QUERY_REQUESTED_GTT:
case R600_QUERY_BUFFER_WAIT_TIME:
+ case R600_QUERY_NUM_CS_FLUSHES:
+ case R600_QUERY_NUM_BYTES_MOVED:
+ case R600_QUERY_VRAM_USAGE:
+ case R600_QUERY_GTT_USAGE:
return NULL;
}
@@ -379,6 +383,10 @@ static struct pipe_query *r600_create_query(struct pipe_context *ctx, unsigned q
case R600_QUERY_REQUESTED_VRAM:
case R600_QUERY_REQUESTED_GTT:
case R600_QUERY_BUFFER_WAIT_TIME:
+ case R600_QUERY_NUM_CS_FLUSHES:
+ case R600_QUERY_NUM_BYTES_MOVED:
+ case R600_QUERY_VRAM_USAGE:
+ case R600_QUERY_GTT_USAGE:
skip_allocation = true;
break;
default:
@@ -432,11 +440,19 @@ static void r600_begin_query(struct pipe_context *ctx, struct pipe_query *query)
return;
case R600_QUERY_REQUESTED_VRAM:
case R600_QUERY_REQUESTED_GTT:
+ case R600_QUERY_VRAM_USAGE:
+ case R600_QUERY_GTT_USAGE:
rquery->begin_result = 0;
return;
case R600_QUERY_BUFFER_WAIT_TIME:
rquery->begin_result = rctx->ws->query_value(rctx->ws, RADEON_BUFFER_WAIT_TIME_NS);
return;
+ case R600_QUERY_NUM_CS_FLUSHES:
+ rquery->begin_result = rctx->ws->query_value(rctx->ws, RADEON_NUM_CS_FLUSHES);
+ return;
+ case R600_QUERY_NUM_BYTES_MOVED:
+ rquery->begin_result = rctx->ws->query_value(rctx->ws, RADEON_NUM_BYTES_MOVED);
+ return;
}
/* Discard the old query buffers. */
@@ -483,6 +499,18 @@ static void r600_end_query(struct pipe_context *ctx, struct pipe_query *query)
case R600_QUERY_BUFFER_WAIT_TIME:
rquery->end_result = rctx->ws->query_value(rctx->ws, RADEON_BUFFER_WAIT_TIME_NS);
return;
+ case R600_QUERY_NUM_CS_FLUSHES:
+ rquery->end_result = rctx->ws->query_value(rctx->ws, RADEON_NUM_CS_FLUSHES);
+ return;
+ case R600_QUERY_NUM_BYTES_MOVED:
+ rquery->end_result = rctx->ws->query_value(rctx->ws, RADEON_NUM_BYTES_MOVED);
+ return;
+ case R600_QUERY_VRAM_USAGE:
+ rquery->end_result = rctx->ws->query_value(rctx->ws, RADEON_VRAM_USAGE);
+ return;
+ case R600_QUERY_GTT_USAGE:
+ rquery->end_result = rctx->ws->query_value(rctx->ws, RADEON_GTT_USAGE);
+ return;
}
r600_emit_query_end(rctx, rquery);
@@ -525,6 +553,10 @@ static boolean r600_get_query_buffer_result(struct r600_common_context *ctx,
case R600_QUERY_REQUESTED_VRAM:
case R600_QUERY_REQUESTED_GTT:
case R600_QUERY_BUFFER_WAIT_TIME:
+ case R600_QUERY_NUM_CS_FLUSHES:
+ case R600_QUERY_NUM_BYTES_MOVED:
+ case R600_QUERY_VRAM_USAGE:
+ case R600_QUERY_GTT_USAGE:
result->u64 = query->end_result - query->begin_result;
return TRUE;
}