Mesa (staging/21.3): iris: Tidy code in iris_use_pinned_bo a bit

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Nov 18 19:01:42 UTC 2021


Module: Mesa
Branch: staging/21.3
Commit: 4f92ad133780cc1c65dd7d248073473432e580d7
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=4f92ad133780cc1c65dd7d248073473432e580d7

Author: Kenneth Graunke <kenneth at whitecape.org>
Date:   Mon Nov 15 19:14:01 2021 -0800

iris: Tidy code in iris_use_pinned_bo a bit

Now that we aren't short-circuiting most of the code, we should probably
reorganize it a little bit.  Tagged with fixes just so we pull all the
refactors together as one group.

Fixes: b21e916a628 ("iris: Combine iris_use_pinned_bo and add_exec_bo")
Reviewed-by: Paulo Zanoni <paulo.r.zanoni at intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13808>
(cherry picked from commit 3b78f175323f1db5ae28da264d5761bebb4f7052)

---

 .pick_status.json                     |  2 +-
 src/gallium/drivers/iris/iris_batch.c | 21 +++++++++------------
 2 files changed, 10 insertions(+), 13 deletions(-)

diff --git a/.pick_status.json b/.pick_status.json
index 9e65b60ff96..eefe31ac66c 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -436,7 +436,7 @@
         "description": "iris: Tidy code in iris_use_pinned_bo a bit",
         "nominated": true,
         "nomination_type": 1,
-        "resolution": 0,
+        "resolution": 1,
         "main_sha": null,
         "because_sha": "b21e916a6280f9aee5353c0dd4c6bcebb947496d"
     },
diff --git a/src/gallium/drivers/iris/iris_batch.c b/src/gallium/drivers/iris/iris_batch.c
index fafe70e7b6b..ef0fa147d38 100644
--- a/src/gallium/drivers/iris/iris_batch.c
+++ b/src/gallium/drivers/iris/iris_batch.c
@@ -356,20 +356,17 @@ iris_use_pinned_bo(struct iris_batch *batch,
 
    int existing_index = find_exec_index(batch, bo);
 
-   if (existing_index != -1) {
-      /* The BO is already in the list; mark it writable */
-      if (writable && !BITSET_TEST(batch->bos_written, existing_index)) {
-         BITSET_SET(batch->bos_written, existing_index);
-         flush_for_cross_batch_dependencies(batch, bo, writable);
-      }
-
-      return;
-   }
+   if (existing_index == -1) {
+      flush_for_cross_batch_dependencies(batch, bo, writable);
 
-   flush_for_cross_batch_dependencies(batch, bo, writable);
+      ensure_exec_obj_space(batch, 1);
+      add_bo_to_batch(batch, bo, writable);
+   } else if (writable && !BITSET_TEST(batch->bos_written, existing_index)) {
+      flush_for_cross_batch_dependencies(batch, bo, writable);
 
-   ensure_exec_obj_space(batch, 1);
-   add_bo_to_batch(batch, bo, writable);
+      /* The BO is already in the list; mark it writable */
+      BITSET_SET(batch->bos_written, existing_index);
+   }
 }
 
 static void



More information about the mesa-commit mailing list