From 0781b58b3a4adaa33cb9788af81f04a617cc07fd Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Wed, 17 May 2017 20:25:59 +0200 Subject: [PATCH] gallium/radeon: pipe AMDGPU_INFO_NUM_VRAM_CPU_PAGE_FAULTS into gallium HUD Reviewed-by: Samuel Pitoiset --- src/gallium/drivers/radeon/r600_query.c | 8 ++++++-- src/gallium/drivers/radeon/r600_query.h | 1 + src/gallium/drivers/radeon/radeon_winsys.h | 1 + src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c | 7 +++++++ src/gallium/winsys/radeon/drm/radeon_drm_winsys.c | 1 + 5 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/gallium/drivers/radeon/r600_query.c b/src/gallium/drivers/radeon/r600_query.c index 0d960bc4032..bce43171e30 100644 --- a/src/gallium/drivers/radeon/r600_query.c +++ b/src/gallium/drivers/radeon/r600_query.c @@ -73,6 +73,7 @@ static enum radeon_value_id winsys_id_from_type(unsigned type) 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_NUM_VRAM_CPU_PAGE_FAULTS: return RADEON_NUM_VRAM_CPU_PAGE_FAULTS; case R600_QUERY_VRAM_USAGE: return RADEON_VRAM_USAGE; case R600_QUERY_VRAM_VIS_USAGE: return RADEON_VRAM_VIS_USAGE; case R600_QUERY_GTT_USAGE: return RADEON_GTT_USAGE; @@ -160,7 +161,8 @@ static bool r600_query_sw_begin(struct r600_common_context *rctx, case R600_QUERY_NUM_GFX_IBS: case R600_QUERY_NUM_SDMA_IBS: case R600_QUERY_NUM_BYTES_MOVED: - case R600_QUERY_NUM_EVICTIONS: { + case R600_QUERY_NUM_EVICTIONS: + case R600_QUERY_NUM_VRAM_CPU_PAGE_FAULTS: { enum radeon_value_id ws_id = winsys_id_from_type(query->b.type); query->begin_result = rctx->ws->query_value(rctx->ws, ws_id); break; @@ -298,7 +300,8 @@ static bool r600_query_sw_end(struct r600_common_context *rctx, case R600_QUERY_NUM_GFX_IBS: case R600_QUERY_NUM_SDMA_IBS: case R600_QUERY_NUM_BYTES_MOVED: - case R600_QUERY_NUM_EVICTIONS: { + case R600_QUERY_NUM_EVICTIONS: + case R600_QUERY_NUM_VRAM_CPU_PAGE_FAULTS: { enum radeon_value_id ws_id = winsys_id_from_type(query->b.type); query->end_result = rctx->ws->query_value(rctx->ws, ws_id); break; @@ -1846,6 +1849,7 @@ static struct pipe_driver_query_info r600_driver_query_list[] = { 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-CPU-page-faults", NUM_VRAM_CPU_PAGE_FAULTS, UINT64, CUMULATIVE), X("VRAM-usage", VRAM_USAGE, BYTES, AVERAGE), X("VRAM-vis-usage", VRAM_VIS_USAGE, BYTES, AVERAGE), X("GTT-usage", GTT_USAGE, BYTES, AVERAGE), diff --git a/src/gallium/drivers/radeon/r600_query.h b/src/gallium/drivers/radeon/r600_query.h index 9017fdf649f..ed607ec199b 100644 --- a/src/gallium/drivers/radeon/r600_query.h +++ b/src/gallium/drivers/radeon/r600_query.h @@ -69,6 +69,7 @@ enum { R600_QUERY_NUM_SDMA_IBS, R600_QUERY_NUM_BYTES_MOVED, R600_QUERY_NUM_EVICTIONS, + R600_QUERY_NUM_VRAM_CPU_PAGE_FAULTS, R600_QUERY_VRAM_USAGE, R600_QUERY_VRAM_VIS_USAGE, R600_QUERY_GTT_USAGE, diff --git a/src/gallium/drivers/radeon/radeon_winsys.h b/src/gallium/drivers/radeon/radeon_winsys.h index 45ad561e236..4bef24876ad 100644 --- a/src/gallium/drivers/radeon/radeon_winsys.h +++ b/src/gallium/drivers/radeon/radeon_winsys.h @@ -91,6 +91,7 @@ enum radeon_value_id { RADEON_NUM_SDMA_IBS, RADEON_NUM_BYTES_MOVED, RADEON_NUM_EVICTIONS, + RADEON_NUM_VRAM_CPU_PAGE_FAULTS, RADEON_VRAM_USAGE, RADEON_VRAM_VIS_USAGE, RADEON_GTT_USAGE, diff --git a/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c b/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c index 0430c7ec6ac..c8bd60efdce 100644 --- a/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c +++ b/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c @@ -43,6 +43,10 @@ #include "amd/common/sid.h" #include "amd/common/gfx9d.h" +#ifndef AMDGPU_INFO_NUM_VRAM_CPU_PAGE_FAULTS +#define AMDGPU_INFO_NUM_VRAM_CPU_PAGE_FAULTS 0x1E +#endif + static struct util_hash_table *dev_tab = NULL; static mtx_t dev_tab_mutex = _MTX_INITIALIZER_NP; @@ -142,6 +146,9 @@ static uint64_t amdgpu_query_value(struct radeon_winsys *rws, case RADEON_NUM_EVICTIONS: amdgpu_query_info(ws->dev, AMDGPU_INFO_NUM_EVICTIONS, 8, &retval); return retval; + case RADEON_NUM_VRAM_CPU_PAGE_FAULTS: + amdgpu_query_info(ws->dev, AMDGPU_INFO_NUM_VRAM_CPU_PAGE_FAULTS, 8, &retval); + return retval; case RADEON_VRAM_USAGE: amdgpu_query_heap_info(ws->dev, AMDGPU_GEM_DOMAIN_VRAM, 0, &heap); return heap.heap_usage; diff --git a/src/gallium/winsys/radeon/drm/radeon_drm_winsys.c b/src/gallium/winsys/radeon/drm/radeon_drm_winsys.c index ff22b6559ab..ce52e2ad516 100644 --- a/src/gallium/winsys/radeon/drm/radeon_drm_winsys.c +++ b/src/gallium/winsys/radeon/drm/radeon_drm_winsys.c @@ -627,6 +627,7 @@ static uint64_t radeon_query_value(struct radeon_winsys *rws, "num-bytes-moved", (uint32_t*)&retval); return retval; case RADEON_NUM_EVICTIONS: + case RADEON_NUM_VRAM_CPU_PAGE_FAULTS: case RADEON_VRAM_VIS_USAGE: return 0; /* unimplemented */ case RADEON_VRAM_USAGE: -- 2.30.2