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@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14950>
This commit is contained in:
Samuel Pitoiset 2022-02-09 14:29:11 +01:00
parent 306e153c18
commit 2dcd12f38b
1 changed files with 11 additions and 1 deletions

View File

@ -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;
}
}
}
}