if (ctx->screen->reorder)
fd_bc_flush(ctx, flags & PIPE_FLUSH_DEFERRED);
fd_bc_dump(ctx, "%p: NULL batch, remaining:\n", ctx);
+ if (!(flags & PIPE_FLUSH_DEFERRED))
+ tc_driver_internal_flush_notify(ctx->tc);
return;
}
fd_bc_dump(ctx, "%p: remaining:\n", ctx);
out:
+ /* If we just flushed all rendering out of the batch cache, then inform TC
+ * that it can use the resource_busy callback to check if they're still busy.
+ */
+ if (!(flags & PIPE_FLUSH_DEFERRED))
+ tc_driver_internal_flush_notify(ctx->tc);
+
if (fencep)
fd_fence_ref(fencep, fence);
fd_replace_buffer_storage,
fd_fence_create_unflushed,
fd_resource_busy,
- false,
+ true,
&ctx->tc);
uint64_t total_ram;
return op;
}
+/* This is called by TC to check if a buffer is idle on the GPU so it can do
+ * unsynchronized mappings from the frontend.
+ *
+ * Note that TC tracks what buffers are outstanding in its queue in between
+ * pctx->flush() calls (which we inform it of through
+ * tc_driver_internal_flush_notify()) so we don't need to go digging in our
+ * batch cache to check for usages.
+ */
bool
fd_resource_busy(struct pipe_screen *pscreen, struct pipe_resource *prsc,
unsigned usage)
{
struct fd_resource *rsc = fd_resource(prsc);
- if (pending(rsc, !!(usage & PIPE_MAP_WRITE)))
- return true;
-
if (resource_busy(rsc, translate_usage(usage)))
return true;