Module: Mesa
Branch: master
Commit: 04e6977e5d4b17951d3ed81cf872a0243f582e82
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=04e6977e5d4b17951d3ed81cf872a0243f582e82

Author: Marek Olšák <[email protected]>
Date:   Thu Mar  2 01:06:19 2017 +0100

gallium/radeon: reference pipe_resource in pipe_transfer

for threaded gallium

Reviewed-by: Timothy Arceri <[email protected]>

---

 src/gallium/drivers/radeon/r600_buffer_common.c | 4 +++-
 src/gallium/drivers/radeon/r600_texture.c       | 3 ++-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/radeon/r600_buffer_common.c 
b/src/gallium/drivers/radeon/r600_buffer_common.c
index cc9d3bea1f..5fde0d6c14 100644
--- a/src/gallium/drivers/radeon/r600_buffer_common.c
+++ b/src/gallium/drivers/radeon/r600_buffer_common.c
@@ -288,7 +288,8 @@ static void *r600_buffer_get_transfer(struct pipe_context 
*ctx,
        struct r600_common_context *rctx = (struct r600_common_context*)ctx;
        struct r600_transfer *transfer = slab_alloc(&rctx->pool_transfers);
 
-       transfer->transfer.resource = resource;
+       transfer->transfer.resource = NULL;
+       pipe_resource_reference(&transfer->transfer.resource, resource);
        transfer->transfer.level = 0;
        transfer->transfer.usage = usage;
        transfer->transfer.box = *box;
@@ -475,6 +476,7 @@ static void r600_buffer_transfer_unmap(struct pipe_context 
*ctx,
        if (rtransfer->staging)
                r600_resource_reference(&rtransfer->staging, NULL);
 
+       pipe_resource_reference(&transfer->resource, NULL);
        slab_free(&rctx->pool_transfers, transfer);
 }
 
diff --git a/src/gallium/drivers/radeon/r600_texture.c 
b/src/gallium/drivers/radeon/r600_texture.c
index 7ca112c636..ec7a325d1e 100644
--- a/src/gallium/drivers/radeon/r600_texture.c
+++ b/src/gallium/drivers/radeon/r600_texture.c
@@ -1490,7 +1490,7 @@ static void *r600_texture_transfer_map(struct 
pipe_context *ctx,
        trans = CALLOC_STRUCT(r600_transfer);
        if (!trans)
                return NULL;
-       trans->transfer.resource = texture;
+       pipe_resource_reference(&trans->transfer.resource, texture);
        trans->transfer.level = level;
        trans->transfer.usage = usage;
        trans->transfer.box = *box;
@@ -1643,6 +1643,7 @@ static void r600_texture_transfer_unmap(struct 
pipe_context *ctx,
                rctx->num_alloc_tex_transfer_bytes = 0;
        }
 
+       pipe_resource_reference(&transfer->resource, NULL);
        FREE(transfer);
 }
 

_______________________________________________
mesa-commit mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to