From fb5cf3490ebbc173211b6c04c869e3fb9f4dbecc Mon Sep 17 00:00:00 2001 From: Marek Olšák Date: Wed, 12 Feb 2014 15:13:30 +0100 Subject: r600g,radeonsi: add a bunch of useful queries for the HUD --- src/gallium/winsys/radeon/drm/radeon_drm_cs.c | 2 ++ src/gallium/winsys/radeon/drm/radeon_drm_winsys.c | 26 ++++++++++++++++++++--- src/gallium/winsys/radeon/drm/radeon_drm_winsys.h | 1 + src/gallium/winsys/radeon/drm/radeon_winsys.h | 6 +++++- 4 files changed, 31 insertions(+), 4 deletions(-) (limited to 'src/gallium/winsys/radeon') 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 { -- cgit v1.2.3