[v2] i965/batch: don't ignore the 'brw_new_batch' call for a 'new batch'

Submitted by andrey simiklit on Sept. 10, 2018, 11:37 a.m.


Message ID 1536579468-9420-1-git-send-email-asimiklit.work@gmail.com
State New
Headers show
Series "i965/batch: don't ignore the 'brw_new_batch' call for a 'new batch'" ( rev: 3 ) in Mesa

Not browsing as part of any series.

Commit Message

andrey simiklit Sept. 10, 2018, 11:37 a.m.
From: Andrii Simiklit <andrii.simiklit@globallogic.com>

If we restore the 'new batch' using 'intel_batchbuffer_reset_to_saved'
function we must restore the default state of the batch using
'brw_new_batch' function because the 'intel_batchbuffer_flush'
function will not do it for the 'new batch' again.
At least the following fields of the batch
'state_base_address_emitted','aperture_space', 'state_used'
should be restored to default values to avoid:
1. the aperture_space overflow
2. the missed STATE_BASE_ADDRESS commad in the batch
3. the memory overconsumption of the 'statebuffer'
   due to uncleared 'state_used' field.

v2: merge with new commits, changes was minimized, added the 'fixes' tag

Fixes: 3faf56ffbdeb "intel: Add an interface for saving/restoring
                     the batchbuffer state."

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=107626
Signed-off-by: Andrii Simiklit <andrii.simiklit@globallogic.com>

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

Patch hide | download patch | download mbox

diff --git a/src/mesa/drivers/dri/i965/intel_batchbuffer.c b/src/mesa/drivers/dri/i965/intel_batchbuffer.c
index 4363b14..45eedab 100644
--- a/src/mesa/drivers/dri/i965/intel_batchbuffer.c
+++ b/src/mesa/drivers/dri/i965/intel_batchbuffer.c
@@ -57,6 +57,9 @@  static void
 intel_batchbuffer_reset(struct brw_context *brw);
 static void
+brw_new_batch(struct brw_context *brw);
+static void
 dump_validation_list(struct intel_batchbuffer *batch)
    fprintf(stderr, "Validation list (length %d):\n", batch->exec_count);
@@ -311,6 +314,8 @@  intel_batchbuffer_reset_to_saved(struct brw_context *brw)
    brw->batch.exec_count = brw->batch.saved.exec_count;
    brw->batch.map_next = brw->batch.saved.map_next;
+   if (USED_BATCH(brw->batch) == 0)
+        brw_new_batch(brw);