diff options
author | Lucas Stach <[email protected]> | 2017-05-18 15:37:02 +0200 |
---|---|---|
committer | Lucas Stach <[email protected]> | 2017-06-08 18:29:36 +0200 |
commit | a276c32a08bd41ceb8fd9b604ba9ac8229d59b64 (patch) | |
tree | 4f1e760ec0ea7dea28b904305ba0670dd80dadd5 | |
parent | ada3c3aa3da5d04bd597014dc1b5d4b028313513 (diff) |
etnaviv: slim down resource waiting
cpu_prep() already does all the required waiting, so the only thing that
needs to be done is flushing the commandstream, if a GPU write is pending.
Signed-off-by: Lucas Stach <[email protected]>
Reviewed-by: Wladimir J. van der Laan <[email protected]>
-rw-r--r-- | src/gallium/drivers/etnaviv/etnaviv_clear_blit.c | 5 | ||||
-rw-r--r-- | src/gallium/drivers/etnaviv/etnaviv_resource.c | 16 | ||||
-rw-r--r-- | src/gallium/drivers/etnaviv/etnaviv_resource.h | 3 | ||||
-rw-r--r-- | src/gallium/drivers/etnaviv/etnaviv_transfer.c | 5 |
4 files changed, 6 insertions, 23 deletions
diff --git a/src/gallium/drivers/etnaviv/etnaviv_clear_blit.c b/src/gallium/drivers/etnaviv/etnaviv_clear_blit.c index ae1c5862880..ea416bf192f 100644 --- a/src/gallium/drivers/etnaviv/etnaviv_clear_blit.c +++ b/src/gallium/drivers/etnaviv/etnaviv_clear_blit.c @@ -528,8 +528,9 @@ etna_try_rs_blit(struct pipe_context *pctx, manual: if (src->layout == ETNA_LAYOUT_TILED && dst->layout == ETNA_LAYOUT_TILED) { - etna_resource_wait(pctx, dst); - etna_resource_wait(pctx, src); + if ((src->status & ETNA_PENDING_WRITE) || + (dst->status & ETNA_PENDING_WRITE)) + pctx->flush(pctx, NULL, 0); return etna_manual_blit(dst, dst_lev, dst_offset, src, src_lev, src_offset, blit_info); } diff --git a/src/gallium/drivers/etnaviv/etnaviv_resource.c b/src/gallium/drivers/etnaviv/etnaviv_resource.c index 1341e1ea231..9aa1aa617a5 100644 --- a/src/gallium/drivers/etnaviv/etnaviv_resource.c +++ b/src/gallium/drivers/etnaviv/etnaviv_resource.c @@ -429,22 +429,6 @@ etna_resource_used(struct etna_context *ctx, struct pipe_resource *prsc, } void -etna_resource_wait(struct pipe_context *pctx, struct etna_resource *rsc) -{ - if (rsc->status & ETNA_PENDING_WRITE) { - struct pipe_fence_handle *fence; - struct pipe_screen *pscreen = pctx->screen; - - pctx->flush(pctx, &fence, 0); - - if (!pscreen->fence_finish(pscreen, pctx, fence, 5000000000ULL)) - BUG("fence timed out (hung GPU?)"); - - pscreen->fence_reference(pscreen, &fence, NULL); - } -} - -void etna_resource_screen_init(struct pipe_screen *pscreen) { pscreen->can_create_resource = etna_screen_can_create_resource; diff --git a/src/gallium/drivers/etnaviv/etnaviv_resource.h b/src/gallium/drivers/etnaviv/etnaviv_resource.h index a8d42ee1a09..913316f193c 100644 --- a/src/gallium/drivers/etnaviv/etnaviv_resource.h +++ b/src/gallium/drivers/etnaviv/etnaviv_resource.h @@ -124,9 +124,6 @@ void etna_resource_used(struct etna_context *ctx, struct pipe_resource *prsc, enum etna_resource_status status); -void -etna_resource_wait(struct pipe_context *ctx, struct etna_resource *rsc); - static inline void resource_read(struct etna_context *ctx, struct pipe_resource *prsc) { diff --git a/src/gallium/drivers/etnaviv/etnaviv_transfer.c b/src/gallium/drivers/etnaviv/etnaviv_transfer.c index 4809b04ff95..269bd498f89 100644 --- a/src/gallium/drivers/etnaviv/etnaviv_transfer.c +++ b/src/gallium/drivers/etnaviv/etnaviv_transfer.c @@ -199,8 +199,9 @@ etna_transfer_map(struct pipe_context *pctx, struct pipe_resource *prsc, /* Always sync if we have the temporary resource. The PIPE_TRANSFER_READ * case could be optimised if we knew whether the resource has outstanding * rendering. */ - if (usage & PIPE_TRANSFER_READ || trans->rsc) - etna_resource_wait(pctx, rsc); + if ((usage & PIPE_TRANSFER_READ || trans->rsc) && + rsc->status & ETNA_PENDING_WRITE) + pctx->flush(pctx, NULL, 0); /* XXX we don't handle PIPE_TRANSFER_FLUSH_EXPLICIT; this flag can be ignored * when mapping in-place, |