r300_get_num_cs_end_dwords(r300);
/* Reserve CS space. */
- if (dwords > (r300->cs->max_dw - r300->cs->cdw)) {
+ if (!r300->rws->cs_check_space(r300->cs, dwords)) {
r300_flush(&r300->context, RADEON_FLUSH_ASYNC, NULL);
}
cs_dwords += r300_get_num_cs_end_dwords(r300);
/* Reserve requested CS space. */
- if (cs_dwords > (r300->cs->max_dw - r300->cs->cdw)) {
+ if (!r300->rws->cs_check_space(r300->cs, cs_dwords)) {
r300_flush(&r300->context, RADEON_FLUSH_ASYNC, NULL);
flushed = TRUE;
}
ctx->b.gtt = 0;
ctx->b.vram = 0;
- /* The number of dwords we already used in the CS so far. */
- num_dw += ctx->b.gfx.cs->cdw;
-
+ /* Check available space in CS. */
if (count_draw_in) {
uint64_t mask;
num_dw += 10;
/* Flush if there's not enough space. */
- if (num_dw > ctx->b.gfx.cs->max_dw) {
+ if (!ctx->b.ws->cs_check_space(ctx->b.gfx.cs, num_dw)) {
ctx->b.gfx.flush(ctx, RADEON_FLUSH_ASYNC, NULL);
}
}
/* Flush if there's not enough space, or if the memory usage per IB
* is too large.
*/
- if ((num_dw + ctx->dma.cs->cdw) > ctx->dma.cs->max_dw ||
+ if (!ctx->ws->cs_check_space(ctx->dma.cs, num_dw) ||
!ctx->ws->cs_memory_below_limit(ctx->dma.cs, vram, gtt)) {
ctx->dma.flush(ctx, RADEON_FLUSH_ASYNC, NULL);
assert((num_dw + ctx->dma.cs->cdw) <= ctx->dma.cs->max_dw);
/* If the CS is sufficiently large, don't count the space needed
* and just flush if there is not enough space left.
*/
- if (unlikely(cs->cdw > cs->max_dw - 2048 ||
- (ce_ib && ce_ib->max_dw - ce_ib->cdw <
- si_ce_needed_cs_space())))
+ if (!ctx->b.ws->cs_check_space(cs, 2048) ||
+ (ce_ib && !ctx->b.ws->cs_check_space(ce_ib, si_ce_needed_cs_space())))
ctx->b.gfx.flush(ctx, RADEON_FLUSH_ASYNC, NULL);
}