+ /* Unflushed fences from the same context are no-ops. */
+ if (ctx && ctx == fence->unflushed_ctx)
+ return;
+
+ /* XXX: We can't safely flush the other context, because it might be
+ * bound to another thread, and poking at its internals wouldn't
+ * be safe. In the future we should use MI_SEMAPHORE_WAIT and
+ * block until the other job has been submitted, relying on
+ * kernel timeslicing to preempt us until the other job is
+ * actually flushed and the seqno finally passes.
+ */
+ if (fence->unflushed_ctx) {
+ pipe_debug_message(&ice->dbg, CONFORMANCE, "%s",
+ "glWaitSync on unflushed fence from another context "
+ "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.
+ */