summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorIcecream95 <ixn@disroot.org>2021-06-23 20:31:37 +1200
committerMarge Bot <eric+marge@anholt.net>2021-06-23 14:42:55 +0000
commit08495a948e16ac4fe54e282b77e8265551606219 (patch)
treedd3426559d982065a86b0d04de92540624b7cca4 /src
parent55951ac28e7a30c2fae762990962a4410669c989 (diff)
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>
Diffstat (limited to 'src')
-rw-r--r--src/panfrost/midgard/midgard_compile.c6
1 files changed, 6 insertions, 0 deletions
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;