etnaviv: flush all pending contexts when accessing a resource with the CPU

When setting up a transfer to a resource, all contexts where the resource
is pending must be flushed. Otherwise a write transfer might be started
in the current context before all contexts that access the resource in
shared (read) mode have been executed.

Fixes: 64813541d5 (etnaviv: fix resource usage tracking across
different pipe_context's)
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Tested-By: Guido Günther <agx@sigxcpu.org>
This commit is contained in:
Lucas Stach 2019-03-27 12:22:58 +01:00
parent f317ee1aff
commit 3d8da347ac
1 changed files with 8 additions and 2 deletions

View File

@ -360,8 +360,14 @@ etna_transfer_map(struct pipe_context *pctx, struct pipe_resource *prsc,
if ((trans->rsc && (etna_resource(trans->rsc)->status & ETNA_PENDING_WRITE)) ||
(!trans->rsc &&
(((usage & PIPE_TRANSFER_READ) && (rsc->status & ETNA_PENDING_WRITE)) ||
((usage & PIPE_TRANSFER_WRITE) && rsc->status))))
pctx->flush(pctx, NULL, 0);
((usage & PIPE_TRANSFER_WRITE) && rsc->status)))) {
set_foreach(rsc->pending_ctx, entry) {
struct etna_context *pend_ctx = (struct etna_context *)entry->key;
struct pipe_context *pend_pctx = &pend_ctx->base;
pend_pctx->flush(pend_pctx, NULL, 0);
}
}
mtx_unlock(&screen->lock);