r = -ENOMEM;
goto out_err;
}
- ctx->pm4_ndwords = RADEON_MAX_CMDBUF_DWORDS;
ctx->pm4 = ctx->cs->buf;
r600_init_cs(ctx);
- /* save 16dwords space for fence mecanism */
- ctx->pm4_ndwords -= 16;
ctx->max_db = 8;
return 0;
out_err:
S_02800C_NOOP_CULL_DISABLE(1));
}
- /* update the max dword count to make sure we have enough space
- * reserved for flushing the destination caches */
- ctx->pm4_ndwords = RADEON_MAX_CMDBUF_DWORDS - ctx->num_dest_buffers * 7 - 16;
-
r600_need_cs_space(ctx, 0, TRUE);
/* at this point everything is flushed and ctx->pm4_cdwords = 0 */
- if (unlikely((ctx->pm4_dirty_cdwords + ndwords) > ctx->pm4_ndwords)) {
+ if (unlikely((ctx->pm4_dirty_cdwords + ndwords) > RADEON_MAX_CMDBUF_DWORDS)) {
R600_ERR("context is too big to be scheduled\n");
return;
}
struct list_head dirty;
struct list_head resource_dirty;
struct list_head enable_list;
- unsigned pm4_ndwords;
unsigned pm4_dirty_cdwords;
unsigned ctx_pm4_ndwords;
unsigned init_dwords;
r = -ENOMEM;
goto out_err;
}
- ctx->pm4_ndwords = RADEON_MAX_CMDBUF_DWORDS;
ctx->pm4 = ctx->cs->buf;
r600_init_cs(ctx);
- /* save 16dwords space for fence mecanism */
- ctx->pm4_ndwords -= 16;
ctx->max_db = 4;
return 0;
out_err:
num_dw += 3;
}
+ /* Count in framebuffer cache flushes at the end of CS. */
+ num_dw += ctx->num_dest_buffers * 7;
+
+ /* Save 16 dwords for the fence mechanism. */
+ num_dw += 16;
+
/* Flush if there's not enough space. */
- if (num_dw > ctx->pm4_ndwords) {
+ if (num_dw > RADEON_MAX_CMDBUF_DWORDS) {
r600_context_flush(ctx, RADEON_FLUSH_ASYNC);
}
}
S_028D10_NOOP_CULL_DISABLE(1));
}
- /* update the max dword count to make sure we have enough space
- * reserved for flushing the destination caches */
- ctx->pm4_ndwords = RADEON_MAX_CMDBUF_DWORDS - ctx->num_dest_buffers * 7 - 16;
-
r600_need_cs_space(ctx, 0, TRUE);
/* at this point everything is flushed and ctx->pm4_cdwords = 0 */
- if (unlikely((ctx->pm4_dirty_cdwords + ndwords) > ctx->pm4_ndwords)) {
+ if (unlikely((ctx->pm4_dirty_cdwords + ndwords) > RADEON_MAX_CMDBUF_DWORDS)) {
R600_ERR("context is too big to be scheduled\n");
return;
}