Module: Mesa
Branch: main
Commit: 4b559f791c5bbfa4eb265235cc452f3d852b7731
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=4b559f791c5bbfa4eb265235cc452f3d852b7731

Author: Pierre-Eric Pelloux-Prayer <[email protected]>
Date:   Tue Mar  8 11:47:50 2022 +0100

radeonsi: replace opencoded slab_zalloc

Reviewed-by: Marek Olšák <[email protected]>
Acked-by: Emma Anholt <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15277>

---

 src/gallium/drivers/radeonsi/si_buffer.c | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/src/gallium/drivers/radeonsi/si_buffer.c 
b/src/gallium/drivers/radeonsi/si_buffer.c
index fbbee4e13dd..f91e6ff367c 100644
--- a/src/gallium/drivers/radeonsi/si_buffer.c
+++ b/src/gallium/drivers/radeonsi/si_buffer.c
@@ -317,21 +317,16 @@ static void *si_buffer_get_transfer(struct pipe_context 
*ctx, struct pipe_resour
    struct si_transfer *transfer;
 
    if (usage & PIPE_MAP_THREAD_SAFE)
-      transfer = malloc(sizeof(*transfer));
+      transfer = calloc(1, sizeof(*transfer));
    else if (usage & TC_TRANSFER_MAP_THREADED_UNSYNC)
-      transfer = slab_alloc(&sctx->pool_transfers_unsync);
+      transfer = slab_zalloc(&sctx->pool_transfers_unsync);
    else
-      transfer = slab_alloc(&sctx->pool_transfers);
+      transfer = slab_zalloc(&sctx->pool_transfers);
 
-   transfer->b.b.resource = NULL;
    pipe_resource_reference(&transfer->b.b.resource, resource);
-   transfer->b.b.level = 0;
    transfer->b.b.usage = usage;
    transfer->b.b.box = *box;
-   transfer->b.b.stride = 0;
-   transfer->b.b.layer_stride = 0;
    transfer->b.b.offset = offset;
-   transfer->b.staging = NULL;
    transfer->staging = staging;
    *ptransfer = &transfer->b.b;
    return data;

Reply via email to