2

An X11 Apologist Tries Wayland (artemis.sh)

 2 years ago
source link: https://lwn.net/Articles/908561/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

An X11 Apologist Tries Wayland (artemis.sh) [LWN.net]

Open Source JobHub: Find your place in the open source ecosystem
User: Password: | |

An X11 Apologist Tries Wayland (artemis.sh)

[Posted September 19, 2022 by corbet]
The artemis.sh blog has a detailed review of the state of Wayland compared to X.org.
It feels fantastic. It even made my software cursor not feel so softwarey, which I’ve never experienced with a software cursor before. I have a pretty bad GPU, but on a higher end card you’d get a huge benefit to this in games. If your card can render the game many times faster than your monitor refresh rate, you can unlock your FPS in the game, tune your max_render_time to the absolute minimum, and get EXTREMELY low latency while still having absolutely no screen tearing whatsoever.

And like, this is the first time I’ve ever seen the vsync setting in a game actually sync the game up with the vblank interval in a way that matters. It works for games in wine. It’s amazing. I have never experienced gaming on Linux that looked this smooth in my life.


(Log in to post comments)

An X11 Apologist Tries Wayland (artemis.sh)

Posted Sep 19, 2022 7:13 UTC (Mon) by rsidd (subscriber, #2582) [Link]

Having done the i3→sway move about a year ago, I fully agree. I too was reluctant to abandon x11 but it seemed clear that the move will be needed one day, and to my surprise there were really no showstoppers and a lot of things worked better than on i3/x11.

I posted about my experience here. The updates to that are: 1. screen-mirroring to external display (eg projector) works great with "wl-mirror", better than actual mirroring since it works with your laptop resolution regardless of resolution of the external display. 2. reportedly zoom client screensharing works now, but I haven't tried it, I use firefox for zoom and screensharing (full screen only) is flawless.

And, lastly, it's great that wlroots seems to be becoming a standard for non-GNOME non-KDE desktops. It appears that xfce and others are eyeing it too. Of note, Simon Ser "emersion" is the maintainer of sway and a maintainer of both wlroots and wayland itself. So it all looks in good hands.

An X11 Apologist Tries Wayland (artemis.sh)

Posted Sep 19, 2022 7:47 UTC (Mon) by WolfWings (subscriber, #56790) [Link]

Yeah the instant it works reliably without mucking about with 3000-series nvidia chipsets I'm looking forward to jumping ship to Sway as well on my primary machine. But being on a laptop I can't exactly just switch cards. :P

Hopefully the nouveau driver can integrate all the good bits from the knowledge the open-sourced NVidia chunks allow for over the near year, so 2023 or 2024 I'll be able to make the leap, especially having played with Wayland stuff more on the Steam Deck now.

An X11 Apologist Tries Wayland (artemis.sh)

Posted Sep 19, 2022 7:53 UTC (Mon) by rsidd (subscriber, #2582) [Link]

It works fine with an nvidia quadro T1000 on my work desktop. But screensharing doesn't work (which is ok, I only do video calls from my laptop).

An X11 Apologist Tries Wayland (artemis.sh)

Posted Sep 19, 2022 16:45 UTC (Mon) by mpr22 (subscriber, #60784) [Link]

A Quadro T1000 is effectively a 16-series, not a 30-series.

An X11 Apologist Tries Wayland (artemis.sh)

Posted Sep 19, 2022 9:03 UTC (Mon) by taladar (subscriber, #68407) [Link]

The problem with Wayland from a power user perspective is that it requires extremely high up-front buy-in before you can even really tell if it will work for all my use-cases.

I have a xmonad config (e.g. force certain layouts for certain programs, put each program on the named workspace where it belongs,...) and various small shell scripts (e.g. screen locking on inactivity but don't if videos are playing, screenshots with automatic naming by date, screenshots of QR-Codes for OATH 2FA, various copy&paste related stuff,...) that I would all have to replace to move to Wayland.

Meanwhile wayland libraries on Rust, my current preferred program language appear to be pretty much dead (e.g. wlroots bindings last updated in 2019) and every time I look into Wayland I find various things that are supposed to not work yet (e.g. screen sharing in at least one if not multiple of the video conferencing systems I need for work).

I am highly sceptical of these 'works for me' type of posts written shortly after someone switches or while someone temporarily tries Wayland (meaning they haven't encountered their own rarer use-cases yet). I believe that it works for 80% of use-cases but why would I invest lots of work to go from a system that works fine for 100% of my use-cases to one that only works for 80% and for benefits like the ones mentioned in this article I really, really don't care about like low latency gaming (all my gaming works fine on X11 and if anything it seems some games that work on X11 won't work at all on Wayland judging by steam forums)?

Not to mention that I consider the whole compositor concept highly flawed for anyone who, like me, doesn't care about flashy windowing effects like transparency. Why burden everyone who just wants to manage their windows with implementing that separately?

An X11 Apologist Tries Wayland (artemis.sh)

Posted Sep 19, 2022 9:31 UTC (Mon) by rsidd (subscriber, #2582) [Link]

About wlroots-rs, it looks like Simon Ser (sway lead, wlroots and wayland maintainer) has just revived it. However, it's early days.

There's also smithay for rust users, which apparently is being used by system76 for an upcoming wayland DE+compositor.

But if you're an xmonad power user, wayland is not for you, unless you want to work on a replacement (there was waymonad but it seems to be dead).

An X11 Apologist Tries Wayland (artemis.sh)

Posted Sep 19, 2022 9:43 UTC (Mon) by gspr (subscriber, #91542) [Link]

> (e.g. screen sharing in at least one if not multiple of the video conferencing systems I need for work).

Back when I had trouble getting this to work reliably (it works fine for me now, I think WirePlumber/Pipewire is playing a role behind the scenes?), a workaround I used was to temporarily run the screensharing stuff under XWayland. IIRC, this made the sharing software completely oblivious to anything except other X windows, but that was good enough as a workaround.

An X11 Apologist Tries Wayland (artemis.sh)

Posted Sep 19, 2022 10:16 UTC (Mon) by q3cpma (subscriber, #120859) [Link]

Yeah, same here, I've had to make a prospective list before deciding the switch is too painful for now:
* bspwm: https://github.com/riverwm/river + https://github.com/jonbkei/riverbsp ?
* sxhkd: https://github.com/waycrate/swhkd until there's a dedicated protocol (https://gitlab.freedesktop.org/wayland/wayland-protocols/...)
* dmenu: nothing as light, as expected from Wayland, but https://github.com/Cloudef/bemenu or https://codeberg.org/dnkl/fuzzel is probably the best choice
* lemonbar: no replacement that is as hacker-friendly, https://codeberg.org/dnkl/yambar is the only one that doesn't depend on GTK; probably my biggest gripe
* st: https://github.com/michaelforney/st and https://github.com/majestrate/wterm are dead (so is wld), the only sane and "light" choice is https://codeberg.org/dnkl/foot/; otherwise it's all "GPU-accelerated" Rust contraptions with Node-tier dependency trees, VTE stuff or Kitty made by a someone who refuses patches to allow bitmap fonts
* sxiv: imv is better designed, but FreeImage is a dumpster fire that's also a security disaster just waiting to happen and imv lacks too much format support without it (e.g. Webp, netpbm, TGA, etc...); I may write more backends if I get the time, one day (heh)
* mupdf: Zathura as a mupdf frontend works, but I'd prefer pure mupdf, personally
* emacs: forced to use the GTK frontend instead of the perfect and lightweight athena/Xaw one
* Nyxt: I think it's okay, since it uses webkit-gtk-2
* Tk, McCLIM and countless other tookits away from the GTK/Qt hegemony: dead

Some other websites I found very useful about this:
https://arewewaylandyet.com/
https://hacktivis.me/notes/pure-wayland.shtml

An X11 Apologist Tries Wayland (artemis.sh)

Posted Sep 19, 2022 10:42 UTC (Mon) by rsidd (subscriber, #2582) [Link]

Any x11 application should work fine under xwayland, including mupdf, the athena version of emacs, your favourite x11 terminal, tk-based programs, etc.

An X11 Apologist Tries Wayland (artemis.sh)

Posted Sep 19, 2022 11:23 UTC (Mon) by nix (subscriber, #2304) [Link]

otherwise it's all "GPU-accelerated" Rust contraptions with Node-tier dependency trees, VTE stuff or Kitty made by a someone who refuses patches to allow bitmap fonts
Presumably the latter part is code for "only uses Fontconfig, and recent Fontconfig has dropped bitmap font support"? It turns out... it hasn't! What has actually happened is that support for Type 1 and X bitmap fonts is gone (which is very annoying if like me you have a huge library of them), but OpenType can represent bitmap fonts fine and everything can still render those, and FontForge can convert the former into the latter. There just aren't many of them yet. I should try making an OTF wrapping jmk-neep one of these days, because many of these newer terminals are seriously amazing to use.

Most of them have hotkey-driven tabbing and splitting (a la terminator), large-scale layout restoration (just what you need if like me you have a dozen terminals you want instantiated on different virtual desktops every time you start up); all the VTE ones at least have infinite-length scrollback (via a compressed, encrypted, unlinked file in /tmp, so it's pretty safe from info leakage as these things go), and the GPU-acceleration means screen refresh even on high-res displays is instantaneous and it scrolls in an unreadable flashing blur, which is surely what everyone really needs from a terminal emulator? (What do you mean you can't read a screen that's only displayed for 7ms?). And most of them have (unlike in days of yore) actually paid attention to the specs and (more importantly) what xterm does, and tried to implement a terminal that doesn't get things gratuitously wrong.

An X11 Apologist Tries Wayland (artemis.sh)

Posted Sep 19, 2022 11:34 UTC (Mon) by q3cpma (subscriber, #120859) [Link]

>Presumably the latter part is code for "only uses Fontconfig, and recent Fontconfig has dropped bitmap font support"
No, it rejects font with the scalable property.
cf https://github.com/kovidgoyal/kitty/issues/97#issuecommen...

>Most of them have hotkey-driven tabbing...
I'm a suckless kind of guy, I like simple code and clean separation of roles (e.g. don't include tmux in your terminal emulator). I did use the word "contraption", after all; "usine à gaz" in french also fits.

An X11 Apologist Tries Wayland (artemis.sh)

Posted Sep 19, 2022 17:33 UTC (Mon) by Cyberax (✭ supporter ✭, #52523) [Link]

> e.g. don't include tmux in your terminal emulator

How would you implement true scrollback in tmux without terminal-level support?

An X11 Apologist Tries Wayland (artemis.sh)

Posted Sep 19, 2022 17:53 UTC (Mon) by nyanpasu64 (subscriber, #135579) [Link]

It would be cool to have "tmux as an API" that allows me to open one SSH connection to a server, send multiple virtual terminals of data through SSH over a semantic protocol (rather than as presentational VT100 control codes), and display them in a tiling GUI with console-native mouse-based selections constrained within one column of the screen, and pixel-precise scrollbars (neither of which is possible in tmux to my knowledge).

An X11 Apologist Tries Wayland (artemis.sh)

Posted Sep 19, 2022 21:07 UTC (Mon) by erincandescent (subscriber, #141058) [Link]

SSH already has a feature enabling connection reuse. Add something like
Host *
  ControlMaster auto
  ControlPath ~/.ssh/master-%r@%n:%p
  ControlPersist 1m

to your ~/.ssh/config

Tk backend for Wayland

Posted Sep 19, 2022 15:08 UTC (Mon) by stephen.pollei (subscriber, #125364) [Link]

Tk has backend for windows, mac, and X11. Seems like they could add a native Wayland backend as well. Likely a bit of work to be sure.

Tk backend for Wayland

Posted Sep 19, 2022 21:24 UTC (Mon) by dskoll (subscriber, #1630) [Link]

The last time I looked (which admittedly was a very long time ago) Tk's Windows back-end implemented compatibility code that made it "look like" Xlib calls to the rest of Tk. I guess this solution could work with Wayland too, and probably wouldn't require a ton of code.

An X11 Apologist Tries Wayland (artemis.sh)

Posted Sep 19, 2022 16:54 UTC (Mon) by anarcat (subscriber, #66354) [Link]

* sxiv: imv is better designed, but FreeImage is a dumpster fire that's also a security disaster just waiting to happen and imv lacks too much format support without it (e.g. Webp, netpbm, TGA, etc...); I may write more backends if I get the time, one day (heh)

Could you expand on this? It feels like *all* image renderers (hello libpng and image magick!) are kind of dumpster fires, security wise... but is FreeImage specifically bad in that regard?

Asking for a friend looking for wayland alternatives... ;)

An X11 Apologist Tries Wayland (artemis.sh)

Posted Sep 19, 2022 15:18 UTC (Mon) by flussence (subscriber, #85566) [Link]

> The problem with Wayland from a power user perspective is that it requires extremely high up-front buy-in before you can even really tell if it will work for all my use-cases.

It's been a complete non-starter for me for more basic reasons. I start X as a runit service and hand off the cookie file to the user-level session in a separate process tree. The server runs as root out of necessity, but there's no suid invocations, no privilege elevation, and no rube goldberg chicken-sacrificing rituals.

To do something equivalent in Wayland land I'd need to A) label all keyboard/pointer devices in udev so the unprivileged user can snoop them directly (!), and B) either run the desktop god-process as root (no) or with raised capabilities to grab a VT without root (from what scant documentation I can find, exactly which caps are needed varies _by DRI driver_ and nobody will utter a straight answer).

The fundamentals don't work after 40 years, and the official line is that you have to paper over the cracks with load-bearing wallpaper (pam, javascript and logind). You can't accelerate out of a car crash, and I'm not getting in that passenger seat.

An X11 Apologist Tries Wayland (artemis.sh)

Posted Sep 19, 2022 17:46 UTC (Mon) by Cyberax (✭ supporter ✭, #52523) [Link]

> To do something equivalent in Wayland land I'd need to A) label all keyboard/pointer devices in udev so the unprivileged user can snoop them directly

Uhm... You do realize that X applications can do that using the very X11 protocol without any extra permissions?

You are also incorrect in that you can snoop HID devices from an unrelated process. Wayland should use EVIOCGRAB ioctl to exclusively bind devices to one session (via `open_restricted` in libinput).

If you want to be even more secure, you can segregate device opening into a separate context and just pass FDs from this context. A small on-demand service activated via systemd would work nicely.

An X11 Apologist Tries Wayland (artemis.sh)

Posted Sep 19, 2022 9:25 UTC (Mon) by atai (subscriber, #10977) [Link]

Can something like xpra be done without X11?

An X11 Apologist Tries Wayland (artemis.sh)

Posted Sep 19, 2022 9:48 UTC (Mon) by gspr (subscriber, #91542) [Link]

I believe this should be doable with Waypipe's [1] `--control` and `recon` functionality. I haven't tried those options in particular, but Waypipe in general is working well for me, and the man page seems promising regarding what you want [2].

[1] https://gitlab.freedesktop.org/mstoeckl/waypipe/

[2] https://manpages.debian.org/unstable/waypipe/waypipe.1.en...

An X11 Apologist Tries Wayland (artemis.sh)

Posted Sep 19, 2022 16:12 UTC (Mon) by njs (guest, #40338) [Link]

Xpra's "just" an X11 window manager and composite manager, and Wayland compositors have all the same powers, so there's no architectural obstacle. Someone would have to implement it of course. Might be a fun project to build on wlroots.

An X11 Apologist Tries Wayland (artemis.sh)

Posted Sep 19, 2022 14:52 UTC (Mon) by NightMonkey (subscriber, #23051) [Link]

Very nice tale from the field. :)

I'm going to miss network-traversing X apps. It still feels magical to me to be able to run an X application on one host and have its window show up on another. And it can be practical, as well (like when I need to run Pulseaudio preference apps from a headless Raspberry Pi on my laptop).

Last I asked, this will never be possible in Wayland. :(

An X11 Apologist Tries Wayland (artemis.sh)

Posted Sep 19, 2022 15:46 UTC (Mon) by pothos (subscriber, #116075) [Link]

It's possible with waypipe, as others here have mentioned: https://lwn.net/Articles/908576/

An X11 Apologist Tries Wayland (artemis.sh)

Posted Sep 19, 2022 21:05 UTC (Mon) by lamikr (guest, #2289) [Link]

I am interested in learning how to exactly do this. Let's assume that I am running Wayland on 2 computers, how I can show the gnome-calc or mozilla display running on computer 1 on computer 2? What I need to install what commands I exactly need to run?

An X11 Apologist Tries Wayland (artemis.sh)

Posted Sep 19, 2022 16:28 UTC (Mon) by Wol (subscriber, #4433) [Link]

> Last I asked, this will never be possible in Wayland. :(

It's ALWAYS been possible in Wayland. As always, I suspect the new-technology-haters have been spreading their lack of knowledge.

The answer I always got was "it's possible but no one can be bothered to scratch that itch". I'm glad it appears someone finally has.

(Wayland is a *protocol* - alll you need do is pipe it across the network!)

Cheers,
Wol

An X11 Apologist Tries Wayland (artemis.sh)

Posted Sep 19, 2022 17:22 UTC (Mon) by syrjala (subscriber, #47399) [Link]

Unlike X11 Wayland protocol doesn't carry image data, so you do need a bit more than just to pipe the protocol through a network. I suppose waypipe has added some extra network protocol on top to transport image data as well.

An X11 Apologist Tries Wayland (artemis.sh)

Posted Sep 19, 2022 17:41 UTC (Mon) by atnot (subscriber, #124910) [Link]

X11 hasn't carried image data for at least a decade either. The performance cost of that would be prohibitive for anything rendered with the GPU, which is almost everything these days. So unless you're exclusively using xterm and other ancient programs, Xorg is going to be shuffling around handles to GPU memory which will need to be captured into a video stream and sent across the network, just like on Wayland.

An X11 Apologist Tries Wayland (artemis.sh)

Posted Sep 19, 2022 17:41 UTC (Mon) by Wol (subscriber, #4433) [Link]

???

The compositor is told what to display. How on earth does your LOCAL compositor know what to display, if the protocol doesn't tell it?

And if the protocol can tell it to display an image, it surely can tell it *what* image to display, and then surely (if it's not done by default!) it's precious little effort to inline that image.

(I understand one of the design aims of Wayland, was to be ABLE to do everything X can, other than those things that are forbidden by the Wayland security model (you know, those things that X can do to compromise a system because it always had to run as root ...)

Cheers,
Wol

An X11 Apologist Tries Wayland (artemis.sh)

Posted Sep 19, 2022 21:38 UTC (Mon) by dullfire (subscriber, #111432) [Link]

> The compositor is told what to display. How on earth does your LOCAL compositor know what to display, if the protocol doesn't tell it?

I suggest reading the core wayland protocol. It's very short.

However, in brief, wayland handles negotiating fd's for mmap-ing or other side-band IPC for display payload transfer. It's very much does NOT do in-band image transfer. This can sort-of be worked around with a proxy... but that proxy has to understand every supported buffer mechanism (I know of 2 buffer types off the top of my head, but only shared temp fds, think memfd, is in specified in-protocol. The other I know of uses DRI buffers... forgot it's name).

An X11 Apologist Tries Wayland (artemis.sh)

Posted Sep 19, 2022 17:42 UTC (Mon) by nyanpasu64 (subscriber, #135579) [Link]

I'm disappointed but not surprised to see that Artemis is optimizing for cursor latency but not audio latency. Neglecting audio latency seems to be the norm rather than the outlier in most latency-sensitive areas outside of professional audio.

For example, bsnes, higan, bsnes-plus, etc. only allow adjusting PulseAudio audio latency in intervals of 20ms, and the minimum of 20ms feels acceptable but not instant on pipewire-pulse. RetroArch on PulseAudio/PipeWire, using the ALSA or PulseAudio backends, cannot achieve stable latency below 2-3 video frames, and its JACK backend is disabled on Flatpak and Arch Linux packages (and manually rebuilding with it enabled reveals it's no better than ALSA/Pulse at achieving single-digit ms latency). This is shocking considering it goes to extreme lengths to reduce video latency (frame delay much like Sway's max_render_time but now with automated tuning, runahead literally time-traveling the emulator to skip past games' built-in input delay, even a dedicated CRT SwitchRes mode for the obscure practice of running HDMI ports at super-resolutions like 2560x240 and feeding through a HDMI to component converter to plug into a CRT, to shave precious milliseconds of latency and achieve a more authentic image). And playing Stray on Bottles has a noticeable delay of sound behind video, even *with* Bottles's option to *reduce* (?!) PulseAudio latency to 40 ms checked.

As for solutions, PipeWire comes with deterministic low audio latency (because it's a pull-mode synchronized API to PulseAudio's push-mode buffered API), much the same way the author is trying to tune Wayland's compositing timing behavior. And it supports audio mixing (unlike ALSA) and supports ALSA/PulseAudio apps (unlike jackd), though PipeWire cannot add deterministic low latency behavior to PulseAudio apps, or ALSA apps (I do believe this is solvable with some buffering trickery, but I don't understand PipeWire's client API and proper implementations like pipewire-jack or SDL well enough to do so).

An X11 Apologist Tries Wayland (artemis.sh)

Posted Sep 19, 2022 21:17 UTC (Mon) by Wol (subscriber, #4433) [Link]

> I'm disappointed but not surprised to see that Artemis is optimizing for cursor latency but not audio latency. Neglecting audio latency seems to be the norm rather than the outlier in most latency-sensitive areas outside of professional audio.

The problem is that most audio is playback. Latency is irrelevant, what matters is stutter.

Yes, professional audio, latency is vital, but how often do you need a computer audio stream to merge with an analogue data stream? That is, sadly, a minority use case.

So long as the buffer doesn't run out, 99% of applications couldn't give a monkeys about latency. :-(

Cheers,
Wol

An X11 Apologist Tries Wayland (artemis.sh)

Posted Sep 19, 2022 22:07 UTC (Mon) by nyanpasu64 (subscriber, #135579) [Link]

The unfortunate part is, even interactive audio apps like games, and *operating systems* like Android before AAudio, often don't succeed at minimizing latency (not sure if voice calls are good at mitigating latency, or if network latency drowns out local audio latency). Though I'm guessing Artemis isn't doing much of gaming or voice calls on an 800 MHz CPU (even though without the overhead of a browser, 800 MHz ought to be more than enough for voice codecs, network transmission, and possibly even encryption).

An X11 Apologist Tries Wayland (artemis.sh)

Posted Sep 19, 2022 22:27 UTC (Mon) by WhatsInAName (guest, #128037) [Link]

I am an end user. I do not give a damn about the low-level technical details of the display infrastructure. In this light, I couldn't care less whether it called Wayland, X, Santa Claus or Display Infrastructure Are Us. I just want for it to work properly. In this light, I will move to Wayland the day it can do at least everything that X does, at least as efficiently, at least as painlessly and transparently for me, and with exactly the same desktop setup that I currently have. Not a day sooner. Till then, it is X for me.

Copyright © 2022, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK