Module: Mesa Branch: main Commit: 08495a948e16ac4fe54e282b77e8265551606219 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=08495a948e16ac4fe54e282b77e8265551606219
Author: Icecream95 <[email protected]> Date: Wed Jun 23 20:31:37 2021 +1200 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> --- src/panfrost/midgard/midgard_compile.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/panfrost/midgard/midgard_compile.c b/src/panfrost/midgard/midgard_compile.c index 041e9586953..a8d254802fa 100644 --- a/src/panfrost/midgard/midgard_compile.c +++ b/src/panfrost/midgard/midgard_compile.c @@ -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; _______________________________________________ mesa-commit mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/mesa-commit
