mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-20 18:10:11 +01:00
panfrost: sanity-check alignment
The page-alignment should always be a positive power of two. Let's assert that, to avoid confusion. Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com> Reviewed-by: Mary Guillemard <mary.guillemard@collabora.com> CID: 1605086 Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32380>
This commit is contained in:
parent
0d51248e5d
commit
22985caf3f
1 changed files with 3 additions and 1 deletions
|
|
@ -137,7 +137,9 @@ panfrost_pool_alloc_aligned(struct panfrost_pool *pool, size_t sz,
|
||||||
#ifdef PAN_DBG_OVERFLOW
|
#ifdef PAN_DBG_OVERFLOW
|
||||||
if (unlikely(pool->dev->debug & PAN_DBG_OVERFLOW) &&
|
if (unlikely(pool->dev->debug & PAN_DBG_OVERFLOW) &&
|
||||||
!(pool->create_flags & PAN_BO_INVISIBLE)) {
|
!(pool->create_flags & PAN_BO_INVISIBLE)) {
|
||||||
unsigned aligned = ALIGN_POT(sz, sysconf(_SC_PAGESIZE));
|
long alignment = sysconf(_SC_PAGESIZE);
|
||||||
|
assert(alignment > 0 && util_is_power_of_two_nonzero(alignment));
|
||||||
|
unsigned aligned = ALIGN_POT(sz, alignment);
|
||||||
unsigned bo_size = aligned + PAN_GUARD_SIZE;
|
unsigned bo_size = aligned + PAN_GUARD_SIZE;
|
||||||
|
|
||||||
bo = panfrost_pool_alloc_backing(pool, bo_size);
|
bo = panfrost_pool_alloc_backing(pool, bo_size);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue