summaryrefslogtreecommitdiff
path: root/src/i830_batchbuffer.h
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2009-11-10 11:05:20 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2009-11-10 15:19:08 +0000
commit67af5a99253b1295f8dc09b28863eb7dc8b59e1d (patch)
treea434b1f310c45d00affad115ede2ae92708d5a83 /src/i830_batchbuffer.h
parent998d6b3d8c549086fbc8a9f0e309694b23398d8d (diff)
Check that batch buffers are atomic.
Since batch buffers are rarely emitted by themselves but as part of a sequence of state and vertices, the whole sequence is emitted atomically. Here we just enforce that batches are marked as being part of an atomic sequence as appropriate. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src/i830_batchbuffer.h')
-rw-r--r--src/i830_batchbuffer.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/i830_batchbuffer.h b/src/i830_batchbuffer.h
index 274e82f9..a7dd289c 100644
--- a/src/i830_batchbuffer.h
+++ b/src/i830_batchbuffer.h
@@ -127,11 +127,24 @@ do { \
if (intel->batch_emitting != 0) \
FatalError("%s: BEGIN_BATCH called without closing " \
"ADVANCE_BATCH\n", __FUNCTION__); \
+ assert(!intel->in_batch_atomic); \
intel_batch_require_space(scrn, intel, (n) * 4); \
intel->batch_emitting = (n) * 4; \
intel->batch_emit_start = intel->batch_used; \
} while (0)
+/* special-case variant for when we have preallocated space */
+#define ATOMIC_BATCH(n) \
+do { \
+ if (intel->batch_emitting != 0) \
+ FatalError("%s: ATOMIC_BATCH called without closing " \
+ "ADVANCE_BATCH\n", __FUNCTION__); \
+ assert(intel->in_batch_atomic); \
+ assert(intel->batch_used + (n) * 4 <= intel->batch_atomic_limit); \
+ intel->batch_emitting = (n) * 4; \
+ intel->batch_emit_start = intel->batch_used; \
+} while (0)
+
#define ADVANCE_BATCH() do { \
if (intel->batch_emitting == 0) \
FatalError("%s: ADVANCE_BATCH called with no matching " \