diff --git a/.pick_status.json b/.pick_status.json index 883c9b25b52..b31ee762f2a 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -1264,7 +1264,7 @@ "description": "pan/mdg: Add 16 bytes of padding to the end of shaders", "nominated": true, "nomination_type": 0, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": null }, diff --git a/src/panfrost/midgard/midgard_compile.c b/src/panfrost/midgard/midgard_compile.c index 58c9aea3f0d..b037521aa6e 100644 --- a/src/panfrost/midgard/midgard_compile.c +++ b/src/panfrost/midgard/midgard_compile.c @@ -3204,6 +3204,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;