i965: Require space for MI_BATCHBUFFER_END.
authorKenneth Graunke <kenneth@whitecape.org>
Fri, 5 Jan 2018 20:07:20 +0000 (12:07 -0800)
committerKenneth Graunke <kenneth@whitecape.org>
Sun, 7 Jan 2018 04:10:32 +0000 (20:10 -0800)
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@lists.freedesktop.org
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
src/mesa/drivers/dri/i965/intel_batchbuffer.c

index 0e090f46250f29fab124eac72c44b4c17bc6f9fb..3fd8e05d3dc46d8ce3a3dd2db0ec0f82840ddefa 100644 (file)
@@ -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);
    }