From 7bfc8f7d7d031268d4ac8419275e1d3c9600841f Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Sat, 20 Jan 2018 23:14:24 -0800 Subject: [PATCH] iris: kill iris_new_batch reset and new are too similar, and this had exactly one caller --- src/gallium/drivers/iris/iris_batch.c | 38 +++++++++++---------------- 1 file changed, 15 insertions(+), 23 deletions(-) diff --git a/src/gallium/drivers/iris/iris_batch.c b/src/gallium/drivers/iris/iris_batch.c index edc93428b6d..07770438acd 100644 --- a/src/gallium/drivers/iris/iris_batch.c +++ b/src/gallium/drivers/iris/iris_batch.c @@ -116,7 +116,9 @@ iris_init_batch(struct iris_batch *batch, batch->screen = screen; batch->dbg = dbg; + /* ring should be one of I915_EXEC_RENDER, I915_EXEC_BLT, etc. */ assert((ring & ~I915_EXEC_RING_MASK) == 0); + assert(util_bitcount(ring) == 1); batch->ring = ring; init_reloc_list(&batch->cmdbuf.relocs, 256); @@ -427,28 +429,6 @@ iris_batch_emit(struct iris_batch *batch, const void *data, unsigned size) memcpy(batch->cmdbuf.map_next, data, size); } -/** - * Called when starting a new batch buffer. - */ -static void -iris_new_batch(struct iris_batch *batch) -{ - /* Unreference any BOs held by the previous batch, and reset counts. */ - for (int i = 0; i < batch->exec_count; i++) { - iris_bo_unreference(batch->exec_bos[i]); - batch->exec_bos[i] = NULL; - } - batch->cmdbuf.relocs.reloc_count = 0; - batch->statebuf.relocs.reloc_count = 0; - batch->exec_count = 0; - batch->aperture_space = 0; - - iris_bo_unreference(batch->statebuf.bo); - - /* Create a new batchbuffer and reset the associated state: */ - iris_batch_reset_and_clear_render_cache(batch); -} - /** * Called from iris_batch_flush before emitting MI_BATCHBUFFER_END and * sending it off. @@ -609,8 +589,20 @@ _iris_batch_flush_fence(struct iris_batch *batch, iris_bo_wait_rendering(batch->cmdbuf.bo); } + /* Clean up after the batch we submitted and prepare for a new one. */ + for (int i = 0; i < batch->exec_count; i++) { + iris_bo_unreference(batch->exec_bos[i]); + batch->exec_bos[i] = NULL; + } + batch->cmdbuf.relocs.reloc_count = 0; + batch->statebuf.relocs.reloc_count = 0; + batch->exec_count = 0; + batch->aperture_space = 0; + + iris_bo_unreference(batch->statebuf.bo); + /* Start a new batch buffer. */ - iris_new_batch(batch); + iris_batch_reset_and_clear_render_cache(batch); return 0; } -- 2.30.2