Mesa (staging/22.0): iris: Don't leak scratch BOs

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Apr 14 11:50:34 UTC 2022


Module: Mesa
Branch: staging/22.0
Commit: b4240c6a2a2a6c0e7ebe381d605edd19b49e16e7
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=b4240c6a2a2a6c0e7ebe381d605edd19b49e16e7

Author: Jason Ekstrand <jason.ekstrand at collabora.com>
Date:   Tue Apr 12 11:45:41 2022 -0500

iris: Don't leak scratch BOs

Fixes: 4d219b0eb3d6 ("iris: implement scratch space!")
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15897>
(cherry picked from commit 6ca328988f8bb56c8085ebb92dad6439bdced623)

---

 .pick_status.json                       | 2 +-
 src/gallium/drivers/iris/iris_context.c | 5 +++++
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/.pick_status.json b/.pick_status.json
index be432421407..858a0dc5f64 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -84,7 +84,7 @@
         "description": "iris: Don't leak scratch BOs",
         "nominated": true,
         "nomination_type": 1,
-        "resolution": 0,
+        "resolution": 1,
         "because_sha": "4d219b0eb3d626abf094a53655843664974c7516"
     },
     {
diff --git a/src/gallium/drivers/iris/iris_context.c b/src/gallium/drivers/iris/iris_context.c
index b91f6f8ef8b..d106c34b848 100644
--- a/src/gallium/drivers/iris/iris_context.c
+++ b/src/gallium/drivers/iris/iris_context.c
@@ -232,6 +232,11 @@ iris_destroy_context(struct pipe_context *ctx)
    for (unsigned i = 0; i < ARRAY_SIZE(ice->shaders.scratch_surfs); i++)
       pipe_resource_reference(&ice->shaders.scratch_surfs[i].res, NULL);
 
+   for (unsigned i = 0; i < ARRAY_SIZE(ice->shaders.scratch_bos); i++) {
+      for (unsigned j = 0; j < ARRAY_SIZE(ice->shaders.scratch_bos[i]); j++)
+         iris_bo_unreference(ice->shaders.scratch_bos[i][j]);
+   }
+
    iris_destroy_program_cache(ice);
    iris_destroy_border_color_pool(ice);
    if (screen->measure.config)



More information about the mesa-commit mailing list