Blame SOURCES/0001-iris-implement-inter-context-busy-tracking.patch

5fdbd9
From 07dc3d4238e57901ccf98e0b506d9aad2c86b9d9 Mon Sep 17 00:00:00 2001
5fdbd9
From: Paulo Zanoni <paulo.r.zanoni@intel.com>
5fdbd9
Date: Mon, 10 Jan 2022 17:18:05 -0800
5fdbd9
Subject: [PATCH] iris: implement inter-context busy-tracking
5fdbd9
5fdbd9
Previously, no buffers were ever marked as EXEC_OBJECT_ASYNC so the
5fdbd9
Kernel would ensure dependency tracking for us. After we implemented
5fdbd9
explicit busy tracking in commit 89a34cb8450a, only the external
5fdbd9
objects kept relying on the Kernel's implicit tracking and Iris did
5fdbd9
inter-batch busy tracking, meaning we lost inter-screen and
5fdbd9
inter-context synchronization. This seemed fine to me since, as far as
5fdbd9
I understood, it is the duty of the application to synchronize itself
5fdbd9
against multiple screens and contexts.
5fdbd9
5fdbd9
The problem here is that applications were actually relying on the old
5fdbd9
behavior where the Kernel guarantees synchronization, so 89a34cb8450a
5fdbd9
can be seen as a regression. This commit addresses the inter-context
5fdbd9
synchronization case.
5fdbd9
5fdbd9
Cc: mesa-stable
5fdbd9
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/5731
5fdbd9
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/5812
5fdbd9
Fixes: 89a34cb8450a ("iris: switch to explicit busy tracking")
5fdbd9
Tested-by: Konstantin Kharlamov <hi-angel@yandex.ru>
5fdbd9
Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
5fdbd9
---
5fdbd9
 src/gallium/drivers/iris/iris_batch.c | 8 ++++++++
5fdbd9
 1 file changed, 8 insertions(+)
5fdbd9
5fdbd9
diff --git a/src/gallium/drivers/iris/iris_batch.c b/src/gallium/drivers/iris/iris_batch.c
5fdbd9
index b7bde60aae7..1b0c5896d4f 100644
5fdbd9
--- a/src/gallium/drivers/iris/iris_batch.c
5fdbd9
+++ b/src/gallium/drivers/iris/iris_batch.c
5fdbd9
@@ -835,6 +835,12 @@ update_bo_syncobjs(struct iris_batch *batch, struct iris_bo *bo, bool write)
5fdbd9
       move_syncobj_to_batch(batch, &deps->write_syncobjs[other_batch_idx],
5fdbd9
                             I915_EXEC_FENCE_WAIT);
5fdbd9
 
5fdbd9
+   /* If it's being written by our screen, wait on it too. This is relevant
5fdbd9
+    * when there are multiple contexts on the same screen. */
5fdbd9
+   if (deps->write_syncobjs[batch_idx])
5fdbd9
+      move_syncobj_to_batch(batch, &deps->write_syncobjs[batch_idx],
5fdbd9
+                            I915_EXEC_FENCE_WAIT);
5fdbd9
+
5fdbd9
    struct iris_syncobj *batch_syncobj = iris_batch_get_signal_syncobj(batch);
5fdbd9
 
5fdbd9
    if (write) {
5fdbd9
@@ -847,6 +853,8 @@ update_bo_syncobjs(struct iris_batch *batch, struct iris_bo *bo, bool write)
5fdbd9
 
5fdbd9
       move_syncobj_to_batch(batch, &deps->read_syncobjs[other_batch_idx],
5fdbd9
                            I915_EXEC_FENCE_WAIT);
5fdbd9
+      move_syncobj_to_batch(batch, &deps->read_syncobjs[batch_idx],
5fdbd9
+                           I915_EXEC_FENCE_WAIT);
5fdbd9
 
5fdbd9
    } else {
5fdbd9
       /* If we're reading, replace the other read from our batch index. */
5fdbd9
-- 
5fdbd9
GitLab
5fdbd9