diff options
author | Marek Olšák <[email protected]> | 2018-04-05 14:48:37 -0400 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2018-04-10 13:05:20 -0400 |
commit | 19ce5048eedeac6584ae51f79658656ae53f0e05 (patch) | |
tree | 15dcf27879953f6fb8bb66b6e16c568705a5fe02 /src/gallium/drivers/radeonsi | |
parent | b64b7125586ce48232658cd860f549a6139b6ddd (diff) |
radeonsi: add shader binary padding for UMR
Diffstat (limited to 'src/gallium/drivers/radeonsi')
-rw-r--r-- | src/gallium/drivers/radeonsi/si_shader.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c index c18915488e5..8c62d53e2ad 100644 --- a/src/gallium/drivers/radeonsi/si_shader.c +++ b/src/gallium/drivers/radeonsi/si_shader.c @@ -5309,6 +5309,10 @@ void si_shader_apply_scratch_relocs(struct si_shader *shader, } } +/* For the UMR disassembler. */ +#define DEBUGGER_END_OF_CODE_MARKER 0xbf9f0000 /* invalid instruction */ +#define DEBUGGER_NUM_MARKERS 5 + static unsigned si_get_shader_binary_size(const struct si_shader *shader) { unsigned size = shader->binary.code_size; @@ -5321,7 +5325,7 @@ static unsigned si_get_shader_binary_size(const struct si_shader *shader) size += shader->prolog2->binary.code_size; if (shader->epilog) size += shader->epilog->binary.code_size; - return size; + return size + DEBUGGER_NUM_MARKERS * 4; } int si_shader_binary_upload(struct si_screen *sscreen, struct si_shader *shader) @@ -5380,10 +5384,18 @@ int si_shader_binary_upload(struct si_screen *sscreen, struct si_shader *shader) memcpy(ptr, mainb->code, mainb->code_size); ptr += mainb->code_size; - if (epilog) + if (epilog) { memcpy(ptr, epilog->code, epilog->code_size); - else if (mainb->rodata_size > 0) + ptr += epilog->code_size; + } else if (mainb->rodata_size > 0) { memcpy(ptr, mainb->rodata, mainb->rodata_size); + ptr += mainb->rodata_size; + } + + /* Add end-of-code markers for the UMR disassembler. */ + uint32_t *ptr32 = (uint32_t*)ptr; + for (unsigned i = 0; i < DEBUGGER_NUM_MARKERS; i++) + ptr32[i] = DEBUGGER_END_OF_CODE_MARKER; sscreen->ws->buffer_unmap(shader->bo->buf); return 0; |