zink: rejigger PIPE_MAP_ONCE for internal qbo reads

DONTBLOCK is only used internally for this case, and promoting it over
the staging buffer case ensures that it's always reached when it should be

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12410>
This commit is contained in:
Mike Blumenkrantz
2021-07-30 11:34:40 -04:00
committed by Marge Bot
parent 7d39ef49bd
commit 97d04c2bc5
2 changed files with 8 additions and 8 deletions

View File

@@ -428,7 +428,7 @@ get_query_result(struct pipe_context *pctx,
{
struct zink_screen *screen = zink_screen(pctx->screen);
struct zink_query *query = (struct zink_query *)q;
unsigned flags = PIPE_MAP_READ | PIPE_MAP_ONCE;
unsigned flags = PIPE_MAP_READ;
if (!wait)
flags |= PIPE_MAP_DONTBLOCK;

View File

@@ -1136,6 +1136,13 @@ buffer_transfer_map(struct zink_context *ctx, struct zink_resource *res, unsigne
/* At this point, the buffer is always idle (we checked it above). */
usage |= PIPE_MAP_UNSYNCHRONIZED;
}
} else if (usage & PIPE_MAP_DONTBLOCK) {
/* sparse/device-local will always need to wait since it has to copy */
if (!res->obj->host_visible)
return NULL;
if (!zink_resource_usage_check_completion(screen, res, ZINK_RESOURCE_ACCESS_WRITE))
return NULL;
usage |= PIPE_MAP_UNSYNCHRONIZED;
} else if (!(usage & PIPE_MAP_UNSYNCHRONIZED) &&
(((usage & PIPE_MAP_READ) && !(usage & PIPE_MAP_PERSISTENT) && res->base.b.usage != PIPE_USAGE_STAGING) || !res->obj->host_visible)) {
assert(!(usage & (TC_TRANSFER_MAP_THREADED_UNSYNC | PIPE_MAP_THREAD_SAFE)));
@@ -1151,13 +1158,6 @@ buffer_transfer_map(struct zink_context *ctx, struct zink_resource *res, unsigne
ptr = map_resource(screen, res);
ptr = ((uint8_t *)ptr) + trans->offset;
}
} else if (usage & PIPE_MAP_DONTBLOCK) {
/* sparse/device-local will always need to wait since it has to copy */
if (!res->obj->host_visible)
return NULL;
if (!zink_resource_usage_check_completion(screen, res, ZINK_RESOURCE_ACCESS_WRITE))
return NULL;
usage |= PIPE_MAP_UNSYNCHRONIZED;
}
if (!(usage & PIPE_MAP_UNSYNCHRONIZED)) {