Mesa (master): virgl: also destroy all read-transfers
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Wed Apr 3 17:10:23 UTC 2019
Module: Mesa
Branch: master
Commit: b85ca86c1eb2cd095351196cd3a3eb7c1ff4184a
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=b85ca86c1eb2cd095351196cd3a3eb7c1ff4184a
Author: Erik Faye-Lund <erik.faye-lund at collabora.com>
Date: Tue Apr 2 10:48:30 2019 +0200
virgl: also destroy all read-transfers
For texture write-transfers, we either free them on the transfer-queue
or right away. But for read-transfers, we currently only destroy them in
case they used a temp-resource. This leads to occasional resource-leaks.
Let's add a call to virgl_resource_destroy_transfer in the missing case.
Do the same thing for buffers as well, but the logic is a bit easier to
follow there.
Signed-off-by: Erik Faye-Lund <erik.faye-lund at collabora.com>
Fixes: f0e71b10888 ("virgl: use transfer queue")
Reviewed-by: Gurchetan Singh <gurchetansingh at chromium.org>
---
src/gallium/drivers/virgl/virgl_buffer.c | 3 ++-
src/gallium/drivers/virgl/virgl_texture.c | 3 ++-
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/gallium/drivers/virgl/virgl_buffer.c b/src/gallium/drivers/virgl/virgl_buffer.c
index 3baccc010be..784cc02a545 100644
--- a/src/gallium/drivers/virgl/virgl_buffer.c
+++ b/src/gallium/drivers/virgl/virgl_buffer.c
@@ -90,7 +90,8 @@ static void virgl_buffer_transfer_unmap(struct pipe_context *ctx,
vctx->num_transfers++;
virgl_transfer_queue_unmap(&vctx->queue, trans);
- }
+ } else
+ virgl_resource_destroy_transfer(&vctx->transfer_pool, trans);
}
static void virgl_buffer_transfer_flush_region(struct pipe_context *ctx,
diff --git a/src/gallium/drivers/virgl/virgl_texture.c b/src/gallium/drivers/virgl/virgl_texture.c
index 231319899e0..1832309aa49 100644
--- a/src/gallium/drivers/virgl/virgl_texture.c
+++ b/src/gallium/drivers/virgl/virgl_texture.c
@@ -181,7 +181,8 @@ static void virgl_texture_transfer_unmap(struct pipe_context *ctx,
if (trans->resolve_tmp) {
pipe_resource_reference((struct pipe_resource **)&trans->resolve_tmp, NULL);
virgl_resource_destroy_transfer(&vctx->transfer_pool, trans);
- }
+ } else if (!(trans->base.usage & PIPE_TRANSFER_WRITE))
+ virgl_resource_destroy_transfer(&vctx->transfer_pool, trans);
}
static const struct u_resource_vtbl virgl_texture_vtbl =
More information about the mesa-commit
mailing list