freedreno/ir3: Include at least 4 NOPs so that cffdump doesn't disasm junk.

cffdump looks at the following 4 instructions to decide if the shader has
*really* ended, so if we pack data after that (such as turnip's next
stage's shader), it might decode instructions that aren't really part of
the shader.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5810>
This commit is contained in:
Eric Anholt 2020-08-04 16:43:51 -07:00
parent 51f2b11b04
commit a9b37e5dad

View file

@ -938,8 +938,17 @@ void * ir3_assemble(struct ir3_shader_variant *v)
v->instrlen = DIV_ROUND_UP(instr_count, compiler->instr_align);
/* Pad out with NOPs to instrlen. */
info->sizedwords = v->instrlen * compiler->instr_align * sizeof(instr_t) / 4;
/* Pad out with NOPs to instrlen, including at least 4 so that cffdump
* doesn't try to decode the following data as instructions (such as the
* next stage's shader in turnip)
*/
info->sizedwords = MAX2(v->instrlen * compiler->instr_align,
instr_count + 4) * sizeof(instr_t) / 4;
/* Pad out the size so that when turnip uploads the shaders in
* sequence, the starting offset of the next one is properly aligned.
*/
info->sizedwords = align(info->sizedwords, compiler->instr_align * sizeof(instr_t) / 4);
ptr = dwords = rzalloc_size(v, 4 * info->sizedwords);