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 <michael.blumenkrantz@gmail.com>
Reviewed-by: Rob Clark <robdclark@chromium.org>
Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15298>
This commit is contained in:
Pierre-Eric Pelloux-Prayer 2022-03-08 11:44:26 +01:00 committed by Marge Bot
parent caeec6262d
commit 3c3a8f853d
2 changed files with 2 additions and 18 deletions

View file

@ -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,

View file

@ -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