summaryrefslogtreecommitdiff
path: root/lib/mesa/src/gallium/drivers/radeon
diff options
context:
space:
mode:
authorJonathan Gray <jsg@cvs.openbsd.org>2015-11-22 02:43:46 +0000
committerJonathan Gray <jsg@cvs.openbsd.org>2015-11-22 02:43:46 +0000
commit32b883ef9b3f14837590b8bd6b321c49ef938c65 (patch)
treed7ae4d90061f3690df4d9e11877b2fa9b9df9089 /lib/mesa/src/gallium/drivers/radeon
parenta54d0279093d6d2f6e995326298b823c2fce205d (diff)
import Mesa 11.0.6
Diffstat (limited to 'lib/mesa/src/gallium/drivers/radeon')
-rw-r--r--lib/mesa/src/gallium/drivers/radeon/radeon_elf_util.c26
-rw-r--r--lib/mesa/src/gallium/drivers/radeon/radeon_elf_util.h14
2 files changed, 38 insertions, 2 deletions
diff --git a/lib/mesa/src/gallium/drivers/radeon/radeon_elf_util.c b/lib/mesa/src/gallium/drivers/radeon/radeon_elf_util.c
index 8aaa85d02..2e45d439e 100644
--- a/lib/mesa/src/gallium/drivers/radeon/radeon_elf_util.c
+++ b/lib/mesa/src/gallium/drivers/radeon/radeon_elf_util.c
@@ -98,8 +98,7 @@ static void parse_relocs(Elf *elf, Elf_Data *relocs, Elf_Data *symbols,
symbol_name = elf_strptr(elf, symbol_sh_link, symbol.st_name);
reloc->offset = rel.r_offset;
- strncpy(reloc->name, symbol_name, sizeof(reloc->name)-1);
- reloc->name[sizeof(reloc->name)-1] = 0;
+ reloc->name = strdup(symbol_name);
}
}
@@ -195,3 +194,26 @@ const unsigned char *radeon_shader_binary_config_start(
}
return binary->config;
}
+
+void radeon_shader_binary_free_relocs(struct radeon_shader_reloc *relocs,
+ unsigned reloc_count)
+{
+ unsigned i;
+ for (i = 0; i < reloc_count; i++) {
+ FREE(relocs[i].name);
+ }
+ FREE(relocs);
+}
+
+void radeon_shader_binary_free_members(struct radeon_shader_binary *binary,
+ unsigned free_relocs)
+{
+ FREE(binary->code);
+ FREE(binary->config);
+ FREE(binary->rodata);
+
+ if (free_relocs) {
+ radeon_shader_binary_free_relocs(binary->relocs,
+ binary->reloc_count);
+ }
+}
diff --git a/lib/mesa/src/gallium/drivers/radeon/radeon_elf_util.h b/lib/mesa/src/gallium/drivers/radeon/radeon_elf_util.h
index c2af9e0df..ea4ab2f14 100644
--- a/lib/mesa/src/gallium/drivers/radeon/radeon_elf_util.h
+++ b/lib/mesa/src/gallium/drivers/radeon/radeon_elf_util.h
@@ -47,4 +47,18 @@ const unsigned char *radeon_shader_binary_config_start(
const struct radeon_shader_binary *binary,
uint64_t symbol_offset);
+/**
+ * Free all memory allocated for members of \p binary. This function does
+ * not free \p binary.
+ *
+ * @param free_relocs If false, reolc information will not be freed.
+ */
+void radeon_shader_binary_free_members(struct radeon_shader_binary *binary,
+ unsigned free_relocs);
+
+/**
+ * Free \p relocs and all member data.
+ */
+void radeon_shader_binary_free_relocs(struct radeon_shader_reloc *relocs,
+ unsigned reloc_count);
#endif /* RADEON_ELF_UTIL_H */