Mesa (master): i965: Require space for MI_BATCHBUFFER_END.

Kenneth Graunke kwg at kemper.freedesktop.org
Sun Jan 7 04:10:45 UTC 2018


Module: Mesa
Branch: master
Commit: 1c9f1a28c0738a0b1cb8626af431d18eeee3f4f1
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=1c9f1a28c0738a0b1cb8626af431d18eeee3f4f1

Author: Kenneth Graunke <kenneth at whitecape.org>
Date:   Fri Jan  5 12:07:20 2018 -0800

i965: Require space for MI_BATCHBUFFER_END.

intel_batchbuffer_emit_dword doesn't reserve space for the DWord it
emits.  In the past, we had some reserved batch space to ensure this
worked.  With the switch to growing batches, we need to actually request
space so that we grow if necessary.

Fixes: 2c46a67b4138631217141f (i965: Delete BATCH_RESERVED handling.)
Cc: mesa-stable at lists.freedesktop.org
Reviewed-by: Jason Ekstrand <jason at jlekstrand.net>

---

 src/mesa/drivers/dri/i965/intel_batchbuffer.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/intel_batchbuffer.c b/src/mesa/drivers/dri/i965/intel_batchbuffer.c
index 0e090f4625..3fd8e05d3d 100644
--- a/src/mesa/drivers/dri/i965/intel_batchbuffer.c
+++ b/src/mesa/drivers/dri/i965/intel_batchbuffer.c
@@ -687,10 +687,13 @@ brw_finish_batch(struct brw_context *brw)
       }
    }
 
-   /* Mark the end of the buffer. */
+   /* Emit MI_BATCH_BUFFER_END to finish our batch.  Note that execbuf2
+    * requires our batch size to be QWord aligned, so we pad it out if
+    * necessary by emitting an extra MI_NOOP after the end.
+    */
+   intel_batchbuffer_require_space(brw, 8, brw->batch.ring);
    intel_batchbuffer_emit_dword(&brw->batch, MI_BATCH_BUFFER_END);
    if (USED_BATCH(brw->batch) & 1) {
-      /* Round batchbuffer usage to 2 DWORDs. */
       intel_batchbuffer_emit_dword(&brw->batch, MI_NOOP);
    }
 




More information about the mesa-commit mailing list