summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>2021-02-12 08:21:45 -0500
committerDylan Baker <dylan.c.baker@intel.com>2021-02-18 14:05:47 -0800
commit63d0fbb07b31f916a855af4b7a8cfd779b42f547 (patch)
treef8c043631a226d836b10d7831f07da2ee87f24d0
parent67db4ad07f74a4ed6fc11a170afef4243f4c740d (diff)
pan/bi: Fix empty shader handling
Fixes INSTR_INVALID_ENC fault on dEQP-GLES31.functional.compute.basic.empty Fixes: bfcdc8f1747 ("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 9bf8bfe3c8db1a0e10eb0471fa6916f924e06e1c) Conflicts: src/panfrost/bifrost/bifrost_compile.c
-rw-r--r--.pick_status.json2
-rw-r--r--src/panfrost/bifrost/bifrost_compile.c10
2 files changed, 8 insertions, 4 deletions
diff --git a/.pick_status.json b/.pick_status.json
index c23f5aa2cdb..00a96fef97d 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -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"
},
diff --git a/src/panfrost/bifrost/bifrost_compile.c b/src/panfrost/bifrost/bifrost_compile.c
index f4ad2950039..d8be3efb954 100644
--- a/src/panfrost/bifrost/bifrost_compile.c
+++ b/src/panfrost/bifrost/bifrost_compile.c
@@ -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;