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);
}
rsc->pending_ctx = ctx;
}
-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)
{
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)
{
/* 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,