zink: fix uncached memory readback

the inner conditional here didn't include uncached readback, meaning
that many (most?) buffers allocated with uncached memory (i.e., BAR) were
being read back directly instead of using staging resources to be faster

at some point this inner conditional should be reevaluated to determine
whether it still does anything, but this is not that time

fixes, among other things, loading in DOOM2016 on some GPUs

Fixes: 52f27cda05 ("zink: allow direct memory mapping for any COHERENT+CACHED buffer")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22907>
This commit is contained in:
Mike Blumenkrantz 2023-05-08 15:06:55 -04:00 committed by Marge Bot
parent 6452849b11
commit 24350064ca
2 changed files with 3 additions and 8 deletions

View file

@ -206,13 +206,6 @@ spec@arb_gpu_shader_fp64@uniform_buffers@fs-ubo-load.indirect.3,Fail
spec@arb_program_interface_query@arb_program_interface_query-getprogramresourceindex,Fail
spec@arb_program_interface_query@arb_program_interface_query-getprogramresourceindex@'vs_input2[1][0]' on GL_PROGRAM_INPUT,Fail
# failing since at least e82369d0 (2023-02-03)
spec@arb_query_buffer_object@qbo,Fail
spec@arb_query_buffer_object@qbo@query-GL_CLIPPING_INPUT_PRIMITIVES-ASYNC_CPU_READ_BEFORE-GL_UNSIGNED_INT64_ARB,Fail
spec@arb_query_buffer_object@qbo@query-GL_PRIMITIVES_SUBMITTED-ASYNC_CPU_READ_BEFORE-GL_UNSIGNED_INT64_ARB,Fail
spec@arb_query_buffer_object@qbo@query-GL_GEOMETRY_SHADER_INVOCATIONS-ASYNC_CPU_READ_BEFORE-GL_UNSIGNED_INT64_ARB,Fail
spec@arb_query_buffer_object@qbo@query-GL_SAMPLES_PASSED-ASYNC_CPU_READ_BEFORE-GL_UNSIGNED_INT64_ARB,Fail
spec@arb_sample_locations@test,Fail
spec@arb_sample_locations@test@MSAA: 1- X: 0- Y: 0- Grid: false,Fail
spec@arb_sample_locations@test@MSAA: 1- X: 0- Y: 0- Grid: true,Fail

View file

@ -1946,8 +1946,10 @@ zink_buffer_map(struct pipe_context *pctx,
(((usage & PIPE_MAP_READ) && !(usage & PIPE_MAP_PERSISTENT) &&
((res->obj->bo->base.placement & 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)));
if (!res->obj->host_visible || res->base.b.flags & PIPE_RESOURCE_FLAG_DONT_MAP_DIRECTLY) {
/* any read, non-HV write, or unmappable that reaches this point needs staging */
if ((usage & PIPE_MAP_READ) || !res->obj->host_visible || res->base.b.flags & PIPE_RESOURCE_FLAG_DONT_MAP_DIRECTLY) {
overwrite:
trans->offset = box->x % screen->info.props.limits.minMemoryMapAlignment;
trans->staging_res = pipe_buffer_create(&screen->base, PIPE_BIND_LINEAR, PIPE_USAGE_STAGING, box->width + trans->offset);