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

Cannot stream headless/virtual monitors created by evdi on X11 #943

Closed
3 tasks done
chaserhkj opened this issue Feb 17, 2023 · 5 comments
Closed
3 tasks done

Cannot stream headless/virtual monitors created by evdi on X11 #943

chaserhkj opened this issue Feb 17, 2023 · 5 comments
Labels
os:Linux:Arch OS is Arch Linux os:Linux:Debian OS is Debian os:Linux:Fedora OS is Fedora stale

Comments

@chaserhkj
Copy link

chaserhkj commented Feb 17, 2023

Is there an existing issue for this?

  • I have searched the existing issues

Is your issue described in the documentation?

  • I have read the documentation

Is your issue present in the nightly release?

  • This issue is present in the nightly release

Describe the Bug

On my setup, I have created a headless/virtual monitor using the evdi driver solely for steaming purposes. (As suggested in this post)

After config the virtual monitor DVI-I-1-1, I got:

$ xrandr --listmonitors
Monitors: 4
 0: +*HDMI-0 1920/598x1080/336+0+1080  HDMI-0
 1: +DP-1 1920/477x1080/268+0+0  DP-1
 2: +DP-3 1920/476x1080/268+1920+1080  DP-3
 3: +DVI-I-1-1 1024/271x768/203+3840+1080  DVI-I-1-1

I can capture the virtual monitor using any other capturing mechanism. But in sunshine after setting output_name = 3 I got:

Error: Could not stream display number [3], there are only [3] displays.

(Full log attached at the end)

Expected Behavior

Sunshine starts normally and opening app Desktop in a client would show the desktop from the virtual monitor.

Additional Context

The core cause of this bug here is that such a virtual monitor in X11 is shown as disconnected but still mapped to part of the screen (i.e. has associated crtc).

In sunshine when we are enumerating the monitors through X11 here and here, we are checking if the monitors are connected, thus a mapped but disconnected virtual monitor will not be enumerated.

I would suggest change the test lines mentioned above from out_info && out_info->connection == RR_Connected to out_info && out_info->crtc, checking if the monitor is mapped rather than check the connection status.

I have personally tried the suggested change and it would work on my setup. However I do feel such change will have implications on other X11grab housekeeping code in the context thus feel refrained from doing a PR directly. Please let me know if you guys feel this discussion makes more sense in a form of PR.

Host Operating System

Linux

Operating System Version

Arch Linux rolling

Architecture

64 bit

Sunshine commit or version

0.18.2

Package

Linux - AUR

GPU Type

Nvidia

GPU Model

GeForce RTX 2070

GPU Driver/Mesa Version

525.89.02

Capture Method (Linux Only)

X11

Relevant log output

LOG:
[amd_vbaq] -- [enabled]
[amd_preanalysis] -- [disabled]
[amd_coder] -- [auto]
[upnp] -- [disabled]
[nv_preset] -- [p4]
[nv_tune] -- [ull]
[hevc_mode] -- [0]
[nv_rc] -- [vbr]
[qsv_preset] -- [medium]
[fps] -- [[10,30,60,90,120]]
[vt_coder] -- [auto]
[amd_rc] -- [vbr_latency]
[output_name] -- [3]
[min_log_level] -- [2]
[vt_realtime] -- [enabled]
[key_rightalt_to_key_win] -- [disabled]
[amd_usage] -- [ultralowlatency]
[origin_pin_allowed] -- [pc]
[resolutions] -- [[
    352x240,
    480x360,
    858x480,
    1280x720,
    1920x1080,
    2560x1080,
    3440x1440,
    1920x1200,
    3860x2160,
    3840x1600
]]
[nv_coder] -- [cabac]
[qsv_coder] -- [auto]
[gamepad] -- [x360]
[dwmflush] -- [enabled]
[origin_web_ui_allowed] -- [lan]
[vt_software] -- [auto]
[amd_quality] -- [balanced]
[2023:02:16:22:41:40]: Error: Failed to create session: This hardware does not support NvFBC
[2023:02:16:22:41:40]: Error: Failed to gain CAP_SYS_ADMIN
[2023:02:16:22:41:40]: Error: Failed to gain CAP_SYS_ADMIN
[2023:02:16:22:41:40]: Error: Couldn't get handle for DRM Framebuffer [39]: Possibly not permitted: do [sudo setcap cap_sys_admin+p sunshine]
[2023:02:16:22:41:40]: Error: Failed to gain CAP_SYS_ADMIN
[2023:02:16:22:41:40]: Error: Failed to gain CAP_SYS_ADMIN
[2023:02:16:22:41:40]: Error: Environment variable WAYLAND_DISPLAY has not been defined
[2023:02:16:22:41:40]: Info: Detecting connected monitors
[2023:02:16:22:41:41]: Info: // Testing for available encoders, this may generate errors. You can safely ignore those errors. //
[2023:02:16:22:41:41]: Info: Trying encoder [nvenc]
[2023:02:16:22:41:41]: Info: Screencasting with X11
[2023:02:16:22:41:41]: Info: Configuring selected monitor (3) to stream
[2023:02:16:22:41:41]: Error: Could not stream display number [3], there are only [3] displays.
[2023:02:16:22:41:41]: Info: Screencasting with X11
[2023:02:16:22:41:41]: Info: Configuring selected monitor (3) to stream
[2023:02:16:22:41:42]: Error: Could not stream display number [3], there are only [3] displays.
[2023:02:16:22:41:42]: Info: Screencasting with X11
[2023:02:16:22:41:42]: Info: Configuring selected monitor (3) to stream
[2023:02:16:22:41:43]: Error: Could not stream display number [3], there are only [3] displays.
[2023:02:16:22:41:43]: Info: Screencasting with X11
[2023:02:16:22:41:43]: Info: Configuring selected monitor (3) to stream
[2023:02:16:22:41:43]: Error: Could not stream display number [3], there are only [3] displays.
[2023:02:16:22:41:43]: Info: Screencasting with X11
[2023:02:16:22:41:43]: Info: Configuring selected monitor (3) to stream
[2023:02:16:22:41:44]: Error: Could not stream display number [3], there are only [3] displays.
<Forced Quit>

CONFIG:
fps = [10,30,60,90,120]
vt_coder = auto
amd_rc = vbr_latency
vt_realtime = enabled
key_rightalt_to_key_win = disabled
resolutions = [
    352x240,
    480x360,
    858x480,
    1280x720,
    1920x1080,
    2560x1080,
    3440x1440,
    1920x1200,
    3860x2160,
    3840x1600
]
origin_pin_allowed = pc
gamepad = x360
nv_coder = cabac
dwmflush = enabled
min_log_level = 2
vt_software = auto
amd_quality = balanced
origin_web_ui_allowed = lan
nv_rc = vbr
hevc_mode = 0
nv_tune = ull
nv_preset = p4
upnp = disabled
amd_coder = auto
qsv_preset = medium
qsv_coder = auto
amd_preanalysis = disabled
amd_usage = ultralowlatency
amd_vbaq = enabled
output_name = 3
@nhobson99
Copy link

nhobson99 commented Feb 22, 2023

I second this as an issue. I created a virtual monitor with xrandr as follows:

$ xrandr --fb 3200x1080 --output eDP-1 --panning 1920x1080/3200x1080
$ xrandr --setmonitor virtual 1280/140x800/100+1920+0 none
$ xrandr --listmonitors 
Monitors: 2
 0: +*eDP-1 1920/294x1080/165+0+0  eDP-1
 1: virtual 1280/140x800/100+1920+0

Sunshine server gives me the same error during initialization, then exits.

[2023:02:22:12:33:40]: Info: Configuring selected monitor (1) to stream
[2023:02:22:12:33:40]: Error: Could not stream display number [1], there are only [1] displays.

EDIT: To add more detail. I am using libx264, and the host system is ARM based (Acer Spin 513 running Cadmium OS). The distro is Ubuntu 22.04 with Linux kernel 6.0. The Linux kernel and Sunshine were both compiled by me.

@nhobson99
Copy link

I was unable to reproduce the issue using evdi because the kernel module fails to load on my kernel. But I tested with a display actually plugged in, and can now confirm that Sunshine will stream the secondary monitor with CRTC, which means I need something like a dummy plug to get it to work. Interestingly enough, the xrandr method didn't ever extend my desktop in KDE Plasma, so I think this method is just outdated.

Unplugging the display naturally bugs out the video stream and crashes Sunshine, which makes sense. However, attempting to force that disconnected display port to be active using xrandr does not allow it to be streamed via Sunshine (because of the lack of CRTC).

I think this issue can stay focused on evdi as the xrandr method is fundamentally broken.

@Nonary Nonary added bug Something isn't working os:Linux:Arch OS is Arch Linux os:Linux:Debian OS is Debian os:Linux:Fedora OS is Fedora labels Mar 9, 2023
@Nonary
Copy link
Collaborator

Nonary commented Mar 9, 2023

@chaserhkj Pull requests are encouraged for issues like this one. Since you've stated you have a proof of concept that fixes this issue, can you submit the pull request and reference this issue?

@LizardByte-bot
Copy link
Member

This issue is stale because it has been open for 90 days with no activity. Comment or remove the stale label, otherwise this will be closed in 10 days.

@LizardByte-bot
Copy link
Member

This issue was closed because it has been stalled for 10 days with no activity.

@LizardByte-bot LizardByte-bot closed this as not planned Won't fix, can't repro, duplicate, stale Jun 19, 2023
@ReenigneArcher ReenigneArcher removed the bug Something isn't working label Jan 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
os:Linux:Arch OS is Arch Linux os:Linux:Debian OS is Debian os:Linux:Fedora OS is Fedora stale
Projects
None yet
Development

No branches or pull requests

6 participants
@chaserhkj @Nonary @ReenigneArcher @nhobson99 @LizardByte-bot and others