Mesa (staging/19.2): virgl: Fix pipe_resource leaks under multi-sample.

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Sep 10 16:54:20 UTC 2019


Module: Mesa
Branch: staging/19.2
Commit: 637e02c1b195b0e11f5fea6e36b1fc14c359f748
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=637e02c1b195b0e11f5fea6e36b1fc14c359f748

Author: Lepton Wu <lepton at chromium.org>
Date:   Tue Sep 10 03:42:55 2019 +0000

virgl: Fix pipe_resource leaks under multi-sample.

Fixes: 900a80f9e4f ("virgl: virgl_transfer should own its virgl_resource")

Signed-off-by: Lepton Wu <lepton at chromium.org>
Reviewed-by: Chia-I Wu <olvaffe at gmail.com>
(cherry picked from commit 263136fb5d2646bea718579de272729b2474d31a)

---

 src/gallium/drivers/virgl/virgl_texture.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/gallium/drivers/virgl/virgl_texture.c b/src/gallium/drivers/virgl/virgl_texture.c
index 570f96fb14c..1b39c6382dc 100644
--- a/src/gallium/drivers/virgl/virgl_texture.c
+++ b/src/gallium/drivers/virgl/virgl_texture.c
@@ -169,6 +169,9 @@ static void *texture_transfer_map_resolve(struct pipe_context *ctx,
    if (!ptr)
       goto fail;
 
+   /* trans->resolve_transfer owns resolve_tmp now */
+   pipe_resource_reference(&resolve_tmp, NULL);
+
    *transfer = &trans->base;
    if (fmt == resource->format) {
       trans->base.stride = trans->resolve_transfer->stride;
@@ -283,7 +286,6 @@ static void virgl_texture_transfer_unmap(struct pipe_context *ctx,
    }
 
    if (trans->resolve_transfer) {
-      pipe_resource_reference(&trans->resolve_transfer->resource, NULL);
       virgl_resource_destroy_transfer(vctx,
                                       virgl_transfer(trans->resolve_transfer));
    }




More information about the mesa-commit mailing list