freedreno: Fix timestamp conversion

The kernel returns the 19.2MHz RBBM counter, same as what is used for
timestamp queries.  So it needs to be converted the same way.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26640>
This commit is contained in:
Rob Clark
2023-12-11 13:51:17 -08:00
committed by Marge Bot
parent 2284d1c42f
commit 659e557676

View File

@@ -141,8 +141,7 @@ fd_screen_get_timestamp(struct pipe_screen *pscreen)
if (screen->has_timestamp) {
uint64_t n;
fd_pipe_get_param(screen->pipe, FD_TIMESTAMP, &n);
assert(screen->max_freq > 0);
return n * 1000000000 / screen->max_freq;
return ticks_to_ns(n);
} else {
int64_t cpu_time = os_time_get_nano();
return cpu_time + screen->cpu_gpu_time_delta;
@@ -1113,10 +1112,11 @@ fd_screen_create(int fd,
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_TIMESTAMP, &val) == 0)
screen->has_timestamp = true;
screen->dev_id = fd_pipe_dev_id(screen->pipe);
if (fd_pipe_get_param(screen->pipe, FD_GPU_ID, &val)) {