Mesa (staging/22.0): lavapipe: fix sampler + sampler view leaks.

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Feb 9 18:32:57 UTC 2022


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

Author: Dave Airlie <airlied at redhat.com>
Date:   Tue Feb  8 18:24:12 2022 +1000

lavapipe: fix sampler + sampler view leaks.

The compute sampler views are using a different method
of generation so have to be deleted explicitly.

Fixes: e94fd4cc6589 ("lavapipe: rename vallium to lavapipe")

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14939>
(cherry picked from commit 2f9089f6de8ca29a529ef7828efbabeec58be6e8)

---

 .pick_status.json                            |  2 +-
 src/gallium/frontends/lavapipe/lvp_execute.c | 12 ++++++++++++
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/.pick_status.json b/.pick_status.json
index cc6aba6685d..14df5d67c65 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -283,7 +283,7 @@
         "description": "lavapipe: fix sampler + sampler view leaks.",
         "nominated": true,
         "nomination_type": 1,
-        "resolution": 0,
+        "resolution": 1,
         "main_sha": null,
         "because_sha": "e94fd4cc65899bccceb4642363bc4376c6831580"
     },
diff --git a/src/gallium/frontends/lavapipe/lvp_execute.c b/src/gallium/frontends/lavapipe/lvp_execute.c
index d47f3ad4ba4..228aeb72662 100644
--- a/src/gallium/frontends/lavapipe/lvp_execute.c
+++ b/src/gallium/frontends/lavapipe/lvp_execute.c
@@ -4116,6 +4116,18 @@ VkResult lvp_execute_cmds(struct lvp_device *device,
       }
    }
 
+   for (enum pipe_shader_type s = PIPE_SHADER_VERTEX; s < PIPE_SHADER_TYPES; s++) {
+      for (unsigned i = 0; i < PIPE_MAX_SAMPLERS; i++) {
+         if (state.sv[s][i])
+            pipe_sampler_view_reference(&state.sv[s][i], NULL);
+      }
+   }
+
+   for (unsigned i = 0; i < PIPE_MAX_SAMPLERS; i++) {
+      if (state.cso_ss_ptr[PIPE_SHADER_COMPUTE][i])
+         state.pctx->delete_sampler_state(state.pctx, state.ss_cso[PIPE_SHADER_COMPUTE][i]);
+   }
+
    free(state.imageless_views);
    free(state.pending_clear_aspects);
    free(state.cleared_views);



More information about the mesa-commit mailing list