pan/bi: Fix empty shader handling

Fixes INSTR_INVALID_ENC fault on dEQP-GLES31.functional.compute.basic.empty

Fixes: bfcdc8f174 ("pan/bi: Add some zero bytes after shaders on Bifrost")
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9011>
(cherry picked from commit 9bf8bfe3c8)

 Conflicts:
	src/panfrost/bifrost/bifrost_compile.c
This commit is contained in:
Alyssa Rosenzweig 2021-02-12 08:21:45 -05:00 committed by Dylan Baker
parent 67db4ad07f
commit 63d0fbb07b
2 changed files with 8 additions and 4 deletions

View file

@ -3298,7 +3298,7 @@
"description": "pan/bi: Fix empty shader handling",
"nominated": true,
"nomination_type": 1,
"resolution": 0,
"resolution": 1,
"master_sha": null,
"because_sha": "bfcdc8f1747eabad57449a309be7160dd27605ac"
},

View file

@ -2267,9 +2267,13 @@ bifrost_compile_shader_nir(void *mem_ctx, nir_shader *nir,
bifrost_debug & BIFROST_DBG_VERBOSE);
}
/* Pad the shader with enough zero bytes to trick the prefetcher */
memset(util_dynarray_grow(&program->compiled, uint8_t, BIFROST_SHADER_PREFETCH),
0, BIFROST_SHADER_PREFETCH);
/* Pad the shader with enough zero bytes to trick the prefetcher,
* unless we're compiling an empty shader (in which case we don't pad
* so the size remains 0) */
if (program->compiled.size) {
memset(util_dynarray_grow(&program->compiled, uint8_t, BIFROST_SHADER_PREFETCH),
0, BIFROST_SHADER_PREFETCH);
}
program->tls_size = ctx->tls_size;