zink: handle PIPE_MAP_DONTBLOCK for buffer read maps

this is mostly used by queries

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9962>
This commit is contained in:
Mike Blumenkrantz 2020-12-18 12:06:12 -05:00 committed by Marge Bot
parent cc7a187411
commit a084d012a9
1 changed files with 8 additions and 2 deletions

View File

@ -849,8 +849,14 @@ buffer_transfer_map(struct zink_context *ctx, struct zink_resource *res, unsigne
} else if ((usage & PIPE_MAP_READ) && !(usage & PIPE_MAP_PERSISTENT)) {
assert(!(usage & (TC_TRANSFER_MAP_THREADED_UNSYNC | PIPE_MAP_THREAD_SAFE)));
uint32_t latest_write = get_most_recent_access(res, ZINK_RESOURCE_ACCESS_WRITE);
if (latest_write)
zink_wait_on_batch(ctx, latest_write);
if (latest_write) {
if (usage & PIPE_MAP_DONTBLOCK) {
if (latest_write == ctx->curr_batch ||
!zink_check_batch_completion(ctx, latest_write))
return NULL;
} else
zink_wait_on_batch(ctx, latest_write);
}
}
if (!ptr) {