zink: change some transfer_map cases of waiting on cs batch to flushing cs

we don't actually have to stall here, we just have to make sure the cs batch
is submitted before the subsequent buffer copy command goes into a gfx
batch in order to preserve the ordering

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9146>
This commit is contained in:
Mike Blumenkrantz 2020-09-06 11:08:33 -04:00
parent 07df65d45f
commit 4d5f7b3a6d
1 changed files with 4 additions and 2 deletions

View File

@ -646,7 +646,8 @@ zink_transfer_map(struct pipe_context *pctx,
if (usage & PIPE_MAP_READ) {
/* TODO: can probably just do a full cs copy if it's already in a cs batch */
if (batch_uses & (ZINK_RESOURCE_ACCESS_WRITE << ZINK_COMPUTE_BATCH_ID))
zink_wait_on_batch(ctx, ZINK_COMPUTE_BATCH_ID);
/* don't actually have to stall here, only ensure batch is submitted */
zink_flush_compute(ctx);
struct zink_context *ctx = zink_context(pctx);
bool ret = zink_transfer_copy_bufimage(ctx, res,
staging_res, trans,
@ -716,7 +717,8 @@ zink_transfer_flush_region(struct pipe_context *pctx,
if (trans->staging_res) {
uint32_t batch_uses = zink_get_resource_usage(res);
if (batch_uses & (ZINK_RESOURCE_ACCESS_WRITE << ZINK_COMPUTE_BATCH_ID)) {
zink_wait_on_batch(ctx, ZINK_COMPUTE_BATCH_ID);
/* don't actually have to stall here, only ensure batch is submitted */
zink_flush_compute(ctx);
batch_uses &= ~(ZINK_RESOURCE_ACCESS_WRITE << ZINK_COMPUTE_BATCH_ID);
batch_uses &= ~(ZINK_RESOURCE_ACCESS_READ << ZINK_COMPUTE_BATCH_ID);
}