From 03d17461f382ad7de8e6ebf42fb841e68ea58d3e Mon Sep 17 00:00:00 2001 From: Paulo Zanoni Date: Mon, 2 Aug 2021 13:41:46 -0700 Subject: [PATCH] iris: use add_bo_to_batch() when adding batch->bo Again, we don't need all the dependency checking, seqno incrementing and duplicate tracking for batch->bo. Just use the unchecked version. This commit is not particularly significant since it really just saves us a check in the iris_use_pinned_bo() hot path, but since we already have the helper function, why not? v2: - (turns out the answer to "why not?" is because the patch had a bug) - Call ensure_exec_obj_space() since batch batch chaining can happen and doesn't guarantee pre-reserved space (Ken). Reviewed-by: Kenneth Graunke Signed-off-by: Paulo Zanoni Part-of: --- src/gallium/drivers/iris/iris_batch.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/gallium/drivers/iris/iris_batch.c b/src/gallium/drivers/iris/iris_batch.c index a2ff24b9fef..bc5b58670dc 100644 --- a/src/gallium/drivers/iris/iris_batch.c +++ b/src/gallium/drivers/iris/iris_batch.c @@ -296,6 +296,7 @@ iris_use_pinned_bo(struct iris_batch *batch, bool writable, enum iris_domain access) { assert(bo->kflags & EXEC_OBJECT_PINNED); + assert(bo != batch->bo); /* Never mark the workaround BO with EXEC_OBJECT_WRITE. We don't care * about the order of any writes to that buffer, and marking it writable @@ -322,8 +323,7 @@ iris_use_pinned_bo(struct iris_batch *batch, return; } - if (bo != batch->bo && - (!batch->measure || bo != batch->measure->bo)) { + if (!batch->measure || bo != batch->measure->bo) { /* This is the first time our batch has seen this BO. Before we use it, * we may need to flush and synchronize with other batches. */ @@ -372,7 +372,8 @@ create_batch(struct iris_batch *batch) batch->map = iris_bo_map(NULL, batch->bo, MAP_READ | MAP_WRITE); batch->map_next = batch->map; - iris_use_pinned_bo(batch, batch->bo, false, IRIS_DOMAIN_NONE); + ensure_exec_obj_space(batch, 1); + add_bo_to_batch(batch, batch->bo, false); } static void