[Mesa-dev] [PATCH 3/4] winsys/radeon: use query_value for timestamp, remove query_timestamp
Marek Olšák
maraeo at gmail.com
Thu Apr 11 03:43:28 PDT 2013
---
src/gallium/drivers/r600/r600_pipe.c | 2 +-
src/gallium/winsys/radeon/drm/radeon_drm_winsys.c | 27 ++++++++-------------
src/gallium/winsys/radeon/drm/radeon_winsys.h | 10 ++------
3 files changed, 13 insertions(+), 26 deletions(-)
diff --git a/src/gallium/drivers/r600/r600_pipe.c b/src/gallium/drivers/r600/r600_pipe.c
index ed65544..aeff693 100644
--- a/src/gallium/drivers/r600/r600_pipe.c
+++ b/src/gallium/drivers/r600/r600_pipe.c
@@ -1141,7 +1141,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 96374ea..7a92d2b 100644
--- a/src/gallium/winsys/radeon/drm/radeon_drm_winsys.c
+++ b/src/gallium/winsys/radeon/drm/radeon_drm_winsys.c
@@ -467,26 +467,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:
@@ -495,6 +480,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;
}
@@ -621,7 +615,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 a825b43..1966f72 100644
--- a/src/gallium/winsys/radeon/drm/radeon_winsys.h
+++ b/src/gallium/winsys/radeon/drm/radeon_winsys.h
@@ -148,7 +148,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;
@@ -483,13 +484,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);
};
--
1.7.10.4
More information about the mesa-dev
mailing list