将 -eglstream 添加到 Xwayland

将 -eglstream 添加到 Xwayland

我正在尝试使用 nvidia 专有驱动程序尽可能少地运行 Wayland 会话(我知道这是一个艰巨的任务)。除了在 Xwayland 中运行的应用程序外,对我来说,一切似乎都运行正常。特别是,这些应用程序会卡顿/显示之前渲染的帧(特别是在打字时)。这是一个已知错误,并跟踪于https://gitlab.freedesktop.org/xorg/xserver/-/issues/1317

对于 Chromium 应用程序,我注意到将其添加--use-gl=egl为命令行参数几乎可以完全解决此问题。但是,并非所有 Xwayland 应用程序都支持此参数,因此我不能简单地将其添加到导致问题的所有应用程序中。

从 的帮助页面Xwayland,我了解到了 选项-eglstream,它鼓励 Xwayland “使用 eglstream 后端作为 nvidia GPU”。这听起来正是我想要的。我的问题是,我还没有找到任何方法将参数传递-eglstream给 Gnome 的 wayland 会话中使用的默认Xwayland实例。

重新登录后,立即ps aux | grep Xwayland显示Xwayland尚未运行。如果我启动一个通过运行的应用程序Xwayland,我会看到一个进程:

/usr/bin/Xwayland :1 -rootless -noreset -accessx -core -auth /run/user/1000/.mutter-Xwaylandauth.0GRD41 -listen 4 -listen 5 -displayfd 6 -initfd 7

父进程ID指向gnome-shell,这使我相信这就是负责自动启动的进程Xwayland

如果我尝试使用新的参数运行我自己的 Xwayland 实例,我会得到以下结果:

$ /usr/bin/Xwayland :1 -rootless -eglstream -noreset -accessx -core -auth /run/user/1000/.mutter-Xwaylandauth.0GRD41 -listen 4 -listen 5 -displayfd 6 -initfd 7
(WW) Option "-listen" for file descriptors is deprecated
Please use "-listenfd" instead.
(WW) Option "-listen" for file descriptors is deprecated
Please use "-listenfd" instead.
Failed to initialize glamor, falling back to sw
(EE) 
Fatal server error:
(EE) Cannot write display number to fd 6
(EE) 
Aborted (core dumped)

Xwayland无论我是在自动启动之前运行上述命令(即,在全新登录之后,运行任何应用程序之前),还是在另一个实例已经运行的情况下运行上述命令,我都会得到相同的输出。

有没有办法通过 configuregnome-shell添加我想要的参数?或者可以替换正在运行的实例Xwayland

眼镜:

  • Ubuntu 22.04.2
  • NVIDIA RTX 3050 使用nvidia-driver-530-open驱动程序

答案1

我之前错了,这不是gnome-shell自动启动Xwayland,而是mutter。我可以-eglstream通过修补来添加参数来源并自行编译。为此,我按照以下脚本进行操作:https://github.com/yilozt/mutter-rounded/blob/main/ubuntu/package.sh(我没有应用 repo 中的补丁,而是只是手动编辑了文件)。

它确实停止了闪烁,但性能成本非常高。效果几乎与设置XWAYLAND_NO_GLAMORMUTTER_DEBUG_FORCE_EGL_STREAM=1推荐的相同https://gitlab.freedesktop.org/xorg/xserver/-/issues/1317。我怀疑后者甚至可能在做同样的事情。

相关内容