Mesa (main): iris: destroy our mutexes a little later

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Oct 27 20:25:59 UTC 2021


Module: Mesa
Branch: main
Commit: 3c49916d515c62ac039644e8a0934e534f37be0b
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=3c49916d515c62ac039644e8a0934e534f37be0b

Author: Paulo Zanoni <paulo.r.zanoni at intel.com>
Date:   Thu Oct  7 13:48:39 2021 -0700

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 at whitecape.org>
Signed-off-by: Paulo Zanoni <paulo.r.zanoni at intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13494>

---

 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);
 }
 



More information about the mesa-commit mailing list