summaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary/util
diff options
context:
space:
mode:
authorNicolai Hähnle <[email protected]>2017-10-10 13:58:46 +0200
committerNicolai Hähnle <[email protected]>2017-10-10 13:58:46 +0200
commit1b592d30c51696eeeadca7a55b603c543dfdc3cf (patch)
treec47d8f8a6d8bef20e6458e0d499e8a6edf548e69 /src/gallium/auxiliary/util
parent76fcede3f44d5f6eaf9b99ef80914c326387a3e5 (diff)
u_threaded_context: fix a memory leak
The uploaders can own transfers which need to be unmapped. Destroy them before the final sync (they're not used from the driver thread anyway) so that the transfer_unmap call is processed by the driver. Reviewed-by: Marek Olšák <[email protected]>
Diffstat (limited to 'src/gallium/auxiliary/util')
-rw-r--r--src/gallium/auxiliary/util/u_threaded_context.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/gallium/auxiliary/util/u_threaded_context.c b/src/gallium/auxiliary/util/u_threaded_context.c
index 043d4e67df1..7e28b87a7ff 100644
--- a/src/gallium/auxiliary/util/u_threaded_context.c
+++ b/src/gallium/auxiliary/util/u_threaded_context.c
@@ -2233,6 +2233,13 @@ tc_destroy(struct pipe_context *_pipe)
struct threaded_context *tc = threaded_context(_pipe);
struct pipe_context *pipe = tc->pipe;
+ if (tc->base.const_uploader &&
+ tc->base.stream_uploader != tc->base.const_uploader)
+ u_upload_destroy(tc->base.const_uploader);
+
+ if (tc->base.stream_uploader)
+ u_upload_destroy(tc->base.stream_uploader);
+
tc_sync(tc);
if (util_queue_is_initialized(&tc->queue)) {
@@ -2242,14 +2249,8 @@ tc_destroy(struct pipe_context *_pipe)
util_queue_fence_destroy(&tc->batch_slots[i].fence);
}
- if (tc->base.const_uploader &&
- tc->base.stream_uploader != tc->base.const_uploader)
- u_upload_destroy(tc->base.const_uploader);
-
- if (tc->base.stream_uploader)
- u_upload_destroy(tc->base.stream_uploader);
-
slab_destroy_child(&tc->pool_transfers);
+ assert(tc->batch_slots[tc->next].num_total_call_slots == 0);
pipe->destroy(pipe);
os_free_aligned(tc);
}