Mesa (main): radv: fix finding shaders by PC
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Mon Feb 14 09:27:17 UTC 2022
Module: Mesa
Branch: main
Commit: 2dcd12f38be629086148dfc9ff0da90aa1fc9698
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=2dcd12f38be629086148dfc9ff0da90aa1fc9698
Author: Samuel Pitoiset <samuel.pitoiset at gmail.com>
Date: Wed Feb 9 14:29:11 2022 +0100
radv: fix finding shaders by PC
Shaders are allocated contiguously in memory for a pipeline and
the freelist.next pointer is a pointer to the pipeline now.
Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas at basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14950>
---
src/amd/vulkan/radv_shader.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/src/amd/vulkan/radv_shader.c b/src/amd/vulkan/radv_shader.c
index 40e53e0d594..99094d907ec 100644
--- a/src/amd/vulkan/radv_shader.c
+++ b/src/amd/vulkan/radv_shader.c
@@ -2247,7 +2247,17 @@ radv_find_shader(struct radv_device *device, uint64_t pc)
uint64_t start = radv_buffer_get_va(block->arena->bo) + block->offset;
if (!block->freelist.prev && pc >= start && pc < start + block->size) {
mtx_unlock(&device->shader_arena_mutex);
- return (struct radv_shader *)block->freelist.next;
+
+ struct radv_pipeline *pipeline = (struct radv_pipeline *)block->freelist.next;
+ for (uint32_t i = 0; i < MESA_VULKAN_SHADER_STAGES; i++) {
+ struct radv_shader *shader = pipeline->shaders[i];
+ if (!shader)
+ continue;
+
+ if (pc >= shader->va &&
+ pc < shader->va + align(shader->code_size, RADV_SHADER_ALLOC_ALIGNMENT))
+ return shader;
+ }
}
}
}
More information about the mesa-commit
mailing list