Re: [Mesa-dev] [PATCH 2/2] etnaviv: flush all pending contexts when accessing a resource with the CPU
Hi Lucas, On Wed, Mar 27, 2019 at 12:22:58PM +0100, Lucas Stach wrote: > 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: 64813541d575 (etnaviv: fix resource usage tracking across > different pipe_context's) > Signed-off-by: Lucas Stach > --- > src/gallium/drivers/etnaviv/etnaviv_transfer.c | 10 -- > 1 file changed, 8 insertions(+), 2 deletions(-) > > diff --git a/src/gallium/drivers/etnaviv/etnaviv_transfer.c > b/src/gallium/drivers/etnaviv/etnaviv_transfer.c > index 45cd31207f70..d875803bde26 100644 > --- a/src/gallium/drivers/etnaviv/etnaviv_transfer.c > +++ b/src/gallium/drivers/etnaviv/etnaviv_transfer.c > @@ -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 = _ctx->base; > + > +pend_pctx->flush(pend_pctx, NULL, 0); > + } > + } > >mtx_unlock(>lock); I would not say that I have understood all the details of resource flushing but in my tests it doesn't break anything so: Tested-By: Guido Günther Cheers, -- Guido ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 2/2] etnaviv: flush all pending contexts when accessing a resource with the CPU
Am Mi., 27. März 2019 um 12:23 Uhr schrieb Lucas Stach : > > 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: 64813541d575 (etnaviv: fix resource usage tracking across > different pipe_context's) > Signed-off-by: Lucas Stach Reviewed-by: Christian Gmeiner > --- > src/gallium/drivers/etnaviv/etnaviv_transfer.c | 10 -- > 1 file changed, 8 insertions(+), 2 deletions(-) > > diff --git a/src/gallium/drivers/etnaviv/etnaviv_transfer.c > b/src/gallium/drivers/etnaviv/etnaviv_transfer.c > index 45cd31207f70..d875803bde26 100644 > --- a/src/gallium/drivers/etnaviv/etnaviv_transfer.c > +++ b/src/gallium/drivers/etnaviv/etnaviv_transfer.c > @@ -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 = _ctx->base; > + > +pend_pctx->flush(pend_pctx, NULL, 0); > + } > + } > >mtx_unlock(>lock); > > -- > 2.20.1 > -- greets -- Christian Gmeiner, MSc https://christian-gmeiner.info ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 2/2] 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: 64813541d575 (etnaviv: fix resource usage tracking across different pipe_context's) Signed-off-by: Lucas Stach --- src/gallium/drivers/etnaviv/etnaviv_transfer.c | 10 -- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/gallium/drivers/etnaviv/etnaviv_transfer.c b/src/gallium/drivers/etnaviv/etnaviv_transfer.c index 45cd31207f70..d875803bde26 100644 --- a/src/gallium/drivers/etnaviv/etnaviv_transfer.c +++ b/src/gallium/drivers/etnaviv/etnaviv_transfer.c @@ -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 = _ctx->base; + +pend_pctx->flush(pend_pctx, NULL, 0); + } + } mtx_unlock(>lock); -- 2.20.1 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev