[Mesa-dev] [PATCH 5/9] radv: free the disasm string when shaders are destroyed

Samuel Pitoiset samuel.pitoiset at gmail.com
Tue Sep 5 19:17:10 UTC 2017


To dump the ASM when RADV_TRACE_FILE is used and a hang is
detected.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
---
 src/amd/vulkan/radv_shader.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/amd/vulkan/radv_shader.c b/src/amd/vulkan/radv_shader.c
index 44a1f64737..0596fb7f54 100644
--- a/src/amd/vulkan/radv_shader.c
+++ b/src/amd/vulkan/radv_shader.c
@@ -426,7 +426,6 @@ 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;
 	return variant;
 }
@@ -471,6 +470,8 @@ void
 radv_shader_variant_destroy(struct radv_device *device,
 			    struct radv_shader_variant *variant)
 {
+	struct ac_shader_binary *binary = &variant->binary;
+
 	if (!p_atomic_dec_zero(&variant->ref_count))
 		return;
 
@@ -478,6 +479,7 @@ radv_shader_variant_destroy(struct radv_device *device,
 	list_del(&variant->slab_list);
 	mtx_unlock(&device->shader_slab_mutex);
 
+	free(binary->disasm_string);
 	free(variant);
 }
 
-- 
2.14.1



More information about the mesa-dev mailing list