Mesa (main): iris: use add_bo_to_batch() when adding batch->bo

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Aug 11 22:38:14 UTC 2021


Module: Mesa
Branch: main
Commit: 03d17461f382ad7de8e6ebf42fb841e68ea58d3e
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=03d17461f382ad7de8e6ebf42fb841e68ea58d3e

Author: Paulo Zanoni <paulo.r.zanoni at intel.com>
Date:   Mon Aug  2 13:41:46 2021 -0700

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 <kenneth at whitecape.org>
Signed-off-by: Paulo Zanoni <paulo.r.zanoni at intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12194>

---

 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



More information about the mesa-commit mailing list