From c0b1a23e35a2dcc7a6942ec22bb1999cd4ad8b9d Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Tue, 25 Mar 2025 11:26:45 -0400 Subject: [PATCH] zink: block streaming cached uploads on unsynchronized/persistent maps this is broken Fixes: e63acdd2b7b ("zink: force cached mem for streaming uploads") Part-of: --- src/gallium/drivers/zink/zink_resource.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/gallium/drivers/zink/zink_resource.c b/src/gallium/drivers/zink/zink_resource.c index f1d6076045c..be0984254a9 100644 --- a/src/gallium/drivers/zink/zink_resource.c +++ b/src/gallium/drivers/zink/zink_resource.c @@ -2345,7 +2345,8 @@ zink_buffer_map(struct pipe_context *pctx, /* but this is only viable with a certain amount of vram since it may fully duplicate lots of large buffers */ bool host_mem_type_check = screen->always_cached_upload ? is_cached_mem : res->obj->host_visible; if (usage & PIPE_MAP_DISCARD_RANGE && - (!host_mem_type_check || !(usage & (PIPE_MAP_UNSYNCHRONIZED | PIPE_MAP_PERSISTENT)))) { + ((!res->obj->host_visible || !(usage & (PIPE_MAP_UNSYNCHRONIZED | PIPE_MAP_PERSISTENT))) || + (!host_mem_type_check && !(usage & (PIPE_MAP_UNSYNCHRONIZED | PIPE_MAP_PERSISTENT))))) { /* Check if mapping this buffer would cause waiting for the GPU. */