Mesa (staging/21.3): crocus: cleanup bo exports for external objects

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Dec 17 19:44:18 UTC 2021


Module: Mesa
Branch: staging/21.3
Commit: 2d1226a01c9a0c385957ea66816207dcf30cc769
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=2d1226a01c9a0c385957ea66816207dcf30cc769

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>
(cherry picked from commit 76da4569544f8b08de0d3044b7e4bc74a6a1df45)

---

 .pick_status.json                          |  2 +-
 src/gallium/drivers/crocus/crocus_bufmgr.c | 10 ++++++++++
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/.pick_status.json b/.pick_status.json
index 8fb3a6965c5..c9d656f5555 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -1651,7 +1651,7 @@
         "description": "crocus: cleanup bo exports for external objects",
         "nominated": true,
         "nomination_type": 1,
-        "resolution": 0,
+        "resolution": 1,
         "main_sha": null,
         "because_sha": "f3630548f1da904ec6c63b43ece7e68afdb8867e"
     },
diff --git a/src/gallium/drivers/crocus/crocus_bufmgr.c b/src/gallium/drivers/crocus/crocus_bufmgr.c
index 9afdb308775..53b0504ba4d 100644
--- a/src/gallium/drivers/crocus/crocus_bufmgr.c
+++ b/src/gallium/drivers/crocus/crocus_bufmgr.c
@@ -610,6 +610,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