From edca30efbfdadd357800c55f57c42cc5c0f044f8 Mon Sep 17 00:00:00 2001 From: Rob Clark Date: Sat, 12 Nov 2022 15:34:08 -0800 Subject: [PATCH] freedreno/drm: Fix suballoc alignment IBO/etc descriptors need to be aligned to 64.. this was handled correctly in the stateobj case (for tex descriptors) but not in the streaming case (for IBO). Signed-off-by: Rob Clark Part-of: --- src/freedreno/drm/freedreno_priv.h | 2 ++ src/freedreno/drm/freedreno_ringbuffer_sp.c | 5 ++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/freedreno/drm/freedreno_priv.h b/src/freedreno/drm/freedreno_priv.h index 827ed1c3d27..8a5b292a5f4 100644 --- a/src/freedreno/drm/freedreno_priv.h +++ b/src/freedreno/drm/freedreno_priv.h @@ -54,6 +54,8 @@ extern simple_mtx_t table_lock; #define SUBALLOC_SIZE (32 * 1024) +/* Maximum known alignment requirement is a6xx's TEX_CONST at 16 dwords */ +#define SUBALLOC_ALIGNMENT 64 #define RING_FLAGS (FD_BO_GPUREADONLY | FD_BO_CACHED_COHERENT | _FD_BO_RING) /* diff --git a/src/freedreno/drm/freedreno_ringbuffer_sp.c b/src/freedreno/drm/freedreno_ringbuffer_sp.c index 35fb6999cfc..c83a8bacb4a 100644 --- a/src/freedreno/drm/freedreno_ringbuffer_sp.c +++ b/src/freedreno/drm/freedreno_ringbuffer_sp.c @@ -99,7 +99,7 @@ fd_submit_suballoc_ring_bo(struct fd_submit *submit, suballoc_offset = fd_ringbuffer_size(fd_submit->suballoc_ring) + suballoc_ring->offset; - suballoc_offset = align(suballoc_offset, 0x10); + suballoc_offset = align(suballoc_offset, SUBALLOC_ALIGNMENT); if ((size + suballoc_offset) > suballoc_bo->size) { suballoc_bo = NULL; @@ -657,8 +657,7 @@ fd_ringbuffer_sp_new_object(struct fd_pipe *pipe, uint32_t size) */ simple_mtx_lock(&dev->suballoc_lock); - /* Maximum known alignment requirement is a6xx's TEX_CONST at 16 dwords */ - fd_ring->offset = align(dev->suballoc_offset, 64); + fd_ring->offset = align(dev->suballoc_offset, SUBALLOC_ALIGNMENT); if (!dev->suballoc_bo || fd_ring->offset + size > fd_bo_size(dev->suballoc_bo)) { if (dev->suballoc_bo)