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 <kenneth@whitecape.org>
Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13494>
This commit is contained in:
Paulo Zanoni
2021-10-07 13:48:39 -07:00
committed by Marge Bot
parent e68616e5e6
commit 3c49916d51
+3 -3
View File
@@ -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);
}