Mesa (4088-timespec_get-used-unconditionally-build-fails-when-targeting-macos-10-14-or-earlier): pan/bi: Add some zero bytes after shaders on Bifrost

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Jan 13 00:51:56 UTC 2021


Module: Mesa
Branch: 4088-timespec_get-used-unconditionally-build-fails-when-targeting-macos-10-14-or-earlier
Commit: bfcdc8f1747eabad57449a309be7160dd27605ac
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=bfcdc8f1747eabad57449a309be7160dd27605ac

Author: Icecream95 <ixn at disroot.org>
Date:   Tue Jan 12 22:31:55 2021 +1300

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 at collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8428>

---

 src/panfrost/bifrost/bifrost_compile.c | 4 ++++
 1 file changed, 4 insertions(+)

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) &&



More information about the mesa-commit mailing list