winsys/radeon: use query_value for timestamp, remove query_timestamp
authorMarek Olšák <maraeo@gmail.com>
Wed, 10 Apr 2013 15:01:07 +0000 (17:01 +0200)
committerMarek Olšák <maraeo@gmail.com>
Tue, 16 Apr 2013 11:56:47 +0000 (13:56 +0200)
src/gallium/drivers/r600/r600_pipe.c
src/gallium/winsys/radeon/drm/radeon_drm_winsys.c
src/gallium/winsys/radeon/drm/radeon_winsys.h

index 0c115787c095107b4b3be0d76eb5be88405d958e..a080bba5906a52020a977533644b760160c22f86 100644 (file)
@@ -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;
 }
 
index 494ab7b18210e77e4f54c54efa06a8f1e4c6556d..f6877d5e95d67b8f47bbe6b38b6337287d33a785 100644 (file)
@@ -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);
index b1bf1ba5c1895a5c0dd4f672ecd0ff74bb39deb3..a37bd120cb8352d646f4e90c245c250597b685fe 100644 (file)
@@ -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);
 };