summaryrefslogtreecommitdiffstats
path: root/src/amd/vulkan/radv_shader.c
diff options
context:
space:
mode:
authorTimothy Arceri <[email protected]>2019-07-17 14:20:55 +1000
committerTimothy Arceri <[email protected]>2019-07-18 00:25:55 +0000
commita20a9d0c5e7e9d4468cfcf58fc5a4e9ad8f90610 (patch)
tree5ad0d1b0bd3604e23f8f9893b45112dd11ac2009 /src/amd/vulkan/radv_shader.c
parent82a2f1052946ec977a7b1fa5f08ff01e6334cff4 (diff)
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 <[email protected]> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=111107
Diffstat (limited to 'src/amd/vulkan/radv_shader.c')
-rw-r--r--src/amd/vulkan/radv_shader.c24
1 files 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 {