diff options
author | Marek Olšák <[email protected]> | 2012-07-05 20:06:41 +0200 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2012-08-15 19:20:58 +0200 |
commit | 44f14ebd7b9ba7186342039d2602fdd6ea5077f5 (patch) | |
tree | d254c299e3e40d31079d0604f4c86f5d440b351f /src/gallium/winsys | |
parent | 1932bc8aaeb59287a7f769b0cb9a55f49dd6d553 (diff) |
r600g: implement timestamp query and get_timestamp hook
Reviewed-by: Alex Deucher <[email protected]>
Diffstat (limited to 'src/gallium/winsys')
-rw-r--r-- | src/gallium/winsys/radeon/drm/radeon_drm_winsys.c | 21 | ||||
-rw-r--r-- | src/gallium/winsys/radeon/drm/radeon_winsys.h | 7 |
2 files changed, 28 insertions, 0 deletions
diff --git a/src/gallium/winsys/radeon/drm/radeon_drm_winsys.c b/src/gallium/winsys/radeon/drm/radeon_drm_winsys.c index c9c6932c862..c03dd045edf 100644 --- a/src/gallium/winsys/radeon/drm/radeon_drm_winsys.c +++ b/src/gallium/winsys/radeon/drm/radeon_drm_winsys.c @@ -85,6 +85,10 @@ #define RADEON_INFO_MAX_PIPES 0x10 #endif +#ifndef RADEON_INFO_TIMESTAMP +#define RADEON_INFO_TIMESTAMP 0x11 +#endif + /* Enable/disable feature access for one command stream. * If enable == TRUE, return TRUE on success. @@ -375,6 +379,22 @@ 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 < R600) { + assert(0); + return 0; + } + + radeon_get_drm_value(ws->fd, RADEON_INFO_TIMESTAMP, "timestamp", + (uint32_t*)&ts); + return ts; +} + struct radeon_winsys *radeon_drm_winsys_create(int fd) { struct radeon_drm_winsys *ws = CALLOC_STRUCT(radeon_drm_winsys); @@ -407,6 +427,7 @@ 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; radeon_bomgr_init_functions(ws); radeon_drm_cs_init_functions(ws); diff --git a/src/gallium/winsys/radeon/drm/radeon_winsys.h b/src/gallium/winsys/radeon/drm/radeon_winsys.h index 6039910f870..4eb57fb1259 100644 --- a/src/gallium/winsys/radeon/drm/radeon_winsys.h +++ b/src/gallium/winsys/radeon/drm/radeon_winsys.h @@ -375,6 +375,13 @@ 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); }; #endif |