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:
Rob Clark
2022-03-18 14:34:21 -07:00
committed by Marge Bot
parent ea339137b0
commit 2200d674e4
2 changed files with 8 additions and 7 deletions

View File

@@ -139,12 +139,12 @@ fd_device_purge(struct fd_device *dev)
static void
fd_device_del_impl(struct fd_device *dev)
{
int close_fd = dev->closefd ? dev->fd : -1;
simple_mtx_assert_locked(&table_lock);
assert(list_is_empty(&dev->deferred_submits));
dev->funcs->destroy(dev);
if (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);
_mesa_hash_table_destroy(dev->handle_table, NULL);
_mesa_hash_table_destroy(dev->name_table, NULL);
if (util_queue_is_initialized(&dev->submit_queue))
util_queue_destroy(&dev->submit_queue);
dev->funcs->destroy(dev);
if (close_fd >= 0)
close(close_fd);
if (dev->closefd)
close(dev->fd);
free(dev);
}
void

View File

@@ -33,8 +33,6 @@
static void
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 = {