Mesa (staging/21.3): iris: implement inter-context busy-tracking

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Feb 2 08:05:42 UTC 2022


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

Author: Paulo Zanoni <paulo.r.zanoni at intel.com>
Date:   Mon Jan 10 17:18:05 2022 -0800

iris: implement inter-context busy-tracking

Previously, no buffers were ever marked as EXEC_OBJECT_ASYNC so the
Kernel would ensure dependency tracking for us. After we implemented
explicit busy tracking in commit 89a34cb8450a, only the external
objects kept relying on the Kernel's implicit tracking and Iris did
inter-batch busy tracking, meaning we lost inter-screen and
inter-context synchronization. This seemed fine to me since, as far as
I understood, it is the duty of the application to synchronize itself
against multiple screens and contexts.

The problem here is that applications were actually relying on the old
behavior where the Kernel guarantees synchronization, so 89a34cb8450a
can be seen as a regression. This commit addresses the inter-context
synchronization case.

Cc: mesa-stable
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/5731
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/5812
Fixes: 89a34cb8450a ("iris: switch to explicit busy tracking")
Tested-by: Konstantin Kharlamov <hi-angel at yandex.ru>
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/14783>

---

 src/gallium/drivers/iris/iris_batch.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/src/gallium/drivers/iris/iris_batch.c b/src/gallium/drivers/iris/iris_batch.c
index ef0fa147d38..90103449bf1 100644
--- a/src/gallium/drivers/iris/iris_batch.c
+++ b/src/gallium/drivers/iris/iris_batch.c
@@ -717,6 +717,12 @@ update_bo_syncobjs(struct iris_batch *batch, struct iris_bo *bo, bool write)
       move_syncobj_to_batch(batch, &deps->write_syncobjs[other_batch_idx],
                             I915_EXEC_FENCE_WAIT);
 
+   /* If it's being written by our screen, wait on it too. This is relevant
+    * when there are multiple contexts on the same screen. */
+   if (deps->write_syncobjs[batch_idx])
+      move_syncobj_to_batch(batch, &deps->write_syncobjs[batch_idx],
+                            I915_EXEC_FENCE_WAIT);
+
    struct iris_syncobj *batch_syncobj = iris_batch_get_signal_syncobj(batch);
 
    if (write) {
@@ -729,6 +735,8 @@ update_bo_syncobjs(struct iris_batch *batch, struct iris_bo *bo, bool write)
 
       move_syncobj_to_batch(batch, &deps->read_syncobjs[other_batch_idx],
                            I915_EXEC_FENCE_WAIT);
+      move_syncobj_to_batch(batch, &deps->read_syncobjs[batch_idx],
+                           I915_EXEC_FENCE_WAIT);
 
    } else {
       /* If we're reading, replace the other read from our batch index. */



More information about the mesa-commit mailing list