Mesa (main): crocus: cleanup bo exports for external objects

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Dec 13 01:07:22 UTC 2021


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

Author: Dave Airlie <airlied at redhat.com>
Date:   Mon Dec 13 10:21:47 2021 +1000

crocus: cleanup bo exports for external objects

This might have led to a leak in firefox/webrender/webgl scenarios

Reviewed-by: Jason Ekstrand <jason at jlekstrand.net>
Fixes: f3630548f1da ("crocus: initial gallium driver for Intel gfx 4-7")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14167>

---

 src/gallium/drivers/crocus/crocus_bufmgr.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/src/gallium/drivers/crocus/crocus_bufmgr.c b/src/gallium/drivers/crocus/crocus_bufmgr.c
index ff0ef11600f..aa70271ffee 100644
--- a/src/gallium/drivers/crocus/crocus_bufmgr.c
+++ b/src/gallium/drivers/crocus/crocus_bufmgr.c
@@ -609,6 +609,16 @@ bo_close(struct crocus_bo *bo)
 
       entry = _mesa_hash_table_search(bufmgr->handle_table, &bo->gem_handle);
       _mesa_hash_table_remove(bufmgr->handle_table, entry);
+
+      list_for_each_entry_safe(struct bo_export, export, &bo->exports, link) {
+         struct drm_gem_close close = { .handle = export->gem_handle };
+         intel_ioctl(export->drm_fd, DRM_IOCTL_GEM_CLOSE, &close);
+
+         list_del(&export->link);
+         free(export);
+      }
+   } else {
+      assert(list_is_empty(&bo->exports));
    }
 
    /* Close this object */



More information about the mesa-commit mailing list