diff options
author | Daniel Vetter <daniel.vetter@ffwll.ch> | 2012-05-29 22:14:06 +0200 |
---|---|---|
committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2012-05-29 22:14:06 +0200 |
commit | bfbe813f8fb587017c4e1d73c51395c2837eb395 (patch) | |
tree | 3a999e4237f26641bf1f58bf1d95f9b9e01b3390 | |
parent | 04dfa492d195e063a07053815ff541b4351b0097 (diff) |
lib: fix gen5 workaround emission
Using BEGIN_BATCH can lead to a nice inf recursion through require_space
-> flush_batch -> BEGIN_BATCH.
Also fix things up to always require BATCH_RESERVED. We need 2 dwords
for the gen5 workaround and 2 dwords for MI_BB_END.
-rw-r--r-- | lib/intel_batchbuffer.c | 9 | ||||
-rw-r--r-- | lib/intel_batchbuffer.h | 2 |
2 files changed, 6 insertions, 5 deletions
diff --git a/lib/intel_batchbuffer.c b/lib/intel_batchbuffer.c index 325066e8..3fcc5787 100644 --- a/lib/intel_batchbuffer.c +++ b/lib/intel_batchbuffer.c @@ -84,10 +84,11 @@ intel_batchbuffer_flush_on_ring(struct intel_batchbuffer *batch, int ring) return; if (IS_GEN5(batch->devid)) { - BEGIN_BATCH(2); - OUT_BATCH(CMD_POLY_STIPPLE_OFFSET << 16); - OUT_BATCH(0); - ADVANCE_BATCH(); + /* emit gen5 w/a without batch space checks - we reserve that + * already. */ + *(uint32_t *) (batch->ptr) = CMD_POLY_STIPPLE_OFFSET << 16; + *(uint32_t *) (batch->ptr) = 0; + batch->ptr += 8; } /* Round batchbuffer usage to 2 DWORDs. */ diff --git a/lib/intel_batchbuffer.h b/lib/intel_batchbuffer.h index 4dffda7e..5a1fc178 100644 --- a/lib/intel_batchbuffer.h +++ b/lib/intel_batchbuffer.h @@ -63,7 +63,7 @@ static inline void intel_batchbuffer_require_space(struct intel_batchbuffer *batch, unsigned int sz) { - assert(sz < BATCH_SZ - 8); + assert(sz < BATCH_SZ - BATCH_RESERVED); if (intel_batchbuffer_space(batch) < sz) intel_batchbuffer_flush(batch); } |