This was real "fun" to debug...
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Fixes: 373a204bdd7 ("panfrost: Pass alignments explicitly")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6410>
shared.scratchpad = stack->gpu;
}
- postfix->shared_memory = panfrost_pool_upload(&batch->pool, &shared, sizeof(shared));
+ postfix->shared_memory = panfrost_pool_upload_aligned(&batch->pool, &shared, sizeof(shared), 64);
}
static void
* PIPE_CAP_CONSTANT_BUFFER_OFFSET_ALIGNMENT */
return rsrc->bo->gpu + cb->buffer_offset;
} else if (cb->user_buffer) {
- return panfrost_pool_upload(&batch->pool,
+ return panfrost_pool_upload_aligned(&batch->pool,
cb->user_buffer +
cb->buffer_offset,
- cb->buffer_size);
+ cb->buffer_size, 16);
} else {
unreachable("No constant buffer");
}
.shared_shift = util_logbase2(single_size) + 1
};
- vtp->postfix.shared_memory = panfrost_pool_upload(&batch->pool, &shared,
- sizeof(shared));
+ vtp->postfix.shared_memory = panfrost_pool_upload_aligned(&batch->pool, &shared,
+ sizeof(shared), 64);
}
static mali_ptr
trampolines[i] = panfrost_get_tex_desc(batch, stage, view);
}
- postfix->textures = panfrost_pool_upload(&batch->pool,
+ postfix->textures = panfrost_pool_upload_aligned(&batch->pool,
trampolines,
sizeof(uint64_t) *
- ctx->sampler_view_count[stage]);
+ ctx->sampler_view_count[stage],
+ sizeof(uint64_t));
}
}
struct panfrost_transfer S = panfrost_pool_alloc_aligned(&batch->pool,
MALI_ATTRIBUTE_BUFFER_LENGTH * vs->attribute_count *
(could_npot ? 2 : 1),
- MALI_ATTRIBUTE_BUFFER_LENGTH);
+ MALI_ATTRIBUTE_BUFFER_LENGTH * 2);
struct panfrost_transfer T = panfrost_pool_alloc_aligned(&batch->pool,
MALI_ATTRIBUTE_LENGTH * vs->attribute_count,
unsigned xfb_base = pan_xfb_base(present);
struct panfrost_transfer T = panfrost_pool_alloc_aligned(&batch->pool,
MALI_ATTRIBUTE_BUFFER_LENGTH * (xfb_base + ctx->streamout.num_targets),
- MALI_ATTRIBUTE_BUFFER_LENGTH);
+ MALI_ATTRIBUTE_BUFFER_LENGTH * 2);
struct mali_attribute_buffer_packed *varyings =
(struct mali_attribute_buffer_packed *) T.cpu;
0, 0,
};
- return panfrost_pool_upload(&batch->pool, locations, 96 * sizeof(uint16_t));
+ return panfrost_pool_upload_aligned(&batch->pool, locations, 96 * sizeof(uint16_t), 64);
}
.framebuffer = framebuffer,
};
- struct panfrost_transfer transfer = panfrost_pool_alloc(&batch->pool, sizeof(header) + sizeof(payload));
+ struct panfrost_transfer transfer = panfrost_pool_alloc_aligned(&batch->pool, sizeof(header) + sizeof(payload), 64);
memcpy(transfer.cpu, &header, sizeof(header));
memcpy(transfer.cpu + sizeof(header), &payload, sizeof(payload));
return transfer.gpu;
.flags = 0x0,
.width = MALI_POSITIVE(batch->key.width),
.height = MALI_POSITIVE(batch->key.height),
- .tiler_heap_meta = panfrost_pool_upload(&batch->pool, &tiler_heap_meta, sizeof(tiler_heap_meta)),
+ .tiler_heap_meta = panfrost_pool_upload_aligned(&batch->pool, &tiler_heap_meta, sizeof(tiler_heap_meta), 64)
};
- batch->tiler_meta = panfrost_pool_upload(&batch->pool, &tiler_meta, sizeof(tiler_meta));
+ batch->tiler_meta = panfrost_pool_upload_aligned(&batch->pool, &tiler_meta, sizeof(tiler_meta), 64);
return batch->tiler_meta;
}
fb.format.unk2 |= MALI_SFBD_FORMAT_MSAA_B;
}
- return panfrost_pool_upload(&batch->pool, &fb, sizeof(fb));
+ return panfrost_pool_upload_aligned(&batch->pool, &fb, sizeof(fb), 64);
}
struct panfrost_transfer
panfrost_pool_alloc_aligned(struct pan_pool *pool, size_t sz, unsigned alignment)
{
+ assert(alignment == util_next_power_of_two(alignment));
+
/* Find or create a suitable BO */
struct panfrost_bo *bo = pool->transient_bo;
unsigned offset = ALIGN_POT(pool->transient_offset, alignment);
mali_ptr
panfrost_pool_upload(struct pan_pool *pool, const void *data, size_t sz)
{
- struct panfrost_transfer transfer = panfrost_pool_alloc(pool, sz);
+ return panfrost_pool_upload_aligned(pool, data, sz, sz);
+}
+
+mali_ptr
+panfrost_pool_upload_aligned(struct pan_pool *pool, const void *data, size_t sz, unsigned alignment)
+{
+ struct panfrost_transfer transfer = panfrost_pool_alloc_aligned(pool, sz, alignment);
memcpy(transfer.cpu, data, sz);
return transfer.gpu;
}
static inline struct panfrost_transfer
panfrost_pool_alloc(struct pan_pool *pool, size_t sz)
{
- return panfrost_pool_alloc_aligned(pool, sz, util_next_power_of_two(sz));
+ assert(sz == util_next_power_of_two(sz));
+ return panfrost_pool_alloc_aligned(pool, sz, sz);
}
struct panfrost_transfer
mali_ptr
panfrost_pool_upload(struct pan_pool *pool, const void *data, size_t sz);
+mali_ptr
+panfrost_pool_upload_aligned(struct pan_pool *pool, const void *data, size_t sz, unsigned alignment);
+
#endif
.value_descriptor = MALI_WRITE_VALUE_ZERO,
};
- struct panfrost_transfer transfer = panfrost_pool_alloc(pool, sizeof(job) + sizeof(payload));
+ struct panfrost_transfer transfer = panfrost_pool_alloc_aligned(pool, sizeof(job) + sizeof(payload), 64);
memcpy(transfer.cpu, &job, sizeof(job));
memcpy(transfer.cpu + sizeof(job), &payload, sizeof(payload));