Instead of unreferencing all the BOs used by the freshly submitted batch
directly, ask the bufmgr to unref them for us once the batch goes idle.
This should more-or-less have the same effect except that we now wait to
unref the BOs until the batch is idle.
---
 src/mesa/drivers/dri/i965/intel_batchbuffer.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/intel_batchbuffer.c 
b/src/mesa/drivers/dri/i965/intel_batchbuffer.c
index df999ffeb1d..127d0c34bea 100644
--- a/src/mesa/drivers/dri/i965/intel_batchbuffer.c
+++ b/src/mesa/drivers/dri/i965/intel_batchbuffer.c
@@ -535,10 +535,12 @@ static void
 brw_new_batch(struct brw_context *brw)
 {
    /* Unreference any BOs held by the previous batch, and reset counts. */
-   for (int i = 0; i < brw->batch.exec_count; i++) {
-      brw_bo_unreference(brw->batch.exec_bos[i]);
+   brw_bo_unreference_bos_when_idle(brw->batch.batch.bo,
+                                    brw->batch.exec_bos,
+                                    brw->batch.exec_count);
+
+   for (int i = 0; i < brw->batch.exec_count; i++)
       brw->batch.exec_bos[i] = NULL;
-   }
    brw->batch.batch_relocs.reloc_count = 0;
    brw->batch.state_relocs.reloc_count = 0;
    brw->batch.exec_count = 0;
-- 
2.17.1

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to