summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKenneth Graunke <kenneth@whitecape.org>2020-08-25 09:47:13 -0700
committerDylan Baker <dylan.c.baker@intel.com>2020-08-28 11:27:05 -0700
commita020620c25f93dbf5d2609f0393e6354674cfe0b (patch)
treea69f88d0bc04ec158b18f9cd101dc17978163404
parent948a2fbec5f1cf006687800ec265b9867e228f6f (diff)
iris: Reorder the loops in iris_fence_await() for clarity.
Swapping the order of the loops makes the logic much easier to follow: for each point in our fence, if it hasn't gone by, make future work in all batches depend on it. Both loops are necessary, and now it's clearer why. (This doesn't actually fix a bug but needs to be cherry-picked for the next patch to apply, which does fix a bug.) Fixes: f459c56be6b ("iris: Add fence support using drm_syncobj") Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Tested-by: Tapani Pälli <tapani.palli@intel.com> Tested-by: Yang A Shi <yang.a.shi@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6463> (cherry picked from commit e98c7a66347a05fc166c377ab1abb77955aff775)
-rw-r--r--.pick_status.json2
-rw-r--r--src/gallium/drivers/iris/iris_fence.c20
2 files changed, 12 insertions, 10 deletions
diff --git a/.pick_status.json b/.pick_status.json
index c482ee2d014..d12869e05d2 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -589,7 +589,7 @@
"description": "iris: Reorder the loops in iris_fence_await() for clarity.",
"nominated": true,
"nomination_type": 1,
- "resolution": 0,
+ "resolution": 1,
"master_sha": null,
"because_sha": "f459c56be6bf33439cccc11e932b2b5b52ba7ad8"
},
diff --git a/src/gallium/drivers/iris/iris_fence.c b/src/gallium/drivers/iris/iris_fence.c
index 4600c1c4238..22acc317c0c 100644
--- a/src/gallium/drivers/iris/iris_fence.c
+++ b/src/gallium/drivers/iris/iris_fence.c
@@ -256,19 +256,21 @@ iris_fence_await(struct pipe_context *ctx,
"is unlikely to work without kernel 5.8+\n");
}
- /* Flush any current work in our context as it doesn't need to wait
- * for this fence. Any future work in our context must wait.
- */
- for (unsigned b = 0; b < IRIS_BATCH_COUNT; b++) {
- struct iris_batch *batch = &ice->batches[b];
+ for (unsigned i = 0; i < ARRAY_SIZE(fence->fine); i++) {
+ struct iris_fine_fence *fine = fence->fine[i];
- for (unsigned i = 0; i < ARRAY_SIZE(fence->fine); i++) {
- struct iris_fine_fence *fine = fence->fine[i];
+ if (iris_fine_fence_signaled(fine))
+ continue;
- if (iris_fine_fence_signaled(fine))
- continue;
+ for (unsigned b = 0; b < IRIS_BATCH_COUNT; b++) {
+ struct iris_batch *batch = &ice->batches[b];
+ /* We're going to make any future work in this batch wait for our
+ * fence to have gone by. But any currently queued work doesn't
+ * need to wait. Flush the batch now, so it can happen sooner.
+ */
iris_batch_flush(batch);
+
iris_batch_add_syncobj(batch, fine->syncobj, I915_EXEC_FENCE_WAIT);
}
}