radv: keep track of the disasm string in debug mode only
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Fri, 1 Sep 2017 11:45:33 +0000 (13:45 +0200)
committerSamuel Pitoiset <samuel.pitoiset@gmail.com>
Fri, 8 Sep 2017 15:18:17 +0000 (17:18 +0200)
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 <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
src/amd/vulkan/radv_shader.c
src/amd/vulkan/radv_shader.h

index de7d9a275247198729acab2c4f26bbf249022e17..1e25ea378ea7c0242809e201ef201472e1a9ddc3 100644 (file)
@@ -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);
 }
 
index 3f8dd92392dca6ef44cc41e78f6370d895279fbd..9de3c27550db50a05e221fb9500d54741ca68f3b 100644 (file)
@@ -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;
 };