From 3c3a8f853dd8b43bfd51794f2a7d632feda396c4 Mon Sep 17 00:00:00 2001 From: Pierre-Eric Pelloux-Prayer Date: Tue, 8 Mar 2022 11:44:26 +0100 Subject: [PATCH] gallium/tc: zero alloc transfers Otherwise this causes trouble with unitialized memory, eg with: struct si_transfer { struct threaded_transfer b; struct si_resource *staging; }; 'staging' will not be initialized and this causes #6109. Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/6109 Cc: mesa-stable Acked-By: Mike Blumenkrantz Reviewed-by: Rob Clark Reviewed-by: Christian Gmeiner Part-of: --- src/gallium/auxiliary/util/u_threaded_context.c | 11 ++--------- .../drivers/radeonsi/ci/radeonsi-stoney-flakes.txt | 9 --------- 2 files changed, 2 insertions(+), 18 deletions(-) delete mode 100644 src/gallium/drivers/radeonsi/ci/radeonsi-stoney-flakes.txt diff --git a/src/gallium/auxiliary/util/u_threaded_context.c b/src/gallium/auxiliary/util/u_threaded_context.c index 87f75416f05..daab30f9fa8 100644 --- a/src/gallium/auxiliary/util/u_threaded_context.c +++ b/src/gallium/auxiliary/util/u_threaded_context.c @@ -2182,15 +2182,10 @@ tc_buffer_map(struct pipe_context *_pipe, tres->cpu_storage = align_malloc(resource->width0, tc->map_buffer_alignment); if (tres->cpu_storage) { - struct threaded_transfer *ttrans = slab_alloc(&tc->pool_transfers); + struct threaded_transfer *ttrans = slab_zalloc(&tc->pool_transfers); ttrans->b.resource = resource; - ttrans->b.level = 0; ttrans->b.usage = usage; ttrans->b.box = *box; - ttrans->b.stride = 0; - ttrans->b.layer_stride = 0; - ttrans->b.offset = 0; - ttrans->staging = NULL; ttrans->valid_buffer_range = &tres->valid_buffer_range; ttrans->cpu_storage_mapped = true; *transfer = &ttrans->b; @@ -2205,11 +2200,9 @@ tc_buffer_map(struct pipe_context *_pipe, * only get resource_copy_region. */ if (usage & PIPE_MAP_DISCARD_RANGE) { - struct threaded_transfer *ttrans = slab_alloc(&tc->pool_transfers); + struct threaded_transfer *ttrans = slab_zalloc(&tc->pool_transfers); uint8_t *map; - ttrans->staging = NULL; - u_upload_alloc(tc->base.stream_uploader, 0, box->width + (box->x % tc->map_buffer_alignment), tc->map_buffer_alignment, &ttrans->b.offset, diff --git a/src/gallium/drivers/radeonsi/ci/radeonsi-stoney-flakes.txt b/src/gallium/drivers/radeonsi/ci/radeonsi-stoney-flakes.txt deleted file mode 100644 index 432600bb4eb..00000000000 --- a/src/gallium/drivers/radeonsi/ci/radeonsi-stoney-flakes.txt +++ /dev/null @@ -1,9 +0,0 @@ -dEQP-GLES3.functional.buffer.map.write.explicit_flush.pixel_unpack_all -dEQP-GLES3.functional.buffer.map.write.explicit_flush.pixel_unpack_partial -dEQP-GLES3.functional.buffer.map.write.explicit_flush.transform_feedback_partial -dEQP-GLES3.functional.buffer.map.write.explicit_flush.uniform_all -dEQP-GLES3.functional.buffer.map.write.explicit_flush.transform_feedback_all - -# sometimes passes? -spec@egl_chromium_sync_control@conformance -spec@egl_chromium_sync_control@conformance@eglGetSyncValuesCHROMIUM_msc_and_sbc_test