pan/mdg: Add 16 bytes of padding to the end of shaders

Fixes INSTR_INVALID_PC faults when a shader ends on a 16MB boundary.

Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11551>
This commit is contained in:
Icecream95
2021-06-23 20:31:37 +12:00
committed by Marge Bot
parent 55951ac28e
commit 08495a948e
+6
View File
@@ -3238,6 +3238,12 @@ midgard_compile_shader_nir(nir_shader *nir,
fflush(stdout);
}
/* A shader ending on a 16MB boundary causes INSTR_INVALID_PC faults,
* workaround by adding some padding to the end of the shader. (The
* kernel makes sure shader BOs can't cross 16MB boundaries.) */
if (binary->size)
memset(util_dynarray_grow(binary, uint8_t, 16), 0, 16);
if ((midgard_debug & MIDGARD_DBG_SHADERDB || inputs->shaderdb) &&
!nir->info.internal) {
unsigned nr_bundles = 0, nr_ins = 0;