aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri/i965/intel_batchbuffer.c
diff options
context:
space:
mode:
authorKenneth Graunke <[email protected]>2013-10-15 19:23:53 -0700
committerKenneth Graunke <[email protected]>2013-11-15 10:24:07 -0800
commit4ec982ad012a563b7acf9ee8c7fd61140f24ea9d (patch)
treedc66556c34bc3eee13d9e0b2b3c3378accf69613 /src/mesa/drivers/dri/i965/intel_batchbuffer.c
parent720d935fff1c7f49ce35369e00266cf2f333cdba (diff)
i965: Rework brw_new_batch to actually start a new batch.
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 <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
Diffstat (limited to 'src/mesa/drivers/dri/i965/intel_batchbuffer.c')
-rw-r--r--src/mesa/drivers/dri/i965/intel_batchbuffer.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/mesa/drivers/dri/i965/intel_batchbuffer.c b/src/mesa/drivers/dri/i965/intel_batchbuffer.c
index 9cdbe9ee277..fb0b45bc3b7 100644
--- a/src/mesa/drivers/dri/i965/intel_batchbuffer.c
+++ b/src/mesa/drivers/dri/i965/intel_batchbuffer.c
@@ -178,6 +178,9 @@ do_batch_dump(struct brw_context *brw)
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
@@ -286,7 +289,6 @@ do_flush_locked(struct brw_context *brw)
fprintf(stderr, "intel_do_flush_locked failed: %s\n", strerror(-ret));
exit(1);
}
- brw_new_batch(brw);
return ret;
}
@@ -339,9 +341,8 @@ _intel_batchbuffer_flush(struct brw_context *brw,
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;
}