radv: Only set pstate for the first hw_ctx.

We used to do it for every queue, which was duplicate work as pstate is
per-device. It could also cause trouble when multiple hw_ctx are created as
the call will succeed for only one of them and the rest will return -EBUSY.

Simplify and fix this by only setting for the first non-null hw_ctx.

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17541>
This commit is contained in:
Tatsuyuki Ishi 2022-07-14 21:23:50 +09:00 committed by Marge Bot
parent 2d2591bbb7
commit 648731e2bd
1 changed files with 5 additions and 8 deletions

View File

@ -7150,14 +7150,11 @@ radv_thread_trace_set_pstate(struct radv_device *device, bool enable)
enum radeon_ctx_pstate pstate = enable ? RADEON_CTX_PSTATE_PEAK : RADEON_CTX_PSTATE_NONE;
if (device->physical_device->rad_info.has_stable_pstate) {
for (unsigned i = 0; i < RADV_MAX_QUEUE_FAMILIES; i++) {
for (unsigned q = 0; q < device->queue_count[i]; q++) {
struct radv_queue *queue = &device->queues[i][q];
if (ws->ctx_set_pstate(queue->hw_ctx, pstate) < 0)
return false;
}
}
/* pstate is per-device; setting it for one ctx is sufficient.
* We pick the first initialized one below. */
for (unsigned i = 0; i < RADV_NUM_HW_CTX; i++)
if (device->hw_ctx[i])
return ws->ctx_set_pstate(device->hw_ctx[i], pstate) >= 0;
}
return true;