From cb675c60a0847f95288d2659438d66ef634d5e21 Mon Sep 17 00:00:00 2001 From: Rob Clark Date: Mon, 11 Dec 2023 13:49:35 -0800 Subject: [PATCH] freedreno: De-duplicate 19.2MHz RBBM tick conversion The 19.2MHz always-on counter is universal across generations, so de-duplicate. Signed-off-by: Rob Clark Part-of: (cherry picked from commit 2284d1c42fc12b3566ccf5417354a6b96a401d2a) --- .pick_status.json | 4 ++-- src/gallium/drivers/freedreno/a5xx/fd5_query.c | 10 ---------- src/gallium/drivers/freedreno/a6xx/fd6_query.cc | 10 ---------- src/gallium/drivers/freedreno/freedreno_util.h | 7 +++++++ 4 files changed, 9 insertions(+), 22 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index 8e4b5c6fcd3..11202592faf 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -104,7 +104,7 @@ "description": "util: Provide a secure_getenv fallback for platforms without it", "nominated": false, "nomination_type": 3, - "resolution": 1, + "resolution": 4, "main_sha": null, "because_sha": null, "notes": null @@ -20014,7 +20014,7 @@ "description": "freedreno: De-duplicate 19.2MHz RBBM tick conversion", "nominated": false, "nomination_type": 3, - "resolution": 4, + "resolution": 1, "main_sha": null, "because_sha": null, "notes": null diff --git a/src/gallium/drivers/freedreno/a5xx/fd5_query.c b/src/gallium/drivers/freedreno/a5xx/fd5_query.c index 9c685f3ab3f..945c2cfadb7 100644 --- a/src/gallium/drivers/freedreno/a5xx/fd5_query.c +++ b/src/gallium/drivers/freedreno/a5xx/fd5_query.c @@ -206,16 +206,6 @@ timestamp_pause(struct fd_acc_query *aq, struct fd_batch *batch) assert_dt OUT_RELOC(ring, query_sample(aq, start)); /* srcC */ } -static uint64_t -ticks_to_ns(uint32_t ts) -{ - /* This is based on the 19.2MHz always-on rbbm timer. - * - * TODO we should probably query this value from kernel.. - */ - return ts * (1000000000 / 19200000); -} - static void time_elapsed_accumulate_result(struct fd_acc_query *aq, struct fd_acc_query_sample *s, diff --git a/src/gallium/drivers/freedreno/a6xx/fd6_query.cc b/src/gallium/drivers/freedreno/a6xx/fd6_query.cc index 8cb81141ebd..71dd61050ed 100644 --- a/src/gallium/drivers/freedreno/a6xx/fd6_query.cc +++ b/src/gallium/drivers/freedreno/a6xx/fd6_query.cc @@ -267,16 +267,6 @@ record_timestamp(struct fd_ringbuffer *ring, struct fd_bo *bo, unsigned offset) OUT_RING(ring, 0x00000000); } -static uint64_t -ticks_to_ns(uint64_t ts) -{ - /* This is based on the 19.2MHz always-on rbbm timer. - * - * TODO we should probably query this value from kernel.. - */ - return ts * (1000000000 / 19200000); -} - static void time_elapsed_accumulate_result(struct fd_acc_query *aq, struct fd_acc_query_sample *s, diff --git a/src/gallium/drivers/freedreno/freedreno_util.h b/src/gallium/drivers/freedreno/freedreno_util.h index 5e3fdbe4d1c..8a64622d112 100644 --- a/src/gallium/drivers/freedreno/freedreno_util.h +++ b/src/gallium/drivers/freedreno/freedreno_util.h @@ -507,6 +507,13 @@ fd4_size2indextype(unsigned index_size) return INDEX4_SIZE_32_BIT; } +/* Convert 19.2MHz RBBM always-on timer ticks to ns */ +static inline uint64_t +ticks_to_ns(uint64_t ts) +{ + return ts * (1000000000 / 19200000); +} + #ifdef __cplusplus } #endif