summaryrefslogtreecommitdiffstats
path: root/src/gallium
diff options
context:
space:
mode:
authorAlyssa Rosenzweig <[email protected]>2019-07-23 10:14:46 -0700
committerAlyssa Rosenzweig <[email protected]>2019-07-25 06:34:20 -0700
commita9c73e825a98d280c9af218cd6cedb4ab877f562 (patch)
treeb30cffbb33686784dc313da60ee182a8a9c9cc3b /src/gallium
parentb2a3ca6bd5008638acb3c0797a5658be67b96d86 (diff)
panfrost: Reserve, but do not upload, shader padding
Fixes invalid read errors reported by valgrind. Signed-off-by: Alyssa Rosenzweig <[email protected]>
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/drivers/panfrost/pan_allocate.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/gallium/drivers/panfrost/pan_allocate.c b/src/gallium/drivers/panfrost/pan_allocate.c
index 9e9565d6006..f549c864c70 100644
--- a/src/gallium/drivers/panfrost/pan_allocate.c
+++ b/src/gallium/drivers/panfrost/pan_allocate.c
@@ -151,10 +151,10 @@ panfrost_upload_transient(struct panfrost_context *ctx, const void *data, size_t
mali_ptr
panfrost_upload(struct panfrost_memory *mem, const void *data, size_t sz)
{
- sz = ALIGN_POT(sz, ALIGNMENT);
+ size_t aligned_sz = ALIGN_POT(sz, ALIGNMENT);
/* Bounds check */
- if ((mem->stack_bottom + sz) >= mem->bo->size) {
+ if ((mem->stack_bottom + aligned_sz) >= mem->bo->size) {
printf("Out of memory, tried to upload %zd but only %zd available\n",
sz, mem->bo->size - mem->stack_bottom);
assert(0);
@@ -163,6 +163,6 @@ panfrost_upload(struct panfrost_memory *mem, const void *data, size_t sz)
memcpy((uint8_t *) mem->bo->cpu + mem->stack_bottom, data, sz);
mali_ptr gpu = mem->bo->gpu + mem->stack_bottom;
- mem->stack_bottom += sz;
+ mem->stack_bottom += aligned_sz;
return gpu;
}