emersion / xdg-desktop-portal-wlr

xdg-desktop-portal backend for wlroots
MIT License
591 stars 57 forks source link

Google Chrome {dev,beta,stable} and Chromium crash on Desktop Sharing on xdpw-git #205

Closed kriive closed 2 years ago

kriive commented 2 years ago

I am on Arch Linux. I have installed xdpw via the AUR package xdg-desktop-portal-wlr-git. The issue seems to disappear if I install the xdg-desktop-portal-wlr release (on pacman).

Using the latest Firefox I can share my desktop without issues (using https://mozilla.github.io/webrtc-landing/gum_test.html).

Different story when trying the same on Chromium-based browsers. I've tried with:

Let me know if you need other info or debug stuff.

columbarius commented 2 years ago

@grulja: This looks to my like renegotiation is tripping sth. in chromium.

columbarius commented 2 years ago

@kriive I can confirm this happening with chromium native and with the flatpak version. Can you please check if OBS is working? You need to build from master or use the version from flathub-beta.

kriive commented 2 years ago

I can confirm OBS (from master, with -DENABLE_BROWSER=OFF -DENABLE_AJA=OFF -DENABLE_VLC=OFF) PipeWire capture is working.

mahkoh commented 2 years ago

On my system I don't get any crashes in 101.0.4951.54 (Official Build) Arch Linux (64-bit) but the shared image is corrupted. My graphics card (RX570) does not support explicit modifiers. There is no problem in OBS. Firefox does not support DMABUF screen sharing. Running with RADEON_DEBUG=nodcc did not fix the issue.

Edit: Forcing GBM_BO_USE_LINEAR fixes the issue.

columbarius commented 2 years ago

Edit: Forcing GBM_BO_USE_LINEAR fixes the issue.

@mahkoh You only have one gpu and the image was still corrupt without the force_mod_linear option? Didn't know that can happen.

mahkoh commented 2 years ago

You only have one gpu and the image was still corrupt without the force_mod_linear option?

Correct.

grulja commented 2 years ago

I'm trying to reproduce in Sway with latest xdg-desktop-portal-wlr from git, but it doesn't even get to settle the format:

2022/05/05 10:46:00 [INFO] - dbus: create session method invoked
2022/05/05 10:46:00 [INFO] - dbus: request_handle: /org/freedesktop/portal/desktop/request/1_269/webrtc402987779
2022/05/05 10:46:00 [INFO] - dbus: session_handle: /org/freedesktop/portal/desktop/session/1_269/webrtc_session91513507
2022/05/05 10:46:00 [INFO] - dbus: app_id: org.chromium.Chromium
2022/05/05 10:46:00 [INFO] - dbus: select sources method invoked
2022/05/05 10:46:00 [INFO] - dbus: request_handle: /org/freedesktop/portal/desktop/request/1_269/webrtc908434979
2022/05/05 10:46:00 [INFO] - dbus: session_handle: /org/freedesktop/portal/desktop/session/1_269/webrtc_session91513507
2022/05/05 10:46:00 [INFO] - dbus: app_id: org.chromium.Chromium
2022/05/05 10:46:00 [INFO] - dbus: option types:3
2022/05/05 10:46:00 [INFO] - dbus: option multiple: 0
2022/05/05 10:46:00 [DEBUG] - dbus: select sources: found matching session /org/freedesktop/portal/desktop/session/1_269/webrtc_session91513507
2022/05/05 10:46:00 [INFO] - wlroots: capturable output: Sharp Corporation model: 0x1516: id: 41 name: eDP-1
2022/05/05 10:46:00 [INFO] - wlroots: capturable output: Dell Inc. model: DELL P2418D: id: 42 name: DP-4
2022/05/05 10:46:00 [INFO] - wlroots: capturable output: Dell Inc. model: DELL P2418D: id: 43 name: DP-5
2022/05/05 10:46:00 [DEBUG] - wlroots: output chooser called
2022/05/05 10:46:00 [DEBUG] - wlroots: output chooser called
2022/05/05 10:46:01 [DEBUG] - wlroots: output chooser selects DP-4
2022/05/05 10:46:01 [INFO] - xdpw: screencast instance 0x11c1720 has 1 references
2022/05/05 10:46:01 [INFO] - xdpw: 1 active screencast instances
2022/05/05 10:46:01 [INFO] - wlroots: output: DP-4
2022/05/05 10:46:01 [INFO] - dbus: start method invoked
2022/05/05 10:46:01 [INFO] - dbus: request_handle: /org/freedesktop/portal/desktop/request/1_269/webrtc1250331382
2022/05/05 10:46:01 [INFO] - dbus: session_handle: /org/freedesktop/portal/desktop/session/1_269/webrtc_session91513507
2022/05/05 10:46:01 [INFO] - dbus: app_id: org.chromium.Chromium
2022/05/05 10:46:01 [INFO] - dbus: parent_window: 
2022/05/05 10:46:01 [DEBUG] - dbus: start: found matching session /org/freedesktop/portal/desktop/session/1_269/webrtc_session91513507
2022/05/05 10:46:01 [INFO] - wlroots: num_modififiers 1
2022/05/05 10:46:01 [INFO] - pipewire: stream state changed to "connecting"
2022/05/05 10:46:01 [INFO] - pipewire: node id is -1
2022/05/05 10:46:01 [INFO] - pipewire: stream state changed to "paused"
2022/05/05 10:46:01 [INFO] - pipewire: node id is 73
2022/05/05 10:46:01 [DEBUG] - dbus: start: returning node 73
2022/05/05 10:46:01 [INFO] - pipewire: unable to allocate a dmabuf with modifiers. Falling back to the old api
2022/05/05 10:46:01 [INFO] - wlroots: num_modififiers 1

and it keeps repeating last two lines. This is with NVIDIA proprietary driver.

Edit: same happens with OBS studio

grulja commented 2 years ago

@columbarius I see that xdg-desktop-portal-wlr uses the first render node it can find, but that doesn't necessarily be the one used by the compositor. I had same issue in WebRTC, where I used the first render node, but DMA-BUFs provided to me might be created by a different one. This will be case in multi-GPU setup, like I have for example with Intel + Nvidia.

See https://webrtc-review.googlesource.com/c/src/+/250661 for reference.

And indeed, using the other render node makes it to finally settle on the format and reproduce the issue. I will keep investigating now on my (WebRTC) side.

grulja commented 2 years ago

The crash should be fixed with https://github.com/flathub/org.chromium.Chromium/pull/228. There should be a test build available soon.

columbarius commented 2 years ago

@grulja Can you please check if #207 selects the right device?

grulja commented 2 years ago

@grulja Can you please check if #207 selects the right device?

I will, but I might not have time to test it today so it will have to wait until the next week.

grulja commented 2 years ago

@grulja Can you please check if #207 selects the right device? It does.

Without https://github.com/emersion/xdg-desktop-portal-wlr/pull/207: xdpw: Using render node /dev/dri/renderD129 With https://github.com/emersion/xdg-desktop-portal-wlr/pull/207: xdpw: Using render node /dev/dri/renderD128

columbarius commented 2 years ago

Great!. Thanks for testing.

columbarius commented 2 years ago

@kriive I tested xdpw master with current chromium on flatpack and it worked. Can we close this?

sentriz commented 2 years ago

all works for me too now with ungoogled-chromium/chromium/chrome flatpak 👍👍

kriive commented 2 years ago

Yes, of course! Thanks to everyone involved in the fix!