From 2b621c47aa515add6452a788c0c27067fc60be20 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Tue, 27 Dec 2016 18:35:32 +0100 Subject: [PATCH] gallium/radeon: add new HUD query num-SDMA-IBs MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Reviewed-by: Bas Nieuwenhuizen Reviewed-by: Nicolai Hähnle --- src/gallium/drivers/radeon/r600_query.c | 4 ++++ src/gallium/drivers/radeon/r600_query.h | 1 + src/gallium/drivers/radeon/radeon_winsys.h | 1 + src/gallium/winsys/amdgpu/drm/amdgpu_cs.c | 6 +++++- src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c | 2 ++ src/gallium/winsys/amdgpu/drm/amdgpu_winsys.h | 1 + src/gallium/winsys/radeon/drm/radeon_drm_cs.c | 5 ++++- src/gallium/winsys/radeon/drm/radeon_drm_winsys.c | 2 ++ src/gallium/winsys/radeon/drm/radeon_drm_winsys.h | 1 + 9 files changed, 21 insertions(+), 2 deletions(-) diff --git a/src/gallium/drivers/radeon/r600_query.c b/src/gallium/drivers/radeon/r600_query.c index 70a25684ceb..3c72f27f151 100644 --- a/src/gallium/drivers/radeon/r600_query.c +++ b/src/gallium/drivers/radeon/r600_query.c @@ -66,6 +66,7 @@ static enum radeon_value_id winsys_id_from_type(unsigned type) case R600_QUERY_MAPPED_GTT: return RADEON_MAPPED_GTT; case R600_QUERY_BUFFER_WAIT_TIME: return RADEON_BUFFER_WAIT_TIME_NS; case R600_QUERY_NUM_GFX_IBS: return RADEON_NUM_GFX_IBS; + case R600_QUERY_NUM_SDMA_IBS: return RADEON_NUM_SDMA_IBS; case R600_QUERY_NUM_BYTES_MOVED: return RADEON_NUM_BYTES_MOVED; case R600_QUERY_NUM_EVICTIONS: return RADEON_NUM_EVICTIONS; case R600_QUERY_VRAM_USAGE: return RADEON_VRAM_USAGE; @@ -136,6 +137,7 @@ static bool r600_query_sw_begin(struct r600_common_context *rctx, break; case R600_QUERY_BUFFER_WAIT_TIME: case R600_QUERY_NUM_GFX_IBS: + case R600_QUERY_NUM_SDMA_IBS: case R600_QUERY_NUM_BYTES_MOVED: case R600_QUERY_NUM_EVICTIONS: { enum radeon_value_id ws_id = winsys_id_from_type(query->b.type); @@ -226,6 +228,7 @@ static bool r600_query_sw_end(struct r600_common_context *rctx, case R600_QUERY_CURRENT_GPU_MCLK: case R600_QUERY_BUFFER_WAIT_TIME: case R600_QUERY_NUM_GFX_IBS: + case R600_QUERY_NUM_SDMA_IBS: case R600_QUERY_NUM_BYTES_MOVED: case R600_QUERY_NUM_EVICTIONS: { enum radeon_value_id ws_id = winsys_id_from_type(query->b.type); @@ -1692,6 +1695,7 @@ static struct pipe_driver_query_info r600_driver_query_list[] = { X("mapped-GTT", MAPPED_GTT, BYTES, AVERAGE), X("buffer-wait-time", BUFFER_WAIT_TIME, MICROSECONDS, CUMULATIVE), X("num-GFX-IBs", NUM_GFX_IBS, UINT64, AVERAGE), + X("num-SDMA-IBs", NUM_SDMA_IBS, UINT64, AVERAGE), X("num-bytes-moved", NUM_BYTES_MOVED, BYTES, CUMULATIVE), X("num-evictions", NUM_EVICTIONS, UINT64, CUMULATIVE), X("VRAM-usage", VRAM_USAGE, BYTES, AVERAGE), diff --git a/src/gallium/drivers/radeon/r600_query.h b/src/gallium/drivers/radeon/r600_query.h index fffd9feea62..3791ec6096e 100644 --- a/src/gallium/drivers/radeon/r600_query.h +++ b/src/gallium/drivers/radeon/r600_query.h @@ -61,6 +61,7 @@ enum { R600_QUERY_MAPPED_GTT, R600_QUERY_BUFFER_WAIT_TIME, R600_QUERY_NUM_GFX_IBS, + R600_QUERY_NUM_SDMA_IBS, R600_QUERY_NUM_BYTES_MOVED, R600_QUERY_NUM_EVICTIONS, R600_QUERY_VRAM_USAGE, diff --git a/src/gallium/drivers/radeon/radeon_winsys.h b/src/gallium/drivers/radeon/radeon_winsys.h index 6c886cf3388..e6fb2d560d1 100644 --- a/src/gallium/drivers/radeon/radeon_winsys.h +++ b/src/gallium/drivers/radeon/radeon_winsys.h @@ -83,6 +83,7 @@ enum radeon_value_id { RADEON_BUFFER_WAIT_TIME_NS, RADEON_TIMESTAMP, RADEON_NUM_GFX_IBS, + RADEON_NUM_SDMA_IBS, RADEON_NUM_BYTES_MOVED, RADEON_NUM_EVICTIONS, RADEON_VRAM_USAGE, diff --git a/src/gallium/winsys/amdgpu/drm/amdgpu_cs.c b/src/gallium/winsys/amdgpu/drm/amdgpu_cs.c index adb46c5b405..95402bff9d9 100644 --- a/src/gallium/winsys/amdgpu/drm/amdgpu_cs.c +++ b/src/gallium/winsys/amdgpu/drm/amdgpu_cs.c @@ -1204,7 +1204,11 @@ static int amdgpu_cs_flush(struct radeon_winsys_cs *rcs, cs->main.base.used_gart = 0; cs->main.base.used_vram = 0; - ws->num_gfx_IBs++; + if (cs->ring_type == RING_GFX) + ws->num_gfx_IBs++; + else if (cs->ring_type == RING_DMA) + ws->num_sdma_IBs++; + return error_code; } diff --git a/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c b/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c index 2ccc8e549f2..b950d37a504 100644 --- a/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c +++ b/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c @@ -429,6 +429,8 @@ static uint64_t amdgpu_query_value(struct radeon_winsys *rws, return retval; case RADEON_NUM_GFX_IBS: return ws->num_gfx_IBs; + case RADEON_NUM_SDMA_IBS: + return ws->num_sdma_IBs; case RADEON_NUM_BYTES_MOVED: amdgpu_query_info(ws->dev, AMDGPU_INFO_NUM_BYTES_MOVED, 8, &retval); return retval; diff --git a/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.h b/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.h index 6746079b9c1..2a7900a68d9 100644 --- a/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.h +++ b/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.h @@ -62,6 +62,7 @@ struct amdgpu_winsys { uint64_t mapped_gtt; uint64_t buffer_wait_time; /* time spent in buffer_wait in ns */ uint64_t num_gfx_IBs; + uint64_t num_sdma_IBs; struct radeon_info info; diff --git a/src/gallium/winsys/radeon/drm/radeon_drm_cs.c b/src/gallium/winsys/radeon/drm/radeon_drm_cs.c index ab1ca06c501..8f9e8a60593 100644 --- a/src/gallium/winsys/radeon/drm/radeon_drm_cs.c +++ b/src/gallium/winsys/radeon/drm/radeon_drm_cs.c @@ -691,7 +691,10 @@ static int radeon_drm_cs_flush(struct radeon_winsys_cs *rcs, cs->base.used_vram = 0; cs->base.used_gart = 0; - cs->ws->num_gfx_IBs++; + if (cs->ring_type == RING_GFX) + cs->ws->num_gfx_IBs++; + else if (cs->ring_type == RING_DMA) + cs->ws->num_sdma_IBs++; return 0; } diff --git a/src/gallium/winsys/radeon/drm/radeon_drm_winsys.c b/src/gallium/winsys/radeon/drm/radeon_drm_winsys.c index 1b2f9b18aca..c85e427a216 100644 --- a/src/gallium/winsys/radeon/drm/radeon_drm_winsys.c +++ b/src/gallium/winsys/radeon/drm/radeon_drm_winsys.c @@ -625,6 +625,8 @@ static uint64_t radeon_query_value(struct radeon_winsys *rws, return retval; case RADEON_NUM_GFX_IBS: return ws->num_gfx_IBs; + case RADEON_NUM_SDMA_IBS: + return ws->num_sdma_IBs; case RADEON_NUM_BYTES_MOVED: radeon_get_drm_value(ws->fd, RADEON_INFO_NUM_BYTES_MOVED, "num-bytes-moved", (uint32_t*)&retval); diff --git a/src/gallium/winsys/radeon/drm/radeon_drm_winsys.h b/src/gallium/winsys/radeon/drm/radeon_drm_winsys.h index 137a9f437e1..ac623a1b311 100644 --- a/src/gallium/winsys/radeon/drm/radeon_drm_winsys.h +++ b/src/gallium/winsys/radeon/drm/radeon_drm_winsys.h @@ -80,6 +80,7 @@ struct radeon_drm_winsys { uint64_t mapped_gtt; uint64_t buffer_wait_time; /* time spent in buffer_wait in ns */ uint64_t num_gfx_IBs; + uint64_t num_sdma_IBs; uint32_t next_bo_hash; enum radeon_generation gen; -- 2.30.2