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>
(cherry picked from commit 659e557676)
This commit is contained in:
Rob Clark
2023-12-11 13:51:17 -08:00
committed by Eric Engestrom
parent cb675c60a0
commit 349d6426f9
2 changed files with 5 additions and 5 deletions

View File

@@ -20004,7 +20004,7 @@
"description": "freedreno: Fix timestamp conversion",
"nominated": false,
"nomination_type": 3,
"resolution": 4,
"resolution": 1,
"main_sha": null,
"because_sha": null,
"notes": null

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)) {