zink: check for cached mem correctly when mapping buffer

bo placement is the mem index, not the mem flags

Fixes: 52f27cda05 ("zink: allow direct memory mapping for any COHERENT+CACHED buffer")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23511>
(cherry picked from commit 81834a211d)
This commit is contained in:
Mike Blumenkrantz 2023-06-07 08:48:19 -04:00 committed by Eric Engestrom
parent 64b70bd6d0
commit 9ccac714a8
2 changed files with 2 additions and 2 deletions

View file

@ -3370,7 +3370,7 @@
"description": "zink: check for cached mem correctly when mapping buffer",
"nominated": true,
"nomination_type": 1,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": "52f27cda05b9ff2eb93cbaf1cfae15198ed5a3d6"
},

View file

@ -1930,7 +1930,7 @@ zink_buffer_map(struct pipe_context *pctx,
usage |= PIPE_MAP_UNSYNCHRONIZED;
} else if (!(usage & PIPE_MAP_UNSYNCHRONIZED) &&
(((usage & PIPE_MAP_READ) && !(usage & PIPE_MAP_PERSISTENT) &&
((res->obj->bo->base.placement & VK_STAGING_RAM) != VK_STAGING_RAM)) ||
((screen->info.mem_props.memoryTypes[res->obj->bo->base.placement].propertyFlags & VK_STAGING_RAM) != VK_STAGING_RAM)) ||
!res->obj->host_visible)) {
/* the above conditional catches uncached reads and non-HV writes */
assert(!(usage & (TC_TRANSFER_MAP_THREADED_UNSYNC)));