diff options
author | Marek Olšák <[email protected]> | 2014-02-12 15:13:30 +0100 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2014-04-09 01:45:16 +0200 |
commit | fb5cf3490ebbc173211b6c04c869e3fb9f4dbecc (patch) | |
tree | 82c6e4174fd507206ed2673c5d738ca6fa9a9381 | |
parent | 4a5519f1e019dbf1103e4f3abe0a695637a87518 (diff) |
r600g,radeonsi: add a bunch of useful queries for the HUD
-rw-r--r-- | src/gallium/drivers/radeon/r600_pipe_common.c | 6 | ||||
-rw-r--r-- | src/gallium/drivers/radeon/r600_pipe_common.h | 4 | ||||
-rw-r--r-- | src/gallium/drivers/radeon/r600_query.c | 32 | ||||
-rw-r--r-- | src/gallium/winsys/radeon/drm/radeon_drm_cs.c | 2 | ||||
-rw-r--r-- | src/gallium/winsys/radeon/drm/radeon_drm_winsys.c | 26 | ||||
-rw-r--r-- | src/gallium/winsys/radeon/drm/radeon_drm_winsys.h | 1 | ||||
-rw-r--r-- | src/gallium/winsys/radeon/drm/radeon_winsys.h | 6 |
7 files changed, 72 insertions, 5 deletions
diff --git a/src/gallium/drivers/radeon/r600_pipe_common.c b/src/gallium/drivers/radeon/r600_pipe_common.c index a5c140ab6aa..c5e85f52a00 100644 --- a/src/gallium/drivers/radeon/r600_pipe_common.c +++ b/src/gallium/drivers/radeon/r600_pipe_common.c @@ -469,7 +469,11 @@ static int r600_get_driver_query_info(struct pipe_screen *screen, {"draw-calls", R600_QUERY_DRAW_CALLS, 0}, {"requested-VRAM", R600_QUERY_REQUESTED_VRAM, rscreen->info.vram_size, TRUE}, {"requested-GTT", R600_QUERY_REQUESTED_GTT, rscreen->info.gart_size, TRUE}, - {"buffer-wait-time", R600_QUERY_BUFFER_WAIT_TIME, 0, FALSE} + {"buffer-wait-time", R600_QUERY_BUFFER_WAIT_TIME, 0, FALSE}, + {"num-cs-flushes", R600_QUERY_NUM_CS_FLUSHES, 0, FALSE}, + {"num-bytes-moved", R600_QUERY_NUM_BYTES_MOVED, 0, TRUE}, + {"VRAM-usage", R600_QUERY_VRAM_USAGE, rscreen->info.vram_size, TRUE}, + {"GTT-usage", R600_QUERY_GTT_USAGE, rscreen->info.gart_size, TRUE}, }; if (!info) diff --git a/src/gallium/drivers/radeon/r600_pipe_common.h b/src/gallium/drivers/radeon/r600_pipe_common.h index 1815ff6003a..2be9ea280ba 100644 --- a/src/gallium/drivers/radeon/r600_pipe_common.h +++ b/src/gallium/drivers/radeon/r600_pipe_common.h @@ -50,6 +50,10 @@ #define R600_QUERY_REQUESTED_VRAM (PIPE_QUERY_DRIVER_SPECIFIC + 1) #define R600_QUERY_REQUESTED_GTT (PIPE_QUERY_DRIVER_SPECIFIC + 2) #define R600_QUERY_BUFFER_WAIT_TIME (PIPE_QUERY_DRIVER_SPECIFIC + 3) +#define R600_QUERY_NUM_CS_FLUSHES (PIPE_QUERY_DRIVER_SPECIFIC + 4) +#define R600_QUERY_NUM_BYTES_MOVED (PIPE_QUERY_DRIVER_SPECIFIC + 5) +#define R600_QUERY_VRAM_USAGE (PIPE_QUERY_DRIVER_SPECIFIC + 6) +#define R600_QUERY_GTT_USAGE (PIPE_QUERY_DRIVER_SPECIFIC + 7) /* read caches */ #define R600_CONTEXT_INV_VERTEX_CACHE (1 << 0) 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; } diff --git a/src/gallium/winsys/radeon/drm/radeon_drm_cs.c b/src/gallium/winsys/radeon/drm/radeon_drm_cs.c index 6823d89e6eb..abc8b99123e 100644 --- a/src/gallium/winsys/radeon/drm/radeon_drm_cs.c +++ b/src/gallium/winsys/radeon/drm/radeon_drm_cs.c @@ -596,6 +596,8 @@ static void radeon_drm_cs_flush(struct radeon_winsys_cs *rcs, unsigned flags, ui /* Prepare a new CS. */ cs->base.buf = cs->csc->buf; cs->base.cdw = 0; + + cs->ws->num_cs_flushes++; } static void radeon_drm_cs_destroy(struct radeon_winsys_cs *rcs) diff --git a/src/gallium/winsys/radeon/drm/radeon_drm_winsys.c b/src/gallium/winsys/radeon/drm/radeon_drm_winsys.c index 44cd0d165fe..ea7da0b12e8 100644 --- a/src/gallium/winsys/radeon/drm/radeon_drm_winsys.c +++ b/src/gallium/winsys/radeon/drm/radeon_drm_winsys.c @@ -101,6 +101,12 @@ #define RADEON_INFO_VCE_FW_VERSION 0x1b #endif +#ifndef RADEON_INFO_NUM_BYTES_MOVED +#define RADEON_INFO_NUM_BYTES_MOVED 0x1d +#define RADEON_INFO_VRAM_USAGE 0x1e +#define RADEON_INFO_GTT_USAGE 0x1f +#endif + #ifndef RADEON_CS_RING_UVD #define RADEON_CS_RING_UVD 3 #endif @@ -523,7 +529,7 @@ static uint64_t radeon_query_value(struct radeon_winsys *rws, enum radeon_value_id value) { struct radeon_drm_winsys *ws = (struct radeon_drm_winsys*)rws; - uint64_t ts = 0; + uint64_t retval = 0; switch (value) { case RADEON_REQUESTED_VRAM_MEMORY: @@ -539,8 +545,22 @@ static uint64_t radeon_query_value(struct radeon_winsys *rws, } radeon_get_drm_value(ws->fd, RADEON_INFO_TIMESTAMP, "timestamp", - (uint32_t*)&ts); - return ts; + (uint32_t*)&retval); + return retval; + case RADEON_NUM_CS_FLUSHES: + return ws->num_cs_flushes; + case RADEON_NUM_BYTES_MOVED: + radeon_get_drm_value(ws->fd, RADEON_INFO_NUM_BYTES_MOVED, + "num-bytes-moved", (uint32_t*)&retval); + return retval; + case RADEON_VRAM_USAGE: + radeon_get_drm_value(ws->fd, RADEON_INFO_VRAM_USAGE, + "vram-usage", (uint32_t*)&retval); + return retval; + case RADEON_GTT_USAGE: + radeon_get_drm_value(ws->fd, RADEON_INFO_GTT_USAGE, + "gtt-usage", (uint32_t*)&retval); + return retval; } return 0; } diff --git a/src/gallium/winsys/radeon/drm/radeon_drm_winsys.h b/src/gallium/winsys/radeon/drm/radeon_drm_winsys.h index ed901948634..a10b89074cf 100644 --- a/src/gallium/winsys/radeon/drm/radeon_drm_winsys.h +++ b/src/gallium/winsys/radeon/drm/radeon_drm_winsys.h @@ -49,6 +49,7 @@ struct radeon_drm_winsys { uint64_t allocated_vram; uint64_t allocated_gtt; uint64_t buffer_wait_time; /* time spent in buffer_wait in ns */ + uint64_t num_cs_flushes; enum radeon_generation gen; struct radeon_info info; diff --git a/src/gallium/winsys/radeon/drm/radeon_winsys.h b/src/gallium/winsys/radeon/drm/radeon_winsys.h index 8164d4df97b..c5fec683c19 100644 --- a/src/gallium/winsys/radeon/drm/radeon_winsys.h +++ b/src/gallium/winsys/radeon/drm/radeon_winsys.h @@ -158,7 +158,11 @@ enum radeon_value_id { RADEON_REQUESTED_VRAM_MEMORY, RADEON_REQUESTED_GTT_MEMORY, RADEON_BUFFER_WAIT_TIME_NS, - RADEON_TIMESTAMP + RADEON_TIMESTAMP, + RADEON_NUM_CS_FLUSHES, + RADEON_NUM_BYTES_MOVED, + RADEON_VRAM_USAGE, + RADEON_GTT_USAGE }; enum radeon_bo_priority { |