Module: Mesa
Branch: main
Commit: 2284d1c42fc12b3566ccf5417354a6b96a401d2a
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=2284d1c42fc12b3566ccf5417354a6b96a401d2a

Author: Rob Clark <[email protected]>
Date:   Mon Dec 11 13:49:35 2023 -0800

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 <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26640>

---

 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 +++++++
 3 files changed, 7 insertions(+), 20 deletions(-)

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

Reply via email to