From 7932c7a0900473e5e756e99a44b02d531bb15547 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Thu, 14 Sep 2023 11:41:42 -0400 Subject: [PATCH] aux/tc: don't use pipe_buffer_create_with_data() for rp-optimized subdata MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit this function doesn't use the correct tc map flags, which causes drivers to (potentially) use the wrong slab for transfer allocation and then crash Fixes: 51ad269198e ("aux/tc: handle stride mismatch during rp-optimized subdata") Acked-by: Marek Olšák Reviewed-by: Dave Airlie Part-of: (cherry picked from commit a5be0385c7c7f3eb380c4677b17b012ab9640ce0) --- .pick_status.json | 2 +- src/gallium/auxiliary/util/u_threaded_context.c | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index 461d46d5684..df6164fa926 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -2224,7 +2224,7 @@ "description": "aux/tc: don't use pipe_buffer_create_with_data() for rp-optimized subdata", "nominated": true, "nomination_type": 1, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": "51ad269198e425fae719a37f169b365a8b52e7f3", "notes": null diff --git a/src/gallium/auxiliary/util/u_threaded_context.c b/src/gallium/auxiliary/util/u_threaded_context.c index a396324396d..221e2d2ad9c 100644 --- a/src/gallium/auxiliary/util/u_threaded_context.c +++ b/src/gallium/auxiliary/util/u_threaded_context.c @@ -3170,7 +3170,8 @@ tc_texture_subdata(struct pipe_context *_pipe, uint64_t fmt_layer_stride = util_format_get_2d_size(format, stride, box->height); assert(fmt_layer_stride * box->depth <= UINT32_MAX); - struct pipe_resource *pres = pipe_buffer_create_with_data(pipe, 0, PIPE_USAGE_STREAM, layer_stride * box->depth, data); + struct pipe_resource *pres = pipe_buffer_create(pipe->screen, 0, PIPE_USAGE_STREAM, layer_stride * box->depth); + pipe->buffer_subdata(pipe, pres, PIPE_MAP_WRITE | TC_TRANSFER_MAP_THREADED_UNSYNC, 0, layer_stride * box->depth, data); struct pipe_box src_box = *box; src_box.x = src_box.y = src_box.z = 0;