hyprwm / xdg-desktop-portal-hyprland

xdg-desktop-portal backend for Hyprland
BSD 3-Clause "New" or "Revised" License
305 stars 48 forks source link

Screensharing fails on NixOS #9

Closed ElysaSrc closed 1 year ago

ElysaSrc commented 1 year ago

When launching the screen sharing on my NixOS setups, I encounter what seems a permission issue (here with OBS)

info: PipeWire initialized
info: Switched to scene 'Full desktop'
info: ------------------------------------------------
info: Loaded scenes:
info: - scene 'Alone':
info:     - source: 'Image' (image_source)
info:     - source: 'Video Capture Device (V4L2)' (v4l2_input)
info: - scene 'Full desktop':
info:     - source: 'Screen Capture (PipeWire)' (pipewire-desktop-capture-source)
info:     - source: 'Video Capture Device (V4L2)' (v4l2_input)
info: ------------------------------------------------
info: [pipewire] Screencast session created
Attempted path: share/obs/obs-studio/images/overflow.png
Attempted path: /nix/store/v5dd3g0kgk8pzjdkypky19qynwil100z-obs-studio-28.1.2/share/obs/obs-studio/images/overflow.png
info: adding 21 milliseconds of audio buffering, total audio buffering is now 21 milliseconds (source: Desktop Audio)

info: [pipewire] Asking for desktop
warning: [pipewire] Failed to start screencast, denied or cancelled by user

I installed hyprland using flakes and NixOS, I check the module and it seems this portal is added automatically to extra portals so my guess is the setup is pretty standard and foolproof and should work out of the box, but it is not the case.

I use nixpkgs on nixpkgs.url = github:NixOS/nixpkgs; (unstable).

Did I miss something or is there a bug ? I can provide more logs if you need, let me know.

vaxerski commented 1 year ago

@fufexan

fufexan commented 1 year ago

nixpkgs.url = github:NixOS/nixpkgs; (unstable).

That's master, not unstable.

I'll check if I can reproduce with OBS, because with Firefox it works properly.

fufexan commented 1 year ago

Okay, it also works with OBS.

Are you overriding hyprland's nixpkgs input? If yes, can you check whether it works if you don't?

Do you have the NixOS (and Hyprland) config available somewhere?

ElysaSrc commented 1 year ago

I do not have stored my config on GitHub yet, I'm still playing with NixOS on my desktop right now.

I do not override the nixpkgs input I only have this line related to hyprland on my flake's inputs: hyprland.url = "github:hyprwm/Hyprland";

fufexan commented 1 year ago

Okay.

Anything weird in journalctl --user -eu xdg-desktop-portal-hyprland? Do you have other portals enabled?

ElysaSrc commented 1 year ago

I do not have any other portal enabled yet.

journalctl shows a stacktrace :

déc. 15 18:07:13 nest xdg-desktop-portal-hyprland[1737]: 2022/12/15 18:07:13 [ERROR] - xdg-desktop-portal-hyprland: unsupported wl_shm format 0x34324742
déc. 15 18:07:14 nest systemd-coredump[9609]: Process 1737 (.xdg-desktop-po) of user 1001 dumped core.

                                               Module libpipewire-module-session-manager.so without build-id.
                                               Module libpipewire-module-metadata.so without build-id.
                                               Module libpipewire-module-adapter.so without build-id.
                                               Module libpipewire-module-client-device.so without build-id.
                                               Module libpipewire-module-client-node.so without build-id.
                                               Module libpipewire-module-protocol-native.so without build-id.
                                               Module libdbus-1.so.3 without build-id.
                                               Module libspa-dbus.so without build-id.
                                               Module libspa-journal.so without build-id.
                                               Module libspa-support.so without build-id.
                                               Module libgpg-error.so.0 without build-id.
                                               Module libexpat.so.1 without build-id.
                                               Module liblz4.so.1 without build-id.
                                               Module libzstd.so.1 without build-id.
                                               Module liblzma.so.5 without build-id.
                                               Module libgcrypt.so.20 without build-id.
                                               Module libcap.so.2 without build-id.
                                               Module libffi.so.8 without build-id.
                                               Module libdrm.so.2 without build-id.
                                               Module libgbm.so.1 without build-id.
                                               Module libinih.so.0 without build-id.
                                               Module libpipewire-0.3.so.0 without build-id.
                                               Module libsystemd.so.0 without build-id.
                                               Module .xdg-desktop-portal-hyprland-wrapped without build-id.
                                               Stack trace of thread 1737:
                                               #0  0x00007fdff088abc7 __pthread_kill_implementation (libc.so.6 + 0x8abc7)
                                               #1  0x00007fdff083db46 raise (libc.so.6 + 0x3db46)
                                               #2  0x00007fdff08284b5 abort (libc.so.6 + 0x284b5)
                                               #3  0x00000000004088fe xdpw_format_drm_fourcc_from_wl_shm (.xdg-desktop-portal-hyprland-wrapped + 0x88fe)
                                               #4  0x000000000040a689 wlr_frame_buffer (.xdg-desktop-portal-hyprland-wrapped + 0xa689)
                                               #5  0x00007fdff0a118aa ffi_call_unix64 (libffi.so.8 + 0x78aa)
                                               #6  0x00007fdff0a108bb ffi_call_int (libffi.so.8 + 0x68bb)
                                               #7  0x00007fdff0a1133e ffi_call (libffi.so.8 + 0x733e)
                                               #8  0x00007fdff0c28741 wl_closure_invoke (libwayland-client.so.0 + 0xa741)
                                               #9  0x00007fdff0c24aaa dispatch_event.isra.0 (libwayland-client.so.0 + 0x6aaa)
                                               #10 0x00007fdff0c2640c wl_display_dispatch_queue_pending (libwayland-client.so.0 + 0x840c)
                                               #11 0x0000000000406f26 method_screencast_start (.xdg-desktop-portal-hyprland-wrapped + 0x6f26)
                                               #12 0x00007fdff0b664a5 object_find_and_run (libsystemd.so.0 + 0x394a5)
                                               #13 0x00007fdff0b6787e bus_process_object (libsystemd.so.0 + 0x3a87e)
                                               #14 0x00007fdff0b79fc9 bus_process_internal (libsystemd.so.0 + 0x4cfc9)
                                               #15 0x0000000000404f2d main (.xdg-desktop-portal-hyprland-wrapped + 0x4f2d)
                                               #16 0x00007fdff082924e __libc_start_call_main (libc.so.6 + 0x2924e)
                                               #17 0x00007fdff0829309 __libc_start_main@@GLIBC_2.34 (libc.so.6 + 0x29309)
                                               #18 0x00000000004050f5 _start (.xdg-desktop-portal-hyprland-wrapped + 0x50f5)

                                               Stack trace of thread 1738:
                                               #0  0x00007fdff090f237 epoll_wait (libc.so.6 + 0x10f237)
                                               #1  0x00007fdff0425520 impl_pollfd_wait (libspa-support.so + 0x15520)
                                               #2  0x00007fdff0418d4b loop_iterate (libspa-support.so + 0x8d4b)
                                               #3  0x00007fdff0a8cf94 do_loop (libpipewire-0.3.so.0 + 0x46f94)
                                               #4  0x00007fdff0888e86 start_thread (libc.so.6 + 0x88e86)
                                               #5  0x00007fdff090fc60 __clone3 (libc.so.6 + 0x10fc60)
                                               ELF object binary architecture: AMD x86-64
déc. 15 18:07:14 nest systemd[1649]: xdg-desktop-portal-hyprland.service: Main process exited, code=dumped, status=6/ABRT
déc. 15 18:07:14 nest systemd[1649]: xdg-desktop-portal-hyprland.service: Failed with result 'core-dump'.
fufexan commented 1 year ago

@vaxerski any idea what that means?

vaxerski commented 1 year ago

isnt it that nvidia issue that had to be manually patched to work

fufexan commented 1 year ago

Oh in that case I'm on it.

fufexan commented 1 year ago

Thought there was something I left unfixed while doing the proper override for xdph in the HL flake, but it seems it's all fine.

@ElysaSrc are you using hyprland with the nvidiaPatches = true; override flag?

ElysaSrc commented 1 year ago

I do use this flag:

flake-self.inputs.hyprland.packages.${pkgs.system}.default.override {
  nvidiaPatches = true;
  enableXWayland = true;
  hidpiXWayland = true;
};

But I realize I was passing the flag on the package itself, not the module, is it related ?

fufexan commented 1 year ago

Okay, I think I found the problem. Can you point the HL flake to this url? github:fufexan/Hyprland/nix-stuff.

With that, you can set programs.hyprland.nvidiaPatches = true; and not set the package, and you will have the same result as the snippet you posted.

This will propagate properly to xdph and hopefully fix your issue.

ElysaSrc commented 1 year ago

I will try this later this week-end and I will let you know ! Thank you very much for your help :)

xiaoxi654 commented 1 year ago

Okay, I think I found the problem. Can you point the HL flake to this url? github:fufexan/Hyprland/nix-stuff.

With that, you can set programs.hyprland.nvidiaPatches = true; and not set the package, and you will have the same result as the snippet you posted.

This will propagate properly to xdph and hopefully fix your issue.

I switched input to your fork and set nvidiaPatches to true. If I’m not doing wrong, the issue still exists. Log is same as above.

fufexan commented 1 year ago

@xiaoxi654 I've updated that branch, can you update the input and try again?

xiaoxi654 commented 1 year ago

@xiaoxi654 I've updated that branch, can you update the input and try again?

Now it works, thank you!

fufexan commented 1 year ago

Great, I'll push to main then. Thanks for testing.

fufexan commented 1 year ago

Fixed in https://github.com/hyprwm/Hyprland/commit/e7940569dde86d92e25ceb07824f6853515ca0b5