{
struct r600_context *ctx = context;
struct radeon_winsys_cs *cs = ctx->b.gfx.cs;
-
- if (!radeon_emitted(cs, ctx->b.initial_gfx_cs_size) && !fence)
+ struct radeon_winsys *ws = ctx->b.ws;
+
+ if (!radeon_emitted(cs, ctx->b.initial_gfx_cs_size) &&
+ (!fence || ctx->b.last_gfx_fence)) {
+ if (fence)
+ ws->fence_reference(fence, ctx->b.last_gfx_fence);
+ if (!(flags & RADEON_FLUSH_ASYNC))
+ ws->cs_sync_flush(cs);
return;
+ }
r600_preflush_suspend_features(&ctx->b);
}
/* Flush the CS. */
- ctx->b.ws->cs_flush(cs, flags, fence);
+ ws->cs_flush(cs, flags, &ctx->b.last_gfx_fence);
+ if (fence)
+ ws->fence_reference(fence, ctx->b.last_gfx_fence);
r600_begin_new_cs(ctx);
}