summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/freedreno/freedreno_screen.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/drivers/freedreno/freedreno_screen.c')
-rw-r--r--src/gallium/drivers/freedreno/freedreno_screen.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/gallium/drivers/freedreno/freedreno_screen.c b/src/gallium/drivers/freedreno/freedreno_screen.c
index 81fb2adae42..0aaa4d04899 100644
--- a/src/gallium/drivers/freedreno/freedreno_screen.c
+++ b/src/gallium/drivers/freedreno/freedreno_screen.c
@@ -109,8 +109,18 @@ fd_screen_get_device_vendor(struct pipe_screen *pscreen)
static uint64_t
fd_screen_get_timestamp(struct pipe_screen *pscreen)
{
- int64_t cpu_time = os_time_get() * 1000;
- return cpu_time + fd_screen(pscreen)->cpu_gpu_time_delta;
+ struct fd_screen *screen = fd_screen(pscreen);
+
+ if (screen->has_timestamp) {
+ uint64_t n;
+ fd_pipe_get_param(screen->pipe, FD_TIMESTAMP, &n);
+ debug_assert(screen->max_freq > 0);
+ return n * 1000000000 / screen->max_freq;
+ } else {
+ int64_t cpu_time = os_time_get() * 1000;
+ return cpu_time + screen->cpu_gpu_time_delta;
+ }
+
}
static void
@@ -595,6 +605,8 @@ fd_screen_create(struct fd_device *dev)
screen->max_freq = 0;
} else {
screen->max_freq = val;
+ if (fd_pipe_get_param(screen->pipe, FD_TIMESTAMP, &val) == 0)
+ screen->has_timestamp = true;
}
if (fd_pipe_get_param(screen->pipe, FD_GPU_ID, &val)) {