From 3c49916d515c62ac039644e8a0934e534f37be0b Mon Sep 17 00:00:00 2001 From: Paulo Zanoni Date: Thu, 7 Oct 2021 13:48:39 -0700 Subject: [PATCH] iris: destroy our mutexes a little later While there seems to be no bug with the state things are today, I was recently doing some debugging and put an iris_bo_wait() before a bo_close() in iris_bufmgr_destroy(), which caused an issue since the bo_deps_lock mutex had already been destroyed. Since there are quite a few things we do with the bufmgr after destroying the mutexes, I figured we should probably postpone mutex destruction in order to be a little safer against future code modifications like the one I just did. Reviewed-by: Kenneth Graunke Signed-off-by: Paulo Zanoni Part-of: --- src/gallium/drivers/iris/iris_bufmgr.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/gallium/drivers/iris/iris_bufmgr.c b/src/gallium/drivers/iris/iris_bufmgr.c index 7a9d1a4820d..55a341cf9af 100644 --- a/src/gallium/drivers/iris/iris_bufmgr.c +++ b/src/gallium/drivers/iris/iris_bufmgr.c @@ -1650,9 +1650,6 @@ iris_bufmgr_destroy(struct iris_bufmgr *bufmgr) pb_slabs_deinit(&bufmgr->bo_slabs[i]); } - simple_mtx_destroy(&bufmgr->lock); - simple_mtx_destroy(&bufmgr->bo_deps_lock); - /* Free any cached buffer objects we were going to reuse */ for (int i = 0; i < bufmgr->num_buckets; i++) { struct bo_cache_bucket *bucket = &bufmgr->cache_bucket[i]; @@ -1680,6 +1677,9 @@ iris_bufmgr_destroy(struct iris_bufmgr *bufmgr) close(bufmgr->fd); + simple_mtx_destroy(&bufmgr->lock); + simple_mtx_destroy(&bufmgr->bo_deps_lock); + free(bufmgr); }