int cs_count = 0;
#define CHECK_CS(size) \
- cs_winsys->check_cs(cs_winsys, (size))
+ assert(cs_winsys->check_cs(cs_winsys, (size)))
#define BEGIN_CS(size) do { \
CHECK_CS(size); \
return;
}
+ /* Check size of CS. */
+ /* Make sure we have at least 8*1024 spare dwords. */
+ /* XXX It would be nice to know the number of dwords we really need to
+ * XXX emit. */
+ if (!r300->winsys->check_cs(r300->winsys, 8*1024)) {
+ r300->context.flush(&r300->context, 0, NULL);
+ }
+
/* Clean out BOs. */
r300->winsys->reset_bos(r300->winsys);
- /* XXX check size */
validate:
/* Color buffers... */
for (i = 0; i < r300->framebuffer_state.nr_cbufs; i++) {
static boolean radeon_check_cs(struct radeon_winsys* winsys, int size)
{
- /* XXX check size here, lazy ass! */
- return radeon_validate(winsys);
+ struct radeon_cs* cs = winsys->priv->cs;
+
+ return radeon_validate(winsys) && cs->cdw + size <= cs->ndw;
}
static void radeon_begin_cs(struct radeon_winsys* winsys,