diff options
author | Icecream95 <ixn@disroot.org> | 2021-01-12 22:31:55 +1300 |
---|---|---|
committer | Marge Bot <eric+marge@anholt.net> | 2021-01-13 00:11:20 +0000 |
commit | bfcdc8f1747eabad57449a309be7160dd27605ac (patch) | |
tree | 8473fe76cc6e90313c778c670d88e1ea51244f5a | |
parent | e74b2edcef9bd3aed41b8bb013efd9e771ae647c (diff) |
pan/bi: Add some zero bytes after shaders on Bifrost
Bifrost will prefetch bytes after the end of shaders, so make sure
these bytes are allocated and zeroed.
Fixes GPU faults in Xonotic.
Suggested-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8428>
-rw-r--r-- | src/panfrost/bifrost/bifrost_compile.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/panfrost/bifrost/bifrost_compile.c b/src/panfrost/bifrost/bifrost_compile.c index ea26034dafd..55a17f3bf35 100644 --- a/src/panfrost/bifrost/bifrost_compile.c +++ b/src/panfrost/bifrost/bifrost_compile.c @@ -2236,6 +2236,10 @@ 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); + program->tls_size = ctx->tls_size; if ((bifrost_debug & BIFROST_DBG_SHADERDB || inputs->shaderdb) && |