summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/radeon/radeon_elf_util.c
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2015-07-11 00:17:48 +0200
committerMarek Olšák <[email protected]>2015-07-31 16:49:16 +0200
commit7dd1f45bc41c4a936b0ff84400840524bb9f8871 (patch)
tree11e31bc5fcb512370af17886c00133aa036e4817 /src/gallium/drivers/radeon/radeon_elf_util.c
parent1bbe40836306549414408bb7f30b9288c020db75 (diff)
radeonsi: store shader disassemblies in memory for future users
This will be used by the new ddebug pipe. I'm including it now to avoid conflicts with other patches.
Diffstat (limited to 'src/gallium/drivers/radeon/radeon_elf_util.c')
-rw-r--r--src/gallium/drivers/radeon/radeon_elf_util.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/src/gallium/drivers/radeon/radeon_elf_util.c b/src/gallium/drivers/radeon/radeon_elf_util.c
index 9b508227fd4..2e45d439e7a 100644
--- a/src/gallium/drivers/radeon/radeon_elf_util.c
+++ b/src/gallium/drivers/radeon/radeon_elf_util.c
@@ -103,8 +103,7 @@ static void parse_relocs(Elf *elf, Elf_Data *relocs, Elf_Data *symbols,
}
void radeon_elf_read(const char *elf_data, unsigned elf_size,
- struct radeon_shader_binary *binary,
- unsigned debug)
+ struct radeon_shader_binary *binary)
{
char *elf_buffer;
Elf *elf;
@@ -124,7 +123,6 @@ void radeon_elf_read(const char *elf_data, unsigned elf_size,
elf = elf_memory(elf_buffer, elf_size);
elf_getshdrstrndx(elf, &section_str_index);
- binary->disassembled = 0;
while ((section = elf_nextscn(elf, section))) {
const char *name;
@@ -145,12 +143,11 @@ void radeon_elf_read(const char *elf_data, unsigned elf_size,
binary->config_size = section_data->d_size;
binary->config = MALLOC(binary->config_size * sizeof(unsigned char));
memcpy(binary->config, section_data->d_buf, binary->config_size);
- } else if (debug && !strcmp(name, ".AMDGPU.disasm")) {
- binary->disassembled = 1;
+ } else if (!strcmp(name, ".AMDGPU.disasm")) {
+ /* Always read disassembly if it's available. */
section_data = elf_getdata(section, section_data);
- fprintf(stderr, "\nShader Disassembly:\n\n");
- fprintf(stderr, "%.*s\n", (int)section_data->d_size,
- (char *)section_data->d_buf);
+ binary->disasm_string = strndup(section_data->d_buf,
+ section_data->d_size);
} else if (!strncmp(name, ".rodata", 7)) {
section_data = elf_getdata(section, section_data);
binary->rodata_size = section_data->d_size;