Summary: | Screencast plugin fails if PipeWire is started after KWin | ||
---|---|---|---|
Product: | [Plasma] kwin | Reporter: | Naomi Calabretta <tony0000.ac> |
Component: | wayland-generic | Assignee: | KWin default assignee <kwin-bugs-null> |
Status: | RESOLVED FIXED | ||
Severity: | major | CC: | bugs+kde, idgr, jared, kde, lamarque, leodream2008, lopit321, mkyral, morsmortium, mrb, nate, sokann, thomas.garnier, tux.rising |
Priority: | NOR | Keywords: | regression |
Version: | 6.0.1 | ||
Target Milestone: | --- | ||
Platform: | Other | ||
OS: | Linux | ||
Latest Commit: | https://invent.kde.org/plasma/kwin/-/commit/013e69988ffdbed1d3c684a536c0d4b79c7de680 | Version Fixed In: | 6.1 |
Sentry Crash Report: | |||
Attachments: |
revert kwin commit 37d2a7914329c65361eedfd995f25bd6867b68bc to fix screensharing on Gentoo Linux
Revert commit 37d2a7914329c65361eedfd995f25bd6867b68bc for kwin 6.0.3.1 |
Description
Naomi Calabretta
2024-03-10 17:14:53 UTC
Breakage is supposed to start from this commit here: https://invent.kde.org/plasma/kwin/-/commit/37d2a7914329c65361eedfd995f25bd6867b68bc Created attachment 166969 [details]
revert kwin commit 37d2a7914329c65361eedfd995f25bd6867b68bc to fix screensharing on Gentoo Linux
thank you very much for finding that patch.
i can confirm reverting the patch makes screensharing work for me on Gentoo Linux.
Since updating to Plasma 6.0.0 i had the same behavior, the display selection menu came
up but when pressed any combination received "Failed to connect PipeWire context".
With the attached patch built into the package "kde-plasma/kwin-6.0.1-r2" from the main gentoo tree
screensharing seems to work flawlessly so far after a restart of the display server.
That commit is to be either reverted or looked upon because it makes two assumptions: 1. All Plasma users have a session which is managed by Systemd or similar (user service supervision) which of course can start some services to reach a target, for example the graphical target, at which point KWin starts; 2. PipeWire will never ever be restarted. If that was the case, the error would probably surface again, even on supervised sessions. This is what I can conclude from a raw look at the code; though it should not be hard to check if initialization has failed and at least attempt it again at some other point in time. >2. PipeWire will never ever be restarted. If that was the case, the error would probably surface again, even on supervised sessions.
You are right, and that is something we need to fix
I can confirm it is still broken in 6.0.3 and the unfortunately applying revert patch does not work anymore. So I have to call kwin_wayland --replace, but this kills running application including plasmashell. Created attachment 168354 [details]
Revert commit 37d2a7914329c65361eedfd995f25bd6867b68bc for kwin 6.0.3.1
I have updated the revert patch to apply to kwin 6.0.3.1 so we can use screencast until the problem is properly fixed.
i'm running the same patch according to diff (just with slightly different "index ..." lines which hopefully aren't that relevant to applying) For what it's worth what also worked for me without a patch at least for gentoo was to login as your user account in a shell and run "dbus-run-session gentoo-pipewire-launcher" and then start your display manager and login with the same user. not very pretty but i guess this should also work for other distributions with the correct pipewire launch command. i also wanted to try putting a pipewire launch script in ~/.config/plasma-workspace/env but i'm not very hopeful that this runs early enough. In the meantime i also found a somewhat experimental and pretty complex looking guide in the gentoo wiki to run user services with openrc: https://wiki.gentoo.org/wiki/OpenRC/User_services maybe at some point i'll get around to trying this. *** Bug 483668 has been marked as a duplicate of this bug. *** I have found another workaround: Screencast works if I launch pipewire through a script in $HOME/.config/plasma-workspace/env/. In Gentoo the script is as simple as: /usr/bin/gentoo-pipewire-launcher & PS: there is no need for the script to be executable since plasma-session sources it. I also had to disable pipewire autostart by removing the file /etc/xdg/autostart/pipewire.desktop to avoid pipewire being restarted during startup. The $HOME/.config/plasma-workspace/env workaround works on Artix with the following script: #!/bin/sh /usr/bin/pipewire & /usr/bin/pipewire-pulse & /usr/bin/wireplumber & (In reply to Randall Winkhart from comment #10) > The $HOME/.config/plasma-workspace/env workaround works on Artix with the > following script: > > #!/bin/sh > /usr/bin/pipewire & > /usr/bin/pipewire-pulse & > /usr/bin/wireplumber & After more extensive testing, it seems launching Pipewire in this way causes it to randomly crash. I've had two crashes now, one after a couple hours, another after a bunch more hours :/ A possibly relevant merge request was started @ https://invent.kde.org/plasma/kwin/-/merge_requests/5706 A possibly relevant merge request was started @ https://invent.kde.org/plasma/kwin/-/merge_requests/5708 Git commit 013e69988ffdbed1d3c684a536c0d4b79c7de680 by David Edmundson. Committed on 10/05/2024 at 14:35. Pushed by davidedmundson into branch 'master'. Reconnect Pipewire on Failure Our connection to pipewire can go down if the pipewire service restarts, it's on us to tear down and reconnect. To ensure Streams can tear down on their own properly, this patch leaves existing streams with a defunct connection and creates a new connection for new streams, sharing the connection between them. This also implicitly fixes the case for distributions without working socket activation. M +7 -0 src/plugins/screencast/pipewirecore.cpp M +4 -0 src/plugins/screencast/pipewirecore.h M +19 -5 src/plugins/screencast/screencastmanager.cpp M +3 -1 src/plugins/screencast/screencastmanager.h https://invent.kde.org/plasma/kwin/-/commit/013e69988ffdbed1d3c684a536c0d4b79c7de680 |