loki-47-6F-64 / sunshine

Host for Moonlight Streaming Client
GNU General Public License v3.0
1.78k stars 152 forks source link

Headless Wayland - Incompatible connector name #274

Open sergioperez opened 3 years ago

sergioperez commented 3 years ago

Hello!

After trying to execute sway and kwin_wayland in headless mode, I observe that they both expose a different connector name, being it named "HEADLESS" in sway, and "VIRTUAL" in kwin.

What do you think that would be the best procedure to support these virtual monitors?

$ export WLR_BACKENDS=headless                                                                                    
$ export WLR_LIBINPUT_NO_DEVICES=1                                     
$ export WAYLAND_DISPLAY=wayland-1                                                                                                           
$ export XDG_RUNTIME_DIR=/tmp                                                                                                                
$ export XDG_SESSION_TYPE=wayland
$ sway                                                                                                            
Failed to connect to bus: No such file or directory                  
dbus-update-activation-environment: error: unable to connect to D-Bus: /usr/bin/dbus-launch terminated abnormally without any error message
00:00:00.006 [swaybar/tray/tray.c:42] Failed to connect to user bus: No such file or directory                                             
2021-11-26 17:25:08 - [main.c:299] Found config * for output HEADLESS-1 ((null))
$ sunshine           
Cannot load libcuda.so.1                                             
[2021:11:26:17:23:53]: Error: Couldn't load cuda: -1
[2021:11:26:17:23:53]: Info: Found display [wayland-1]
[2021:11:26:17:23:53]: Info: Found interface: zxdg_output_manager_v1(9) version 3
[2021:11:26:17:23:53]: Info: Found interface: zwlr_export_dmabuf_manager_v1(25) version 1
[2021:11:26:17:23:53]: Info: Found interface: wl_output(36) version 3 
[2021:11:26:17:23:53]: Info: Name: HEADLESS-1
[2021:11:26:17:23:53]: Info: Found monitor: Headless output 1
[2021:11:26:17:23:53]: Info: Offset: 0x0            
[2021:11:26:17:23:53]: Info: Resolution: 1280x720                                                                                          
[2021:11:26:17:23:53]: Warning: Couldn't expose some properties for card: /dev/dri/card0
[2021:11:26:17:23:53]: Info: Found display [wayland-1]                                                                                     
[2021:11:26:17:23:53]: Info: Found display [wayland-1]               
[2021:11:26:17:23:53]: Info: Found interface: zxdg_output_manager_v1(9) version 3
[2021:11:26:17:23:53]: Info: Found interface: zwlr_export_dmabuf_manager_v1(25) version 1
[2021:11:26:17:23:53]: Info: Found interface: wl_output(36) version 3 
[2021:11:26:17:23:53]: Info: Name: HEADLESS-1         
[2021:11:26:17:23:53]: Info: Found monitor: Headless output 1                                                                              
[2021:11:26:17:23:53]: Info: Offset: 0x0                                                                                                   
[2021:11:26:17:23:53]: Info: Resolution: 1280x720                                                                                          
[2021:11:26:17:23:53]: Info: HEADLESS-1: Headless output 1                                                                                 
[2021:11:26:17:23:53]: Error: Unknown Monitor connector type [HEADLESS]: Please report this to the Github issue tracker
[2021:11:26:17:23:53]: Error: Could not create Sunshine Mouse: Permission denied
sergioperez commented 3 years ago

Sunshine progress on the starting process with this PR. Now it is crashing, but I suspect this might be related with the drivers I have on my AWS instance and not with Sunshine itself.

$ export WLR_BACKENDS=headless && export WAYLAND_DISPLAY=wayland-0 && export XDG_RUNTIME_DIR=/tmp && export XDG_SESSION_TYPE=wayland
$ sway
2021-11-27 13:49:36 - [main.c:299] Found config * for output HEADLESS-1 ((null))
$ WAYLAND_DISPLAY=wayland-0 XDG_RUNTIME_DIR=/tmp ./sunshine 
[2021:11:27:13:50:18]: Info: Found display [wayland-0]
[2021:11:27:13:50:18]: Info: Found interface: zxdg_output_manager_v1(9) version 3
[2021:11:27:13:50:18]: Info: Found interface: zwlr_export_dmabuf_manager_v1(25) version 1
[2021:11:27:13:50:18]: Info: Found interface: wl_output(36) version 3
[2021:11:27:13:50:18]: Info: Name: HEADLESS-1
[2021:11:27:13:50:18]: Info: Found monitor: Headless output 1
[2021:11:27:13:50:18]: Info: Offset: 0x0
[2021:11:27:13:50:18]: Info: Resolution: 1280x720
[2021:11:27:13:50:18]: Warning: Couldn't expose some properties for card: /dev/dri/card0
[2021:11:27:13:50:18]: Info: Found display [wayland-0]
[2021:11:27:13:50:18]: Info: Found display [wayland-0]
[2021:11:27:13:50:18]: Info: Found interface: zxdg_output_manager_v1(9) version 3
[2021:11:27:13:50:18]: Info: Found interface: zwlr_export_dmabuf_manager_v1(25) version 1
[2021:11:27:13:50:18]: Info: Found interface: wl_output(36) version 3
[2021:11:27:13:50:18]: Info: Name: HEADLESS-1
[2021:11:27:13:50:18]: Info: Found monitor: Headless output 1
[2021:11:27:13:50:18]: Info: Offset: 0x0
[2021:11:27:13:50:18]: Info: Resolution: 1280x720
[2021:11:27:13:50:18]: Info: HEADLESS-1: Headless output 1
[2021:11:27:13:50:18]: Warning: Mismatch on expected Resolution compared to actual resolution: 0x0 vs 1280x720
[2021:11:27:13:50:18]: Info: //////////////////////////////////////////////////////////////////
[2021:11:27:13:50:18]: Info: //                                                              //
[2021:11:27:13:50:18]: Info: //   Testing for available encoders, this may generate errors.  //
[2021:11:27:13:50:18]: Info: //   You can safely ignore those errors.                        //
[2021:11:27:13:50:18]: Info: //                                                              //
[2021:11:27:13:50:18]: Info: //////////////////////////////////////////////////////////////////
[2021:11:27:13:50:18]: Info: Trying encoder [nvenc]
[2021:11:27:13:50:18]: Info: Screencasting with Wayland's protocol
[2021:11:27:13:50:18]: Info: Found display [wayland-0]
[2021:11:27:13:50:18]: Info: Found interface: zxdg_output_manager_v1(9) version 3
[2021:11:27:13:50:18]: Info: Found interface: zwlr_export_dmabuf_manager_v1(25) version 1
[2021:11:27:13:50:18]: Info: Found interface: wl_output(36) version 3
[2021:11:27:13:50:18]: Info: Name: HEADLESS-1
[2021:11:27:13:50:18]: Info: Found monitor: Headless output 1
[2021:11:27:13:50:18]: Info: Offset: 0x0
[2021:11:27:13:50:18]: Info: Resolution: 1280x720
[2021:11:27:13:50:18]: Info: Selected monitor [Headless output 1] for streaming
[2021:11:27:13:50:18]: Info: Color coding [Rec. 601]
[2021:11:27:13:50:18]: Info: Color range: [JPEG]
[2021:11:27:13:50:18]: Error: Failed to create a CUDA device: Unknown error occurred
[2021:11:27:13:50:18]: Info: Screencasting with Wayland's protocol
[2021:11:27:13:50:18]: Info: Found display [wayland-0]
[2021:11:27:13:50:18]: Info: Found interface: zxdg_output_manager_v1(9) version 3
[2021:11:27:13:50:18]: Info: Found interface: zwlr_export_dmabuf_manager_v1(25) version 1
[2021:11:27:13:50:18]: Info: Found interface: wl_output(36) version 3
[2021:11:27:13:50:18]: Info: Name: HEADLESS-1
[2021:11:27:13:50:18]: Info: Found monitor: Headless output 1
[2021:11:27:13:50:18]: Info: Offset: 0x0
[2021:11:27:13:50:18]: Info: Resolution: 1280x720
[2021:11:27:13:50:18]: Info: Selected monitor [Headless output 1] for streaming
[2021:11:27:13:50:18]: Info: Color coding [Rec. 601]
[2021:11:27:13:50:18]: Info: Color range: [JPEG]
[2021:11:27:13:50:18]: Error: Failed to create a CUDA device: Unknown error occurred
[2021:11:27:13:50:18]: Info: Screencasting with Wayland's protocol
[2021:11:27:13:50:18]: Info: Found display [wayland-0]
[2021:11:27:13:50:18]: Info: Found interface: zxdg_output_manager_v1(9) version 3
[2021:11:27:13:50:18]: Info: Found interface: zwlr_export_dmabuf_manager_v1(25) version 1
[2021:11:27:13:50:18]: Info: Found interface: wl_output(36) version 3
[2021:11:27:13:50:18]: Info: Name: HEADLESS-1
[2021:11:27:13:50:18]: Info: Found monitor: Headless output 1
[2021:11:27:13:50:18]: Info: Offset: 0x0
[2021:11:27:13:50:18]: Info: Resolution: 1280x720
[2021:11:27:13:50:18]: Info: Selected monitor [Headless output 1] for streaming
[2021:11:27:13:50:18]: Info: Color coding [Rec. 601]
[2021:11:27:13:50:18]: Info: Color range: [JPEG]
[2021:11:27:13:50:18]: Error: Failed to create a CUDA device: Unknown error occurred
[2021:11:27:13:50:18]: Info: Screencasting with Wayland's protocol
[2021:11:27:13:50:18]: Info: Found display [wayland-0]
[2021:11:27:13:50:18]: Info: Found interface: zxdg_output_manager_v1(9) version 3
[2021:11:27:13:50:18]: Info: Found interface: zwlr_export_dmabuf_manager_v1(25) version 1
[2021:11:27:13:50:18]: Info: Found interface: wl_output(36) version 3
[2021:11:27:13:50:18]: Info: Name: HEADLESS-1
[2021:11:27:13:50:18]: Info: Found monitor: Headless output 1
[2021:11:27:13:50:18]: Info: Offset: 0x0
[2021:11:27:13:50:18]: Info: Resolution: 1280x720
[2021:11:27:13:50:18]: Info: Selected monitor [Headless output 1] for streaming
[2021:11:27:13:50:18]: Info: Color coding [Rec. 601]
[2021:11:27:13:50:18]: Info: Color range: [JPEG]
[2021:11:27:13:50:18]: Error: Failed to create a CUDA device: Unknown error occurred
[2021:11:27:13:50:18]: Info: Encoder [nvenc] failed
[2021:11:27:13:50:18]: Info: Trying encoder [vaapi]
[2021:11:27:13:50:18]: Info: Screencasting with Wayland's protocol
[2021:11:27:13:50:18]: Info: Found display [wayland-0]
[2021:11:27:13:50:18]: Info: Found interface: zxdg_output_manager_v1(9) version 3
[2021:11:27:13:50:18]: Info: Found interface: zwlr_export_dmabuf_manager_v1(25) version 1
[2021:11:27:13:50:18]: Info: Found interface: wl_output(36) version 3
[2021:11:27:13:50:18]: Info: Name: HEADLESS-1
[2021:11:27:13:50:18]: Info: Found monitor: Headless output 1
[2021:11:27:13:50:18]: Info: Offset: 0x0
[2021:11:27:13:50:18]: Info: Resolution: 1280x720
[2021:11:27:13:50:18]: Info: Selected monitor [Headless output 1] for streaming
[2021:11:27:13:50:18]: Info: Color coding [Rec. 601]
[2021:11:27:13:50:18]: Info: Color range: [JPEG]
libva info: VA-API version 1.12.0
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/radeonsi_drv_video.so
libva info: Found init function __vaDriverInit_1_12
libva info: va_openDriver() returns 0
mesa: for the --simplifycfg-sink-common option: may only occur zero or one times!
mesa: for the --global-isel-abort option: may only occur zero or one times!
mesa: for the --amdgpu-atomic-optimizations option: may only occur zero or one times!
[2021:11:27:13:50:18]: Info: Screencasting with Wayland's protocol
[2021:11:27:13:50:18]: Info: Found display [wayland-0]
[2021:11:27:13:50:18]: Info: Found interface: zxdg_output_manager_v1(9) version 3
[2021:11:27:13:50:18]: Info: Found interface: zwlr_export_dmabuf_manager_v1(25) version 1
[2021:11:27:13:50:18]: Info: Found interface: wl_output(36) version 3
[2021:11:27:13:50:18]: Info: Name: HEADLESS-1
[2021:11:27:13:50:18]: Info: Found monitor: Headless output 1
[2021:11:27:13:50:18]: Info: Offset: 0x0
[2021:11:27:13:50:18]: Info: Resolution: 1280x720
[2021:11:27:13:50:18]: Info: Selected monitor [Headless output 1] for streaming
libva info: VA-API version 1.12.0
[2021:11:27:13:50:18]: Info: Color coding [Rec. 601]
[2021:11:27:13:50:18]: Info: Color range: [JPEG]
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/radeonsi_drv_video.so
libva info: Found init function __vaDriverInit_1_12
libva info: va_openDriver() returns 0
Segmentation fault (core dumped)

Edit: Similar behaviour in a physical HD7770 using radeon instead of amdgpu:

[2021:11:27:16:39:31]: Info: Found display [wayland-0]
[2021:11:27:16:39:31]: Info: Found interface: zxdg_output_manager_v1(9) version 3
[2021:11:27:16:39:31]: Info: Found interface: zwlr_export_dmabuf_manager_v1(25) version 1
[2021:11:27:16:39:31]: Info: Found interface: wl_output(36) version 3
[2021:11:27:16:39:31]: Info: Name: HEADLESS-1
[2021:11:27:16:39:31]: Info: Found monitor: Headless output 1
[2021:11:27:16:39:31]: Info: Offset: 0x0
[2021:11:27:16:39:31]: Info: Resolution: 1280x720
[2021:11:27:16:39:31]: Warning: Couldn't expose some properties for card: /dev/dri/card0
[2021:11:27:16:39:32]: Info: Found display [wayland-0]
[2021:11:27:16:39:32]: Info: Found display [wayland-0]
[2021:11:27:16:39:32]: Info: Found interface: zxdg_output_manager_v1(9) version 3
[2021:11:27:16:39:32]: Info: Found interface: zwlr_export_dmabuf_manager_v1(25) version 1
[2021:11:27:16:39:32]: Info: Found interface: wl_output(36) version 3
[2021:11:27:16:39:32]: Info: Name: HEADLESS-1
[2021:11:27:16:39:32]: Info: Found monitor: Headless output 1
[2021:11:27:16:39:32]: Info: Offset: 0x0
[2021:11:27:16:39:32]: Info: Resolution: 1280x720
[2021:11:27:16:39:32]: Info: HEADLESS-1: Headless output 1
[2021:11:27:16:39:32]: Info: //////////////////////////////////////////////////////////////////
[2021:11:27:16:39:32]: Info: //                                                              //
[2021:11:27:16:39:32]: Info: //   Testing for available encoders, this may generate errors.  //
[2021:11:27:16:39:32]: Info: //   You can safely ignore those errors.                        //
[2021:11:27:16:39:32]: Info: //                                                              //
[2021:11:27:16:39:32]: Info: //////////////////////////////////////////////////////////////////
[2021:11:27:16:39:32]: Info: Trying encoder [nvenc]
[2021:11:27:16:39:32]: Info: Screencasting with Wayland's protocol
[2021:11:27:16:39:32]: Info: Found display [wayland-0]
[2021:11:27:16:39:32]: Info: Found interface: zxdg_output_manager_v1(9) version 3
[2021:11:27:16:39:32]: Info: Found interface: zwlr_export_dmabuf_manager_v1(25) version 1
[2021:11:27:16:39:32]: Info: Found interface: wl_output(36) version 3
[2021:11:27:16:39:32]: Info: Name: HEADLESS-1
[2021:11:27:16:39:32]: Info: Found monitor: Headless output 1
[2021:11:27:16:39:32]: Info: Offset: 0x0
[2021:11:27:16:39:32]: Info: Resolution: 1280x720
[2021:11:27:16:39:32]: Info: Selected monitor [Headless output 1] for streaming
[2021:11:27:16:39:32]: Info: Color coding [Rec. 601]
[2021:11:27:16:39:32]: Info: Color range: [JPEG]
[2021:11:27:16:39:32]: Error: Failed to create a CUDA device: Unknown error occurred
[2021:11:27:16:39:32]: Info: Screencasting with Wayland's protocol
[2021:11:27:16:39:32]: Info: Found display [wayland-0]
[2021:11:27:16:39:32]: Info: Found interface: zxdg_output_manager_v1(9) version 3
[2021:11:27:16:39:32]: Info: Found interface: zwlr_export_dmabuf_manager_v1(25) version 1
[2021:11:27:16:39:32]: Info: Found interface: wl_output(36) version 3
[2021:11:27:16:39:32]: Info: Name: HEADLESS-1
[2021:11:27:16:39:32]: Info: Found monitor: Headless output 1
[2021:11:27:16:39:32]: Info: Offset: 0x0
[2021:11:27:16:39:32]: Info: Resolution: 1280x720
[2021:11:27:16:39:32]: Info: Selected monitor [Headless output 1] for streaming
[2021:11:27:16:39:32]: Info: Color coding [Rec. 601]
[2021:11:27:16:39:32]: Info: Color range: [JPEG]
[2021:11:27:16:39:32]: Error: Failed to create a CUDA device: Unknown error occurred
[2021:11:27:16:39:32]: Info: Screencasting with Wayland's protocol
[2021:11:27:16:39:32]: Info: Found display [wayland-0]
[2021:11:27:16:39:32]: Info: Found interface: zxdg_output_manager_v1(9) version 3
[2021:11:27:16:39:32]: Info: Found interface: zwlr_export_dmabuf_manager_v1(25) version 1
[2021:11:27:16:39:32]: Info: Found interface: wl_output(36) version 3
[2021:11:27:16:39:32]: Info: Name: HEADLESS-1
[2021:11:27:16:39:32]: Info: Found monitor: Headless output 1
[2021:11:27:16:39:32]: Info: Offset: 0x0
[2021:11:27:16:39:32]: Info: Resolution: 1280x720
[2021:11:27:16:39:32]: Info: Selected monitor [Headless output 1] for streaming
[2021:11:27:16:39:32]: Info: Color coding [Rec. 601]
[2021:11:27:16:39:32]: Info: Color range: [JPEG]
[2021:11:27:16:39:32]: Error: Failed to create a CUDA device: Unknown error occurred
[2021:11:27:16:39:32]: Info: Screencasting with Wayland's protocol
[2021:11:27:16:39:32]: Info: Found display [wayland-0]
[2021:11:27:16:39:32]: Info: Found interface: zxdg_output_manager_v1(9) version 3
[2021:11:27:16:39:32]: Info: Found interface: zwlr_export_dmabuf_manager_v1(25) version 1
[2021:11:27:16:39:32]: Info: Found interface: wl_output(36) version 3
[2021:11:27:16:39:32]: Info: Name: HEADLESS-1
[2021:11:27:16:39:32]: Info: Found monitor: Headless output 1
[2021:11:27:16:39:32]: Info: Offset: 0x0
[2021:11:27:16:39:32]: Info: Resolution: 1280x720
[2021:11:27:16:39:32]: Info: Selected monitor [Headless output 1] for streaming
[2021:11:27:16:39:32]: Info: Color coding [Rec. 601]
[2021:11:27:16:39:32]: Info: Color range: [JPEG]
[2021:11:27:16:39:32]: Error: Failed to create a CUDA device: Unknown error occurred
[2021:11:27:16:39:32]: Info: Encoder [nvenc] failed
[2021:11:27:16:39:32]: Info: Trying encoder [vaapi]
[2021:11:27:16:39:32]: Info: Screencasting with Wayland's protocol
[2021:11:27:16:39:32]: Info: Found display [wayland-0]
[2021:11:27:16:39:32]: Info: Found interface: zxdg_output_manager_v1(9) version 3
[2021:11:27:16:39:32]: Info: Found interface: zwlr_export_dmabuf_manager_v1(25) version 1
[2021:11:27:16:39:32]: Info: Found interface: wl_output(36) version 3
[2021:11:27:16:39:32]: Info: Name: HEADLESS-1
[2021:11:27:16:39:32]: Info: Found monitor: Headless output 1
[2021:11:27:16:39:32]: Info: Offset: 0x0
[2021:11:27:16:39:32]: Info: Resolution: 1280x720
[2021:11:27:16:39:32]: Info: Selected monitor [Headless output 1] for streaming
[2021:11:27:16:39:32]: Info: Color coding [Rec. 601]
[2021:11:27:16:39:32]: Info: Color range: [JPEG]
libva info: VA-API version 1.12.0
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/r600_drv_video.so
libva info: Found init function __vaDriverInit_1_12
radeon: Failed to allocate virtual address for buffer:
radeon:    size      : 65536 bytes
radeon:    alignment : 4096 bytes
radeon:    domains   : 4
radeon:    va        : 0x0000000100000000
radeon: Failed to allocate virtual address for buffer:
radeon:    size      : 65536 bytes
radeon:    alignment : 4096 bytes
radeon:    domains   : 4
radeon:    va        : 0x0000000100000000
radeonsi: Failed to create a context.
radeon: Failed to allocate virtual address for buffer:
radeon:    size      : 65536 bytes
radeon:    alignment : 4096 bytes
radeon:    domains   : 4
radeon:    va        : 0x0000000100000000
radeon: Failed to allocate virtual address for buffer:
radeon:    size      : 65536 bytes
radeon:    alignment : 4096 bytes
radeon:    domains   : 4
radeon:    va        : 0x0000000100000000
radeonsi: Failed to create a context.
libva info: va_openDriver() returns 2
[2021:11:27:16:39:32]: Info: /usr/lib/x86_64-linux-gnu/dri/r600_drv_video.so init failed
[2021:11:27:16:39:32]: Error: Couldn't initialize va display: resource allocation failed
[2021:11:27:16:39:32]: Info: Screencasting with Wayland's protocol
[2021:11:27:16:39:32]: Info: Found display [wayland-0]
[2021:11:27:16:39:32]: Info: Found interface: zxdg_output_manager_v1(9) version 3
[2021:11:27:16:39:32]: Info: Found interface: zwlr_export_dmabuf_manager_v1(25) version 1
[2021:11:27:16:39:32]: Info: Found interface: wl_output(36) version 3
[2021:11:27:16:39:32]: Info: Name: HEADLESS-1
[2021:11:27:16:39:32]: Info: Found monitor: Headless output 1
[2021:11:27:16:39:32]: Info: Offset: 0x0
[2021:11:27:16:39:32]: Info: Resolution: 1280x720
[2021:11:27:16:39:32]: Info: Selected monitor [Headless output 1] for streaming
[2021:11:27:16:39:32]: Info: Color coding [Rec. 601]
[2021:11:27:16:39:32]: Info: Color range: [JPEG]
libva info: VA-API version 1.12.0
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/r600_drv_video.so
libva info: Found init function __vaDriverInit_1_12
libva info: va_openDriver() returns 0
Segmentation fault (core dumped)
BrianAdams commented 2 years ago

Gnome 42 now has a quick way to create virtual monitors... which also have a different connector name:

$ mutter --wayland --headless --virtual-monitor 1920x1080&
...
$ export WAYLAND_DISPLAY=wayland-0
$ sunshine
[2022:07:20:05:42:47]: Error: Failed to create session: Unable to open display
[2022:07:20:05:42:47]: Info: Found display [wayland-0]
[2022:07:20:05:42:47]: Info: Found interface: wl_output(3) version 2
[2022:07:20:05:42:47]: Info: Found interface: zxdg_output_manager_v1(4) version 3
[2022:07:20:05:42:47]: Warning: Missing Wayland wire for wlr-export-dmabuf
[2022:07:20:05:42:47]: Info: Found display [wayland-0]
[2022:07:20:05:42:47]: Info: Found display [wayland-0]
[2022:07:20:05:42:47]: Info: Found interface: wl_output(3) version 2
[2022:07:20:05:42:47]: Info: Found interface: zxdg_output_manager_v1(4) version 3
[2022:07:20:05:42:47]: Info: Offset: 0x0
[2022:07:20:05:42:47]: Info: Resolution: 1920x1080
[2022:07:20:05:42:47]: Info: Name: Meta-0
[2022:07:20:05:42:47]: Info: Found monitor: MetaVendor
[2022:07:20:05:42:47]: Info: Meta-0: MetaVendor
[2022:07:20:05:42:47]: Error: Unknown Monitor connector type [Meta]: Please report this to the Github issue tracker