Mesa (main): radv: Only set pstate for the first hw_ctx.
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Fri Jul 15 15:16:58 UTC 2022
Module: Mesa
Branch: main
Commit: 648731e2bd746a97e94bebf68423c84f6e887844
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=648731e2bd746a97e94bebf68423c84f6e887844
Author: Tatsuyuki Ishi <ishitatsuyuki at gmail.com>
Date: Thu Jul 14 21:23:50 2022 +0900
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 at gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17541>
---
src/amd/vulkan/radv_device.c | 13 +++++--------
1 file changed, 5 insertions(+), 8 deletions(-)
diff --git a/src/amd/vulkan/radv_device.c b/src/amd/vulkan/radv_device.c
index ad0800bc992..6ab6280bf61 100644
--- a/src/amd/vulkan/radv_device.c
+++ b/src/amd/vulkan/radv_device.c
@@ -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;
More information about the mesa-commit
mailing list