From 885d75760b9157f1d84105c979503ec8588470c6 Mon Sep 17 00:00:00 2001 From: Samuel Pitoiset Date: Fri, 1 Sep 2017 13:45:33 +0200 Subject: [PATCH] radv: keep track of the disasm string in debug mode only This will allow to dump the active shaders when a hang is detected. Only the ASM will be dumped for now. Signed-off-by: Samuel Pitoiset Reviewed-by: Bas Nieuwenhuizen --- src/amd/vulkan/radv_shader.c | 9 ++++++++- src/amd/vulkan/radv_shader.h | 1 + 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/amd/vulkan/radv_shader.c b/src/amd/vulkan/radv_shader.c index de7d9a27524..1e25ea378ea 100644 --- a/src/amd/vulkan/radv_shader.c +++ b/src/amd/vulkan/radv_shader.c @@ -425,8 +425,14 @@ shader_variant_create(struct radv_device *device, free(binary.rodata); free(binary.global_symbol_offsets); free(binary.relocs); - free(binary.disasm_string); variant->ref_count = 1; + + if (device->trace_bo) { + variant->disasm_string = binary.disasm_string; + } else { + free(binary.disasm_string); + } + return variant; } @@ -477,6 +483,7 @@ radv_shader_variant_destroy(struct radv_device *device, list_del(&variant->slab_list); mtx_unlock(&device->shader_slab_mutex); + free(variant->disasm_string); free(variant); } diff --git a/src/amd/vulkan/radv_shader.h b/src/amd/vulkan/radv_shader.h index 3f8dd92392d..9de3c27550d 100644 --- a/src/amd/vulkan/radv_shader.h +++ b/src/amd/vulkan/radv_shader.h @@ -49,6 +49,7 @@ struct radv_shader_variant { struct ac_shader_variant_info info; unsigned rsrc1; unsigned rsrc2; + char *disasm_string; /* debug only */ struct list_head slab_list; }; -- 2.30.2