zink: minor refactoring of buffer map for read case

make this a little more flexible for the non-DONTBLOCK case

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10509>
This commit is contained in:
Mike Blumenkrantz 2021-04-04 12:55:34 -04:00 committed by Marge Bot
parent a67347d496
commit 480b2b6508
1 changed files with 7 additions and 7 deletions

View File

@ -891,14 +891,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) {
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 (usage & PIPE_MAP_DONTBLOCK) {
if (latest_write &&
(latest_write == ctx->curr_batch || !zink_check_batch_completion(ctx, latest_write)))
return NULL;
latest_write = 0;
}
if (latest_write)
zink_wait_on_batch(ctx, latest_write);
}
if (!ptr) {