Score:1

Add -eglstream to Xwayland

sm flag

I am trying to get a Wayland session running with as few bugs as possible using the nvidia proprietary drivers (I am aware this is a tall order). Things seem to be working mostly perfectly for me, with the exception of apps running in Xwayland. In particular, these apps stutter / display previously rendered frames (particularly when typing). This is a known bug, and tracked at https://gitlab.freedesktop.org/xorg/xserver/-/issues/1317.

For chromium apps, I have noticed that adding --use-gl=egl as a command line argument nearly completely fixes this issue. However, not all Xwayland apps support this argument, so I cannot simply add it to everything that causes problems.

From the help page for Xwayland, I learned about the option -eglstream, which encourages Xwayland to "use eglstream backend for nvidia GPUs". This sounds like exactly what I want. My problem is that I have not found any way to pass the -eglstream argument to the default Xwayland instance used on the wayland session of Gnome.

Immediately after a fresh login, ps aux | grep Xwayland shows that Xwayland is not running yet. If I then start an app that runs through Xwayland, I see a process:

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

The parent process ID points towards gnome-shell, leading me to believe that this is what is responsible for auto-starting Xwayland.

If I try to run my own Xwayland instance with the new arg, I get the following:

$ /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)

I get the same output whether I run the above command before Xwayland has been autostarted (i.e. just after a fresh login, before running any apps) or after, with the other instance already running.

Is there a way to configure gnome-shell to add the argument I want? Or perhaps to replace a running instance of Xwayland?

Specs:

  • Ubuntu 22.04.2
  • NVIDIA RTX 3050 using the nvidia-driver-530-open drivers
Score:0
sm flag

I was wrong before, it is not gnome-shell that autostarts Xwayland, but rather mutter. I was able to add the -eglstream argument by patching the source and compiling myself. To do this, I followed the script at https://github.com/yilozt/mutter-rounded/blob/main/ubuntu/package.sh (instead of applying the patches in the repo, I just manually edited the file).

It did stop the flickering, but at a very steep performance cost. The effect was almost identical to setting XWAYLAND_NO_GLAMOR or MUTTER_DEBUG_FORCE_EGL_STREAM=1 as recommended by https://gitlab.freedesktop.org/xorg/xserver/-/issues/1317. I suspect the latter of these two may even be doing exactly the same thing.

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.