diff --git a/.pick_status.json b/.pick_status.json index db1f389dca5..e134a235082 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -2124,7 +2124,7 @@ "description": "fd/pps: Allocate performance counters from high-to-low", "nominated": true, "nomination_type": 1, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": null, "notes": null diff --git a/src/freedreno/ds/fd_pps_driver.cc b/src/freedreno/ds/fd_pps_driver.cc index 945d559eefd..0917835f536 100644 --- a/src/freedreno/ds/fd_pps_driver.cc +++ b/src/freedreno/ds/fd_pps_driver.cc @@ -1710,7 +1710,7 @@ FreedrenoDriver::Countable::collect() const d->state[id].value = *reg; } -/* Resolve the countable and assign next counter from it's group: */ +/* Resolve the countable and assign the next counter from its group. */ void FreedrenoDriver::Countable::resolve() const { @@ -1726,12 +1726,15 @@ FreedrenoDriver::Countable::resolve() const d->state[id].countable = c; - /* Assign a counter from the same group: */ + /* Assign counters from high to low to reduce conflicts with UMD-owned + * slots. */ assert(d->assigned_counters[i] < g->num_counters); - d->state[id].counter = &g->counters[d->assigned_counters[i]++]; + unsigned counter_index = + (g->num_counters - 1) - d->assigned_counters[i]++; + d->state[id].counter = &g->counters[counter_index]; - std::cout << "Countable: " << name << ", group=" << g->name << - ", counter=" << d->assigned_counters[i] - 1 << "\n"; + std::cout << "Countable: " << name << ", group=" << g->name + << ", counter=" << counter_index << "\n"; return; }