freedreno/drm: Move bo common init

We'll need this to happen before virtio_bo_new() returns in the next
patch.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16086>
This commit is contained in:
Rob Clark 2022-03-27 16:22:29 -07:00 committed by Marge Bot
parent d52455a962
commit 122cedf98c
4 changed files with 8 additions and 6 deletions

View File

@ -57,8 +57,8 @@ lookup_bo(struct hash_table *tbl, uint32_t key)
return bo;
}
static void
bo_init_common(struct fd_bo *bo, struct fd_device *dev)
void
fd_bo_init_common(struct fd_bo *bo, struct fd_device *dev)
{
/* Backend should have initialized these: */
assert(bo->size);
@ -89,8 +89,6 @@ bo_from_handle(struct fd_device *dev, uint32_t size, uint32_t handle)
return NULL;
}
bo_init_common(bo, dev);
/* add ourself into the handle table: */
_mesa_hash_table_insert(dev->handle_table, &bo->handle, bo);
@ -115,8 +113,6 @@ bo_new(struct fd_device *dev, uint32_t size, uint32_t flags,
if (!bo)
return NULL;
bo_init_common(bo, dev);
simple_mtx_lock(&table_lock);
/* add ourself into the handle table: */
_mesa_hash_table_insert(dev->handle_table, &bo->handle, bo);

View File

@ -380,6 +380,8 @@ enum fd_bo_state {
};
enum fd_bo_state fd_bo_state(struct fd_bo *bo);
void fd_bo_init_common(struct fd_bo *bo, struct fd_device *dev);
struct fd_bo *fd_bo_new_ring(struct fd_device *dev, uint32_t size);
#define enable_debug 0 /* TODO make dynamic */

View File

@ -222,5 +222,7 @@ msm_bo_from_handle(struct fd_device *dev, uint32_t size, uint32_t handle)
bo->handle = handle;
bo->funcs = &funcs;
fd_bo_init_common(bo, dev);
return bo;
}

View File

@ -230,6 +230,8 @@ bo_from_handle(struct fd_device *dev, uint32_t size, uint32_t handle)
bo->funcs = &funcs;
bo->handle = handle;
fd_bo_init_common(bo, dev);
return bo;
}