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>
This commit is contained in:
Chia-I Wu 2022-10-28 10:51:53 -07:00 committed by Marge Bot
parent 53a8dd1d42
commit 86553cd771

View file

@ -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: */