4 ms·
TL;DR: make sure you have pipewire and xdg-desktop-portal installed, look up how to enable pipewire for your browser. It might help. Well, this blog post barel
by MayeulC 7y ago
TL;DR: make sure you have pipewire and xdg-desktop-portal installed, look up how to enable pipewire for your browser. It might help.
Well, this blog post barely scratches the surface.
The Linux userspace display stack is currently undergoing a big overhaul, following the changes that happened in the kernel a few years ago (DRI3, KMS, atomic modesetting, etc).
All of this made Wayland possible. That, plus the fact that apps rasterize their surfaces themselves nowadays (GPU-accelerated trough OpenGL/Vulkan).
So, here comes Wayland with a new security model: you can't spy on other windows, so you cannot hack together a desktop sharing solution. A proper, cross-desktop solution is actually being worked on: pipewire[1].
Pipewire aims to replace both pulseaudio and jack for audio, and bring video in as well. So you will be able to direct which video feed goes where, use the same webcam for multiple applications, and have applications take a video feed, transform it, and plug it elsewhere. You can see where this is fitting with desktop sharing: one feed per window, one feed per screen, one feed for the whole desktop, plus variants. Want to overlay a webcam? No problem. Everything is backed by Gstreamer for realtime hardware-accelerated video encoding/decoding.
And the icing on the cake: Flatpak spearheaded the development of "portals"[2]: cross-desktop interfaces for individual programs to ask the user when accessing restricted resources (like a microphone, or a folder on your computer).
So, what's needed here is:
* Finish up pipewire and have it shipped on most distributions (should be installed in fedora 31, optional for sound in 32, default for sound in 33)
* Have compositors talk to pipewire [3]
* Have browsers and other software talk to pipewire [4]
* ???
* Profit
Good progress is being made on these points, except maybe the last? I expect support to start working out-of-the-box in some distros/browser/compositor combinations in 2020. Actually, support seems further along than I thought it was. But it seems that wlroots-based compositor haven't yet decided to support the xdg screensharing portal, and rely instead on a custom wayland extension. I wouldn't be surprised if such a portal is implemented for those.
The main issue here is everyone waiting on everyone else before enabling/implementing it. But it looks like we're 80% there, and it just needs to be enabled in some cases (and pipewire installed). Then it will trickle down to most distros and electrons apps.
However, I don't think legacy X apps will be able to continue sharing the desktop (they can still be shared by wayland capture programs, or capture the desktop if they implement the new interface). I guess pipewire might be able to create a virtual webcam for these, though.
Valve might be working on their own stack with their "Gamescope" wayland compositor[5], for their streaming solution.
And in the end, this should work much better, with hardware encoding, actual security, zero copy, etc. Hopefully there won't be a "next big thing" that breaks everything in just a few years.
[1] https://pipewire.org/ https://pipewire.org/
[1] https://wiki.archlinux.org/index.php/PipeWire https://wiki.archlinux.org/index.php/PipeWire
[2] https://flatpak.github.io/xdg-desktop-portal/portal-docs.html https://flatpak.github.io/xdg-desktop-portal/portal-docs.htm...
[2] https://flatpak.github.io/xdg-desktop-portal/portal-docs.html#gdbus-org.freedesktop.portal.ScreenCast https://flatpak.github.io/xdg-desktop-portal/portal-docs.htm...
[3] http://jgrulich.cz/2018/03/06/screen-sharing-in-plasma-wayland-session/ http://jgrulich.cz/2018/03/06/screen-sharing-in-plasma-wayla...
[3] https://jgrulich.cz/2018/07/04/how-to-enable-and-use-screen-sharing-on-wayland/ https://jgrulich.cz/2018/07/04/how-to-enable-and-use-screen-...
[3] https://wiki.gnome.org/Projects/Mutter/RemoteDesktop https://wiki.gnome.org/Projects/Mutter/RemoteDesktop
[3] https://www.reddit.com/r/linux/comments/8le7rm/first_steps_for_kde_screencast_on_wayland/dzfqftz/?context=8&depth=9 https://www.reddit.com/r/linux/comments/8le7rm/first_steps_f...
[3] https://github.com/emersion/xdg-desktop-portal-wlr/issues/1 https://github.com/emersion/xdg-desktop-portal-wlr/issues/1
[4] https://bugzilla.mozilla.org/show_bug.cgi?id=1496359 https://bugzilla.mozilla.org/show_bug.cgi?id=1496359 (looks disabled by default at compile time)
[4] https://bugs.chromium.org/p/chromium/issues/detail?id=682122 https://bugs.chromium.org/p/chromium/issues/detail?id=682122 (pipewire disabled in chrome://flags until v81 due to waiting on https://github.com/flatpak/xdg-desktop-portal-gtk/issues/204 https://github.com/flatpak/xdg-desktop-portal-gtk/issues/204 "dialog hell" it seems)
[4] zoom currently uses a gnome-specific screenshot API as a workaround: https://www.reddit.com/r/swaywm/comments/dr8yld/zoom_screenshare_via_screenshot_emulation/f6gfzds/ https://www.reddit.com/r/swaywm/comments/dr8yld/zoom_screens...
[5] https://www.gamingonlinux.com/articles/valve-give-a-little-more-info-on-what-gamescope-actually-does-for-linux-gaming.15783/ https://www.gamingonlinux.com/articles/valve-give-a-little-m...
- AnIdiotOnTheNet 7y agoYou speak as though Wayland is some super new bleeding-edge tech that just needs some time to come around, but the reality is that it is over 10 years old and still people revert to X11 to get things done because of its issues. Compared to when Windows overhauled its entire display server, network, and sound driver architecture back in Vista, Wayland's pace is downright glacial. I suppose one can expect it will be ready for prime time by 2030, just in time for the next paradigm to make it obsolete.
- MayeulC 7y agoThat's right. > still people revert to X11 to get things done To me, that's the reason right here: X11 still works. Microsoft has more control over its software (as you can't fork and maintain it if you don't like where it's going). If you want a more apt comparison, transitioning to Wayland is blazing fast compared to going to how long it takes for IPv6 to gain marketshare. Or for everyone to transition to electric vehicles. Once again, dynamics are different since the old tech still works. At least with Wayland, some advantages are immediately tangible compared to the IPv6 transition. A friend of mine would likely describe it as potential wells with some energy barriers (ecosystem not mature) to overcome :) Wayland has gained some momentum lately, in no small part thanks to sway. As a result, I feel the XDG initiative and cross-desktop coordination is stronger nowadays, so further evolutions of the Linux desktop could happen faster. In any case, I encourage you to give Wayland a go, and report/fix bugs :) I've been using sway as my daily driver for 2 years now; one of the rare things I have to fire up X11 for sometimes is Steam remote play or screen sharing.
- MayeulC 7y agoBTW, I just wrote a comment to this effect on this post, though I am not a fan of Discord: https://support.discordapp.com/hc/en-us/community/posts/360047644231-Native-Wayland-Support?page=1#community_comment_360009111291 https://support.discordapp.com/hc/en-us/community/posts/3600...