freedreno/drm: Shuffle around BO init

Suballocated heap BOs will bypass the rest of bo_new() (as they skip the
BO cache, don't get an entry in the handle table, etc).  So move more of
the initialization into fd_bo_init_common().

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20263>
This commit is contained in:
Rob Clark 2022-12-10 09:33:51 -08:00 committed by Marge Bot
parent db0f273cfb
commit 84f44137ff

View file

@ -68,6 +68,7 @@ fd_bo_init_common(struct fd_bo *bo, struct fd_device *dev)
/* Backend should have initialized these: */
assert(bo->size);
assert(bo->handle);
assert(bo->funcs);
bo->dev = dev;
bo->iova = bo->funcs->iova(bo);
@ -75,6 +76,11 @@ fd_bo_init_common(struct fd_bo *bo, struct fd_device *dev)
p_atomic_set(&bo->refcnt, 1);
list_inithead(&bo->node);
bo->max_fences = 1;
bo->fences = &bo->_inline_fence;
VG_BO_ALLOC(bo);
}
/* allocate a new buffer object, call w/ table_lock held */
@ -124,10 +130,6 @@ bo_new(struct fd_device *dev, uint32_t size, uint32_t flags,
simple_mtx_unlock(&table_lock);
bo->alloc_flags = flags;
bo->max_fences = 1;
bo->fences = &bo->_inline_fence;
VG_BO_ALLOC(bo);
return bo;
}