Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pipewire screensharing not working in KDE #31274

Closed
ghost opened this issue Jun 3, 2021 · 18 comments
Closed

Pipewire screensharing not working in KDE #31274

ghost opened this issue Jun 3, 2021 · 18 comments
Labels
bug Something isn't working

Comments

@ghost
Copy link

ghost commented Jun 3, 2021

System

  • xuname: Void 5.12.8_1 x86_64 AuthenticAMD uptodate rrrmFFFFF
  • packages: kwin-5.21.5_1 plasma-workspace-5.21.5_1

Expected behavior

Screensharing in KDE should work under wayland in applications such as firefox and obs.

Actual behavior

Screensharing doesn't work

Steps to reproduce the behavior

Additional info

  • I know that pipewire is working somewhat because after enabling the build options I have working window previews (previously they were just empty boxes when I hovered over them).
  • Pipewire works fine for me as an audio Server
  • I have pipewire, pipewire-pulse, pipewire-media-session and xdg-desktop-portal-kde running
  • when running "xdg-desktop-portal-kde -v" in a terminal I get the output zkde_screencast_unstable_v1 does not seem to be available when triggering screensharing in obs or firefox.
@HadetTheUndying
Copy link
Contributor

You may want to test #31549

I'll test on Gnome tomorrow.

@paper42
Copy link
Member

paper42 commented Jun 23, 2021

Build plasma-workspace and kwin with the pipewire build option enabled

what does this mean? pipewire should be enabled by default

You may want to test #31549

That PR doesn't change anything with screen sharing.

Do you have the latest obs version? Are you sure it's not running under xwayland?

@Johnnynator
Copy link
Member

Johnnynator commented Jun 23, 2021

Build plasma-workspace and kwin with the pipewire build option enabled

what does this mean? pipewire should be enabled by default

No, I initially didn't enable it by default, since it made Plasma rather unstable under wayland. Most of the probmles are kinda resolved in regards of stability and I will enable it again with the next update (if I won't forget it).

But this only fixes one issue. Plasma under Void does seem to have a problem noticing that pipe wire is running/available and I wasn't able yet to figure out yet what the cause is.

Also no Xwayland isn't the issue.

Edit: Correction, I already enabled pipewire in 5.22.1 last week.

@paper42
Copy link
Member

paper42 commented Jun 24, 2021

Also no Xwayland isn't the issue.

obs doesn't show a pipewire screen sharing option when not running with the wayland backend.

@JaceHensley
Copy link

I'm hitting this as well.

pipewire: 0.3.35
firefox: 92
kde: 5.22.5
xdg-desktop-portal-kde: 5.22.5

I can't figure out what's going on. In firefox in the gUM test page I click "Use operating system setting" and then "Allow" but nothing happens, I do see "zkde_screencast_unstable_v1 does not seem to be available" when I run xdg-desktop-portal-kde in the terminal. But in Chromium it lets me select a screen (without a preview of the screen) but then after sharing the gUM page just displays a black screen with no cursor or anything.

Does that have to do with Plasma under void not knowing when pipewire is running? I've added pipewire to "Login Scripts" in KDE

@Johnnynator
Copy link
Member

I'm not sure yet where the issue is. xdg-desktop-portal-kde does not motivate kf.wayland.client enough to announce zkde_screencast_unstable_v1. so the m_screencasting = new Screencasting(m_registry, name, version, this); line will never be called.

The autotest testScreencastV1Interface from kwayland-server on the other hand does manage to get the kwayland lib to announce screencast and does not fail. I need to check where the two differ and (except the obvious parts).

Another note for myself QT_LOGGING_RULES="*.debug=true" is pretty useful to get more verbose log, we want to see a line containing kf.wayland.client: Unknown interface announced: zkde_screencast_unstable_v1 in the output

@JaceHensley
Copy link

lmk if I can be of any help, getting logs or whatever else

@paper42 paper42 added the bug Something isn't working label Oct 4, 2021
@JaceHensley
Copy link

any updates on this? it's like the only thing that doesn't work for me with my current setup haha. Totally happy to dig in too just don't know where to start looking

@bakuhatu
Copy link

I just tried this:
export QT_LOGGING_RULES="*.debug=true" xdg-desktop-portal-kde -v

And the output shows xdp-kde-screencast: zkde_screencast_unstable_v1 does not seem to be available among all the other stuff.

Then I run obs --verbose in a new terminal (excluded the stuff that didn't look weird):

...
QMetaObject::connectSlotsByName: No matching signal for on_tbar_position_valueChanged(int)
QMetaObject::connectSlotsByName: No matching signal for on_actionShowTransitionProperties_triggered()
QMetaObject::connectSlotsByName: No matching signal for on_actionHideTransitionProperties_triggered()
...
warning: Failed to load 'en-US' text for module: 'decklink-captions.so'
warning: Failed to load 'en-US' text for module: 'decklink-ouput-ui.so'
...
libDeckLinkAPI.so: cannot open shared object file: No such file or directory
warning: A DeckLink iterator could not be created.  The DeckLink drivers may not be installed
info: No blackmagic support
error: os_dlopen(libnvidia-encode.so.1->libnvidia-encode.so.1): libnvidia-encode.so.1: cannot open shared object file: No such file or directory
...
qt.qpa.wayland: Wayland does not support QWindow::requestActivate()
warning: [pipewire] Failed to create session, denied or cancelled by user
warning: [pipewire] Failed to create session, denied or cancelled by user

Then, if I try to select a window from window capture:

xdp-kde-screencast: CreateSession called with parameters:
xdp-kde-screencast:     handle:  "/org/freedesktop/portal/desktop/request/1_100/obs8"
xdp-kde-screencast:     session_handle:  "/org/freedesktop/portal/desktop/session/1_100/obs8"
xdp-kde-screencast:     app_id:  ""
xdp-kde-screencast:     options:  QMap()
xdp-kde-screencast: zkde_screencast_unstable_v1 does not seem to be available
xdp-kde-session: "org.freedesktop.impl.portal.Session"
xdp-kde-session: "Close"
xdp-kde-session: "/org/freedesktop/portal/desktop/session/1_100/obs8"

If there's anything I can do to help, please tell me.

@bakuhatu
Copy link

I might have done the QT_LOGGING_RULES thing wrong last time.

I tried again with QT_LOGGING_RULES="*.debug=true" /usr/lib64/libexec/xdg-desktop-portal-kde -v

saw this:
kf.crash: Could not find drkonqi in search paths: ("/usr/lib/libexec", "/usr/lib/qt5/libexec", "/usr/lib64/libexec")

but no kf.wayland.client: Unknown interface announced: zkde_screencast_unstable_v1

Also, I tried looking at waylandintegration.cpp:

connect(m_registry, &KWayland::Client::Registry::interfaceAnnounced, this, [this](const QByteArray &interfaceName, quint32 name, quint32 version) {
        if (interfaceName != "zkde_screencast_unstable_v1")
            return;
        m_screencasting = new Screencasting(m_registry, name, version, this);
    });

This is the part @Johnnynator was talking about I guess.
I think it's connecting an interfaceAnnounced signal to m_registry, but I don't understand what the last two parameters are for and I can't find what connect is. My C++ knowledge is pretty basic so idk.

I couldn't find the interfaceAnnounced implementation, though I found the declaration in kwayland/registry.h. I guess the implementation is the 4th argument to connect, but I don't know how to find where it calls that function/emits that signal to see what it's using as interfaceName.

@JaceHensley
Copy link

So I saw the interface name being used here https://invent.kde.org/plasma/xdg-desktop-portal-kde/-/blob/master/data/org.freedesktop.impl.portal.desktop.kde.desktop.in#L36 would X-KDE-Wayland-Interfaces=zkde_screencast_unstable_v1 need to be added to .desktop files of the applications?

@bakuhatu
Copy link

bakuhatu commented Jan 24, 2022

Adding that line to the .desktop file fixed OBS for me. It crashes now when I try to select RetroArch for window capture, but I guess that's a separate issue.

@russnes
Copy link

russnes commented Feb 6, 2022

I have the same issue, no windows to select in OBS in Window Capture (PipeWire) sources, and getting warning

warning: [pipewire] Failed to create session, denied or cancelled by user.

I have the package xdg-desktop-portal-kde installed, but I don't have the command in my PATH apparently. I see it running in ps aux | grep xdg though, not sure what started it, but could have been OBS. It doesn't go away if I close OBS.

pipewire 0.3.45
OBS 27.1.3
kde5 5.23.0
xdg-desktop-portal-kde 5.23.5
linux 5.15.19

@bakuhatu
Copy link

bakuhatu commented Feb 7, 2022

After I updated pipewire (0.3.45) and other packages today, Select Window in OBS no longer shows the wayland window selector although my .desktop file was unchanged.

@JaceHensley
Copy link

interesting, I was never able to get it working even with that line added to the .desktop

@Johnnynator
Copy link
Member

Finally found some time to finish digging into this.
The issue lies in kservice not being able to find the needed desktop files of xdg-desktop-portal-kde
KWIN_UTILS: Could not find the desktop file for "/usr/lib/libexec/xdg-desktop-portal-kde", which is due to our .desktop files referring to lib64 and not just lib.
Will take a look how to fix this issue, but I will put a fix in together with the plasma 5.24 update, hopefully this weekend, if not somewhen next week.

Until then you can just edit the /usr/share/applications/org.freedesktop.impl.portal.desktop.kde.desktop to point to /usr/lib/libexec/xdg-desktop-portal-kde

@JaceHensley
Copy link

Editing that .desktop file worked, I can share my screens and windows from Firefox now!! 🎉

@Johnnynator
Copy link
Member

I do have a test repo up for plasma 5.24, kde framework 5.90 and some app updates.
Repo: https://void.johnnynator.dev/plasma-5.24/
Fingerprint: f2:92:af:af:25:e5:9b:5f:8d:c4:c1:7d:90:2e:2d:19

Build from this branch: https://github.com/Johnnynator/void-packages/tree/kde-stuff

I will finish it up and push to master once kde frameowkr 5.91 is released, hopefully later today.

maciozo pushed a commit to maciozo/void-packages that referenced this issue Feb 19, 2022
ftrvxmtrx pushed a commit to ftrvxmtrx/void-packages that referenced this issue Mar 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

6 participants