radeonsi/sqtt: keep a copy of the uploaded shader code

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9277>
This commit is contained in:
Pierre-Eric Pelloux-Prayer 2021-02-23 15:05:19 +01:00 committed by Marge Bot
parent 7f5a8db96d
commit a27ea38d2a
2 changed files with 16 additions and 2 deletions

View file

@ -874,12 +874,19 @@ bool si_shader_binary_upload(struct si_screen *sscreen, struct si_shader *shader
if (!u.rx_ptr)
return false;
bool ok = ac_rtld_upload(&u);
int size = ac_rtld_upload(&u);
if (sscreen->debug_flags & DBG(SQTT)) {
/* Remember the uploaded code */
shader->binary.uploaded_code_size = size;
shader->binary.uploaded_code = malloc(size);
memcpy(shader->binary.uploaded_code, u.rx_ptr, size);
}
sscreen->ws->buffer_unmap(shader->bo->buf);
ac_rtld_close(&binary);
return ok;
return size >= 0;
}
static void si_shader_dump_disassembly(struct si_screen *screen,
@ -2143,6 +2150,10 @@ void si_shader_binary_clean(struct si_shader_binary *binary)
free(binary->llvm_ir_string);
binary->llvm_ir_string = NULL;
free(binary->uploaded_code);
binary->uploaded_code = NULL;
binary->uploaded_code_size = 0;
}
void si_shader_destroy(struct si_shader *shader)

View file

@ -723,6 +723,9 @@ struct si_shader_binary {
const char *elf_buffer;
size_t elf_size;
char *uploaded_code;
size_t uploaded_code_size;
char *llvm_ir_string;
};