From 05fa3595e06c8b504f0eb86db8ed6ba88bffc98e Mon Sep 17 00:00:00 2001 From: Marek Olšák Date: Fri, 5 Apr 2013 02:43:26 +0200 Subject: r600g: add a query returning the amount of time spent during bo_map sync. --- src/gallium/winsys/radeon/drm/radeon_drm_bo.c | 5 +++++ src/gallium/winsys/radeon/drm/radeon_drm_winsys.c | 2 ++ src/gallium/winsys/radeon/drm/radeon_drm_winsys.h | 1 + src/gallium/winsys/radeon/drm/radeon_winsys.h | 5 +++-- 4 files changed, 11 insertions(+), 2 deletions(-) (limited to 'src/gallium/winsys/radeon') diff --git a/src/gallium/winsys/radeon/drm/radeon_drm_bo.c b/src/gallium/winsys/radeon/drm/radeon_drm_bo.c index 9e45dcc031c..6ec171328bb 100644 --- a/src/gallium/winsys/radeon/drm/radeon_drm_bo.c +++ b/src/gallium/winsys/radeon/drm/radeon_drm_bo.c @@ -33,6 +33,7 @@ #include "util/u_double_list.h" #include "os/os_thread.h" #include "os/os_mman.h" +#include "os/os_time.h" #include "state_tracker/drm_driver.h" @@ -478,6 +479,8 @@ static void *radeon_bo_map(struct radeon_winsys_cs_handle *buf, } } } else { + uint64_t time = os_time_get_nano(); + if (!(usage & PIPE_TRANSFER_WRITE)) { /* Mapping for read. * @@ -503,6 +506,8 @@ static void *radeon_bo_map(struct radeon_winsys_cs_handle *buf, radeon_bo_wait((struct pb_buffer*)bo, RADEON_USAGE_READWRITE); } + + bo->mgr->rws->buffer_wait_time += os_time_get_nano() - time; } } diff --git a/src/gallium/winsys/radeon/drm/radeon_drm_winsys.c b/src/gallium/winsys/radeon/drm/radeon_drm_winsys.c index e25ab9be7be..494ab7b1821 100644 --- a/src/gallium/winsys/radeon/drm/radeon_drm_winsys.c +++ b/src/gallium/winsys/radeon/drm/radeon_drm_winsys.c @@ -510,6 +510,8 @@ static uint64_t radeon_query_value(struct radeon_winsys *rws, return ws->allocated_vram; case RADEON_REQUESTED_GTT_MEMORY: return ws->allocated_gtt; + case RADEON_BUFFER_WAIT_TIME_NS: + return ws->buffer_wait_time; } 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 842579c6138..682479ed52c 100644 --- a/src/gallium/winsys/radeon/drm/radeon_drm_winsys.h +++ b/src/gallium/winsys/radeon/drm/radeon_drm_winsys.h @@ -48,6 +48,7 @@ struct radeon_drm_winsys { int num_cs; /* The number of command streams created. */ uint64_t allocated_vram; uint64_t allocated_gtt; + uint64_t buffer_wait_time; /* time spent in buffer_wait in ns */ 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 e343188d3b7..b1bf1ba5c18 100644 --- a/src/gallium/winsys/radeon/drm/radeon_winsys.h +++ b/src/gallium/winsys/radeon/drm/radeon_winsys.h @@ -147,8 +147,9 @@ enum ring_type { }; enum radeon_value_id { - RADEON_REQUESTED_VRAM_MEMORY, - RADEON_REQUESTED_GTT_MEMORY, + RADEON_REQUESTED_VRAM_MEMORY, + RADEON_REQUESTED_GTT_MEMORY, + RADEON_BUFFER_WAIT_TIME_NS }; struct winsys_handle; -- cgit v1.2.3