Mesa (staging/20.1): mesa/st: Actually free the driver part of memory objects on destruction.

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Aug 3 18:32:10 UTC 2020


Module: Mesa
Branch: staging/20.1
Commit: 9b2eed8b054b7a0fdb6befc82ef5246ea61c93e3
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=9b2eed8b054b7a0fdb6befc82ef5246ea61c93e3

Author: Bas Nieuwenhuizen <bas at basnieuwenhuizen.nl>
Date:   Sat Aug  1 03:13:55 2020 +0200

mesa/st: Actually free the driver part of memory objects on destruction.

_mesa_delete_memory_object(ctx, obj) == free(obj) but doesn't free the
part of the gallium driver.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/1206
Fixes: 49f4ecc6777 "mesa/st: start adding memory object support"
Reviewed-by: Timothy Arceri <tarceri at itsqueeze.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6148>
(cherry picked from commit 99cf9108340c2ccf7c1b05ec6f951e2e91b9c76c)

---

 .pick_status.json                            | 2 +-
 src/mesa/state_tracker/st_cb_memoryobjects.c | 6 ++++++
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/.pick_status.json b/.pick_status.json
index 48b0aadc9e5..40aac16ca65 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -121,7 +121,7 @@
         "description": "mesa/st: Actually free the driver part of memory objects on destruction.",
         "nominated": true,
         "nomination_type": 1,
-        "resolution": 0,
+        "resolution": 1,
         "master_sha": null,
         "because_sha": "49f4ecc67773c082d93708bdf111acc4248678da"
     },
diff --git a/src/mesa/state_tracker/st_cb_memoryobjects.c b/src/mesa/state_tracker/st_cb_memoryobjects.c
index d81c7692c1f..f695e9b10a0 100644
--- a/src/mesa/state_tracker/st_cb_memoryobjects.c
+++ b/src/mesa/state_tracker/st_cb_memoryobjects.c
@@ -54,6 +54,12 @@ static void
 st_memoryobj_free(struct gl_context *ctx,
                   struct gl_memory_object *obj)
 {
+   struct st_memory_object *st_obj = st_memory_object(obj);
+   struct st_context *st = st_context(ctx);
+   struct pipe_context *pipe = st->pipe;
+   struct pipe_screen *screen = pipe->screen;
+
+   screen->memobj_destroy(screen, st_obj->memory);
    _mesa_delete_memory_object(ctx, obj);
 }
 



More information about the mesa-commit mailing list