[Mesa-dev] [PATCH 5/8] i965/batch: Use brw_bo_unreference_bos_when_idle

Jason Ekstrand jason at jlekstrand.net
Wed Jun 13 20:26:57 UTC 2018


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



More information about the mesa-dev mailing list