From: Marek Olšák Date: Wed, 10 Apr 2013 15:01:07 +0000 (+0200) Subject: winsys/radeon: use query_value for timestamp, remove query_timestamp X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=817723baf8433fdcc9c71c165f9c6ea1d11bc4c4;p=mesa.git winsys/radeon: use query_value for timestamp, remove query_timestamp --- diff --git a/src/gallium/drivers/r600/r600_pipe.c b/src/gallium/drivers/r600/r600_pipe.c index 0c115787c09..a080bba5906 100644 --- a/src/gallium/drivers/r600/r600_pipe.c +++ b/src/gallium/drivers/r600/r600_pipe.c @@ -1149,7 +1149,7 @@ static uint64_t r600_get_timestamp(struct pipe_screen *screen) { struct r600_screen *rscreen = (struct r600_screen*)screen; - return 1000000 * rscreen->ws->query_timestamp(rscreen->ws) / + return 1000000 * rscreen->ws->query_value(rscreen->ws, RADEON_TIMESTAMP) / rscreen->info.r600_clock_crystal_freq; } diff --git a/src/gallium/winsys/radeon/drm/radeon_drm_winsys.c b/src/gallium/winsys/radeon/drm/radeon_drm_winsys.c index 494ab7b1821..f6877d5e95d 100644 --- a/src/gallium/winsys/radeon/drm/radeon_drm_winsys.c +++ b/src/gallium/winsys/radeon/drm/radeon_drm_winsys.c @@ -484,26 +484,11 @@ static int radeon_drm_winsys_surface_best(struct radeon_winsys *rws, return radeon_surface_best(ws->surf_man, surf); } -static uint64_t radeon_query_timestamp(struct radeon_winsys *rws) -{ - struct radeon_drm_winsys *ws = (struct radeon_drm_winsys*)rws; - uint64_t ts = 0; - - if (ws->info.drm_minor < 20 || - ws->gen < DRV_R600) { - assert(0); - return 0; - } - - radeon_get_drm_value(ws->fd, RADEON_INFO_TIMESTAMP, "timestamp", - (uint32_t*)&ts); - return ts; -} - 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; switch (value) { case RADEON_REQUESTED_VRAM_MEMORY: @@ -512,6 +497,15 @@ static uint64_t radeon_query_value(struct radeon_winsys *rws, return ws->allocated_gtt; case RADEON_BUFFER_WAIT_TIME_NS: return ws->buffer_wait_time; + case RADEON_TIMESTAMP: + if (ws->info.drm_minor < 20 || ws->gen < DRV_R600) { + assert(0); + return 0; + } + + radeon_get_drm_value(ws->fd, RADEON_INFO_TIMESTAMP, "timestamp", + (uint32_t*)&ts); + return ts; } return 0; } @@ -638,7 +632,6 @@ struct radeon_winsys *radeon_drm_winsys_create(int fd) ws->base.cs_request_feature = radeon_cs_request_feature; ws->base.surface_init = radeon_drm_winsys_surface_init; ws->base.surface_best = radeon_drm_winsys_surface_best; - ws->base.query_timestamp = radeon_query_timestamp; ws->base.query_value = radeon_query_value; radeon_bomgr_init_functions(ws); diff --git a/src/gallium/winsys/radeon/drm/radeon_winsys.h b/src/gallium/winsys/radeon/drm/radeon_winsys.h index b1bf1ba5c18..a37bd120cb8 100644 --- a/src/gallium/winsys/radeon/drm/radeon_winsys.h +++ b/src/gallium/winsys/radeon/drm/radeon_winsys.h @@ -149,7 +149,8 @@ enum ring_type { enum radeon_value_id { RADEON_REQUESTED_VRAM_MEMORY, RADEON_REQUESTED_GTT_MEMORY, - RADEON_BUFFER_WAIT_TIME_NS + RADEON_BUFFER_WAIT_TIME_NS, + RADEON_TIMESTAMP }; struct winsys_handle; @@ -486,13 +487,6 @@ struct radeon_winsys { int (*surface_best)(struct radeon_winsys *ws, struct radeon_surface *surf); - /** - * Return the current timestamp (gpu clock) on r600 and later GPUs. - * - * \param ws The winsys this function is called from. - */ - uint64_t (*query_timestamp)(struct radeon_winsys *ws); - uint64_t (*query_value)(struct radeon_winsys *ws, enum radeon_value_id value); };