Previously, brw_new_batch was called just after execbuf, but before
intel_batchbuffer_reset. Essentially, it prepared for the creation of a
new batch, that wasn't yet available, and which it didn't create. This
was a bit awkward.
This patch makes brw_new_batch call intel_batchbuffer_reset as the very
first operation. This means that brw_new_batch actually creates a new
batchbuffer, and thus has it available. It brings the creation of the
new batchbuffer and BRW_NEW_BATCH flagging together into one place.
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
static void
brw_new_batch(struct brw_context *brw)
{
+ /* Create a new batchbuffer and reset the associated state: */
+ intel_batchbuffer_reset(brw);
+
/* If the kernel supports hardware contexts, then most hardware state is
* preserved between batches; we only need to re-emit state that is required
* to be in every batch. Otherwise we need to re-emit all the state that
fprintf(stderr, "intel_do_flush_locked failed: %s\n", strerror(-ret));
exit(1);
}
- brw_new_batch(brw);
return ret;
}
drm_intel_bo_wait_rendering(brw->batch.bo);
}
- /* Reset the buffer:
- */
- intel_batchbuffer_reset(brw);
+ /* Start a new batch buffer. */
+ brw_new_batch(brw);
return ret;
}