[xwayland] Explicit sync causing constant black screen with UNIGINE Superposition demo
I am testing Xwayland 24.1.0 RC locally with the NVIDIA driver and explicit sync support breaks pretty badly with the UNIGINE Superposition demo here.
Basically, it gives a constant black screen, I uploaded a video that I captured with my phone, this is not some small glitches: https://youtu.be/xX_Q1eyugxM
This is with NVIDIA driver version 550.76 on Fedora 40 (i.e. mutter-46.1 with explicit sync support enabled) and an NVIDIA GPU Quadro RTX 3000 Mobile / Max-Q (TU106GLM)
I bisected the issue to that particular commit (expected):
d411a8b611aab57b2ac068928ddc09bef2b2a097 is the first bad commit
commit d411a8b611aab57b2ac068928ddc09bef2b2a097
Author: Xaver Hugl <xaver.hugl@kde.org>
Date: Mon Mar 4 17:15:13 2024 +0100
xwayland: add workaround for drivers that don't support impicit sync
Without either implicit or explicit synchronization, the result of rendering is
pretty much undefined, and many glitches can appear. This still doesn't synchronize
buffer release, but it works around most glitches until explicit sync is supported.
Signed-off-by: Xaver Hugl <xaver.hugl@kde.org>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/967>
hw/xwayland/xwayland-present.c | 5 ++++-
hw/xwayland/xwayland-window-buffers.c | 9 +++++++++
2 files changed, 13 insertions(+), 1 deletion(-)
I understand this is a synchronization issue and the whole explicit sync mechanism will really work only when the driver itself will support it, but that raises some concerns for backward compatibility with the older NVIDIA drivers, because such issues might be perceived as a major regression.
Yet, fun fact is, removing the call to glamor_finish()
in the current master branch does not fix the issue:
diff --git a/hw/xwayland/xwayland-window-buffers.c b/hw/xwayland/xwayland-window-buffers.c
index 2e8b0859c..ce619b4c4 100644
--- a/hw/xwayland/xwayland-window-buffers.c
+++ b/hw/xwayland/xwayland-window-buffers.c
@@ -488,12 +488,7 @@ xwl_window_swap_pixmap(struct xwl_window *xwl_window)
xwl_window_buffer->syncobj->submitted_eventfd(xwl_window_buffer->syncobj,
xwl_window_buffer->timeline_point,
xwl_window_buffer->efd);
- } else
- /* If glamor does not support implicit sync and we can't use
- * explicit sync, wait for the GPU to be idle before presenting.
- * Note that buffer re-use will still be unsynchronized :(
- */
- glamor_finish(xwl_screen->screen);
+ }
}
#endif /* XWL_HAS_GLAMOR */