From a20a9d0c5e7e9d4468cfcf58fc5a4e9ad8f90610 Mon Sep 17 00:00:00 2001 From: Timothy Arceri Date: Wed, 17 Jul 2019 14:20:55 +1000 Subject: [PATCH] radv: dont store disasm string unless keep_shader_info flag set This fixes the memory use regression from bug 111107. Fixes: 726a31df705 ("radv: Add the concept of radv shader binaries.") Reviewed-by: Bas Nieuwenhuizen Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=111107 --- src/amd/vulkan/radv_shader.c | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/src/amd/vulkan/radv_shader.c b/src/amd/vulkan/radv_shader.c index bcc050a86cc..ffbef6857b9 100644 --- a/src/amd/vulkan/radv_shader.c +++ b/src/amd/vulkan/radv_shader.c @@ -1011,18 +1011,20 @@ radv_shader_variant_create(struct radv_device *device, return NULL; } - const char *disasm_data; - size_t disasm_size; - if (!ac_rtld_get_section_by_name(&rtld_binary, ".AMDGPU.disasm", &disasm_data, &disasm_size)) { - radv_shader_variant_destroy(device, variant); - ac_rtld_close(&rtld_binary); - return NULL; - } + if (device->keep_shader_info) { + const char *disasm_data; + size_t disasm_size; + if (!ac_rtld_get_section_by_name(&rtld_binary, ".AMDGPU.disasm", &disasm_data, &disasm_size)) { + radv_shader_variant_destroy(device, variant); + ac_rtld_close(&rtld_binary); + return NULL; + } - variant->llvm_ir_string = bin->llvm_ir_size ? strdup((const char*)(bin->data + bin->elf_size)) : NULL; - variant->disasm_string = malloc(disasm_size + 1); - memcpy(variant->disasm_string, disasm_data, disasm_size); - variant->disasm_string[disasm_size] = 0; + variant->llvm_ir_string = bin->llvm_ir_size ? strdup((const char*)(bin->data + bin->elf_size)) : NULL; + variant->disasm_string = malloc(disasm_size + 1); + memcpy(variant->disasm_string, disasm_data, disasm_size); + variant->disasm_string[disasm_size] = 0; + } ac_rtld_close(&rtld_binary); } else { -- 2.30.2