freedreno/drm: Reorder device destroy
Call backend specific cleanup fxn earlier. This is needed if the backend has things like bo's to delete, otherwise the handle_table will already be destroyed causing problems in bo_del() Signed-off-by: Rob Clark <robdclark@chromium.org> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14900>
This commit is contained in:
@@ -139,12 +139,12 @@ fd_device_purge(struct fd_device *dev)
|
|||||||
static void
|
static void
|
||||||
fd_device_del_impl(struct fd_device *dev)
|
fd_device_del_impl(struct fd_device *dev)
|
||||||
{
|
{
|
||||||
int close_fd = dev->closefd ? dev->fd : -1;
|
|
||||||
|
|
||||||
simple_mtx_assert_locked(&table_lock);
|
simple_mtx_assert_locked(&table_lock);
|
||||||
|
|
||||||
assert(list_is_empty(&dev->deferred_submits));
|
assert(list_is_empty(&dev->deferred_submits));
|
||||||
|
|
||||||
|
dev->funcs->destroy(dev);
|
||||||
|
|
||||||
if (dev->suballoc_bo)
|
if (dev->suballoc_bo)
|
||||||
fd_bo_del_locked(dev->suballoc_bo);
|
fd_bo_del_locked(dev->suballoc_bo);
|
||||||
|
|
||||||
@@ -152,11 +152,14 @@ fd_device_del_impl(struct fd_device *dev)
|
|||||||
fd_bo_cache_cleanup(&dev->ring_cache, 0);
|
fd_bo_cache_cleanup(&dev->ring_cache, 0);
|
||||||
_mesa_hash_table_destroy(dev->handle_table, NULL);
|
_mesa_hash_table_destroy(dev->handle_table, NULL);
|
||||||
_mesa_hash_table_destroy(dev->name_table, NULL);
|
_mesa_hash_table_destroy(dev->name_table, NULL);
|
||||||
|
|
||||||
if (util_queue_is_initialized(&dev->submit_queue))
|
if (util_queue_is_initialized(&dev->submit_queue))
|
||||||
util_queue_destroy(&dev->submit_queue);
|
util_queue_destroy(&dev->submit_queue);
|
||||||
dev->funcs->destroy(dev);
|
|
||||||
if (close_fd >= 0)
|
if (dev->closefd)
|
||||||
close(close_fd);
|
close(dev->fd);
|
||||||
|
|
||||||
|
free(dev);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@@ -33,8 +33,6 @@
|
|||||||
static void
|
static void
|
||||||
msm_device_destroy(struct fd_device *dev)
|
msm_device_destroy(struct fd_device *dev)
|
||||||
{
|
{
|
||||||
struct msm_device *msm_dev = to_msm_device(dev);
|
|
||||||
free(msm_dev);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct fd_device_funcs funcs = {
|
static const struct fd_device_funcs funcs = {
|
||||||
|
Reference in New Issue
Block a user