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

Author: Chia-I Wu <[email protected]>
Date:   Fri Oct 28 10:51:53 2022 -0700

freedreno/pps: use 64-bit reads when possible

It is always possible on a5xx+ and allows Countable::collect to do 1 ldr rather
than 2.

Sampling at 1ms, perf goes from

   - 34.44% pps::FreedrenoDriver::collect_countables
        25.36% pps::FreedrenoDriver::Countable::collect
        3.92% cfree
      + 2.28% operator new

to

   - 29.60% pps::FreedrenoDriver::collect_countables
        20.70% pps::FreedrenoDriver::Countable::collect
        4.01% cfree
      + 2.35% operator new
        1.09% memcpy

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19427>

---

 src/freedreno/ds/fd_pps_driver.cc | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/src/freedreno/ds/fd_pps_driver.cc 
b/src/freedreno/ds/fd_pps_driver.cc
index 86bb16b7fbb..23f1bded1fa 100644
--- a/src/freedreno/ds/fd_pps_driver.cc
+++ b/src/freedreno/ds/fd_pps_driver.cc
@@ -630,13 +630,11 @@ FreedrenoDriver::Countable::collect()
 
    d->state[id].last_value = d->state[id].value;
 
-   uint32_t *reg_lo = (uint32_t *)d->io + counter->counter_reg_lo;
-   uint32_t *reg_hi = (uint32_t *)d->io + counter->counter_reg_hi;
+   /* this is true on a5xx and later */
+   assert(counter->counter_reg_lo + 1 == counter->counter_reg_hi);
+   uint64_t *reg = (uint64_t *)((uint32_t *)d->io + counter->counter_reg_lo);
 
-   uint32_t lo = *reg_lo;
-   uint32_t hi = *reg_hi;
-
-   d->state[id].value = lo | ((uint64_t)hi << 32);
+   d->state[id].value = *reg;
 }
 
 /* Resolve the countable and assign next counter from it's group: */

Reply via email to