From: Mike Blumenkrantz Date: Fri, 30 Jul 2021 15:34:40 +0000 (-0400) Subject: zink: rejigger PIPE_MAP_ONCE for internal qbo reads X-Git-Tag: upstream/22.3.5~19133 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=97d04c2bc54ab3f712edb12a3fba6140a9662f91;p=platform%2Fupstream%2Fmesa.git 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 Part-of: --- diff --git a/src/gallium/drivers/zink/zink_query.c b/src/gallium/drivers/zink/zink_query.c index b30bf2c..cdfb15f 100644 --- a/src/gallium/drivers/zink/zink_query.c +++ b/src/gallium/drivers/zink/zink_query.c @@ -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; diff --git a/src/gallium/drivers/zink/zink_resource.c b/src/gallium/drivers/zink/zink_resource.c index 3bef1b2..8aa21c0 100644 --- a/src/gallium/drivers/zink/zink_resource.c +++ b/src/gallium/drivers/zink/zink_resource.c @@ -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)) {