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:
@@ -57,8 +57,8 @@ lookup_bo(struct hash_table *tbl, uint32_t key)
|
|||||||
return bo;
|
return bo;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
void
|
||||||
bo_init_common(struct fd_bo *bo, struct fd_device *dev)
|
fd_bo_init_common(struct fd_bo *bo, struct fd_device *dev)
|
||||||
{
|
{
|
||||||
/* Backend should have initialized these: */
|
/* Backend should have initialized these: */
|
||||||
assert(bo->size);
|
assert(bo->size);
|
||||||
@@ -89,8 +89,6 @@ bo_from_handle(struct fd_device *dev, uint32_t size, uint32_t handle)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
bo_init_common(bo, dev);
|
|
||||||
|
|
||||||
/* add ourself into the handle table: */
|
/* add ourself into the handle table: */
|
||||||
_mesa_hash_table_insert(dev->handle_table, &bo->handle, bo);
|
_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)
|
if (!bo)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
bo_init_common(bo, dev);
|
|
||||||
|
|
||||||
simple_mtx_lock(&table_lock);
|
simple_mtx_lock(&table_lock);
|
||||||
/* add ourself into the handle table: */
|
/* add ourself into the handle table: */
|
||||||
_mesa_hash_table_insert(dev->handle_table, &bo->handle, bo);
|
_mesa_hash_table_insert(dev->handle_table, &bo->handle, bo);
|
||||||
|
@@ -380,6 +380,8 @@ enum fd_bo_state {
|
|||||||
};
|
};
|
||||||
enum fd_bo_state fd_bo_state(struct fd_bo *bo);
|
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);
|
struct fd_bo *fd_bo_new_ring(struct fd_device *dev, uint32_t size);
|
||||||
|
|
||||||
#define enable_debug 0 /* TODO make dynamic */
|
#define enable_debug 0 /* TODO make dynamic */
|
||||||
|
@@ -222,5 +222,7 @@ msm_bo_from_handle(struct fd_device *dev, uint32_t size, uint32_t handle)
|
|||||||
bo->handle = handle;
|
bo->handle = handle;
|
||||||
bo->funcs = &funcs;
|
bo->funcs = &funcs;
|
||||||
|
|
||||||
|
fd_bo_init_common(bo, dev);
|
||||||
|
|
||||||
return bo;
|
return bo;
|
||||||
}
|
}
|
||||||
|
@@ -230,6 +230,8 @@ bo_from_handle(struct fd_device *dev, uint32_t size, uint32_t handle)
|
|||||||
bo->funcs = &funcs;
|
bo->funcs = &funcs;
|
||||||
bo->handle = handle;
|
bo->handle = handle;
|
||||||
|
|
||||||
|
fd_bo_init_common(bo, dev);
|
||||||
|
|
||||||
return bo;
|
return bo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user