[Mesa-dev] [PATCH 089/140] radeonsi/gfx9: pad shader binaries by 128 bytes
Marek Olšák
maraeo at gmail.com
Mon Mar 20 22:43:39 UTC 2017
From: Marek Olšák <marek.olsak at amd.com>
---
src/gallium/drivers/radeonsi/si_shader.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c
index cc0ef96..226924b 100644
--- a/src/gallium/drivers/radeonsi/si_shader.c
+++ b/src/gallium/drivers/radeonsi/si_shader.c
@@ -5865,20 +5865,26 @@ int si_shader_binary_upload(struct si_screen *sscreen, struct si_shader *shader)
shader->epilog ? &shader->epilog->binary : NULL;
const struct ac_shader_binary *mainb = &shader->binary;
unsigned bo_size = si_get_shader_binary_size(shader) +
(!epilog ? mainb->rodata_size : 0);
unsigned char *ptr;
assert(!prolog || !prolog->rodata_size);
assert((!prolog && !epilog) || !mainb->rodata_size);
assert(!epilog || !epilog->rodata_size);
+ /* GFX9 can fetch at most 128 bytes past the end of the shader.
+ * Prevent VM faults.
+ */
+ if (sscreen->b.chip_class >= GFX9)
+ bo_size += 128;
+
r600_resource_reference(&shader->bo, NULL);
shader->bo = (struct r600_resource*)
pipe_buffer_create(&sscreen->b.b, 0,
PIPE_USAGE_IMMUTABLE,
align(bo_size, SI_CPDMA_ALIGNMENT));
if (!shader->bo)
return -ENOMEM;
/* Upload. */
ptr = sscreen->b.ws->buffer_map(shader->bo->buf, NULL,
--
2.7.4
More information about the mesa-dev
mailing list