LizardByte / Sunshine

Self-hosted game stream host for Moonlight.
http://app.lizardbyte.dev/Sunshine/
GNU General Public License v3.0
17.71k stars 856 forks source link

Black screen with multiple GPUs with virtual display, isolated to simply multiple GPUs #2875

Open Apprisco opened 1 month ago

Apprisco commented 1 month ago

Is there an existing issue for this?

Is your issue described in the documentation?

Is your issue present in the latest beta/pre-release?

This issue is present in the latest pre-release

Describe the Bug

I have 2 tesla T4 virtualized in a Windows VM with Proxmox VE (latest). When I only passthrough 1 GPU, Sunshine does not complain. I'm using the Virtual Display Driver for this, and it works great.

However, when I passthrough both gpus on the SeaBIOS VM, Sunshine returns a black screen then disconnects me for "no video from host". Inputs and Audio are working as intended.

There is no network to consider here as it's localhost. The only thing differentiating the working setup from the non-working setup is the SeaBIOS (legacy, which should have 0 effect) and the fact that I have 2 Tesla T4s in this case, not 1.

I have tried restricting Sunshine to either gPU to no avail. I've tried telling Sunshine to only use NVENC. I've tried changing the autodetect capture APIs from duplication to the beta to no avail. I have tried HEVC vs H264 to no avail. I have tried every configuration option that could affect this to no avail.

I know that my virtualized setup and gpus with no display out will definitely raise some eyebrows, but again, the setup works with a single GPU with no complaints. However I must pass through both gpus to the windows VM, and there's no reason for this not to work as such.

Most importantly, other remote options such as Parsec, Anydesk, Teamviewer all have no complaints. It is only Sunshine that is causing this issue, but I much prefer sunshine over all alternatives.

https://pastebin.com/RVy5qApc Debug logs

Expected Behavior

With multiple GPUs, sunshine should choose one and not display a black screen or "no video received from host" and exit.

Additional Context

No response

Host Operating System

Windows

Operating System Version

11 Pro (latest)

Architecture

64 bit

Sunshine commit or version

v2024.715.152002

Package

Windows - installer

GPU Type

Nvidia

GPU Model

Tesla T4

GPU Driver/Mesa Version

552.74

Capture Method

Desktop Duplication API (Windows)

Config

encoder = nvenc
sunshine_name = MSKontakt
port = 49000
resolutions = [
    3440x1440
]
fps = [120]
min_threads = 6
av1_mode = 1

Apps

N/A

Relevant log output

https://pastebin.com/RVy5qApc
Apprisco commented 1 month ago

Issue seems to originate from having two IDENTICAL gpus, down to the vendor ID. So there is no way to really tell Sunshine to use the correct gpu for the virtual display driver.

Disabling one of the GPUs allows Sunshine to work without any issues. BIOS is clearly not an issue, it is simply that Sunshine gets confused on which GPU to grab if they have identical names and vendor ids due to being identical GPUs... should be using LUIDs instead.

Nonary commented 4 weeks ago

I have found the root cause and looking into seeing if I can fix it, but not entirely familiar with DXGI so it may take awhile.

It's caused by probe_for_gpu_preference in src/platform/windows/display_base.cpp

The intent of that function was to allow hybrid GPU setups, which by design it is supposed to ignore virtual outputs, but it unintentionally causes breaking behavior with IDDSampleDriver.

A quick fix? Tell the method to always return false... otherwise, hope to find a real solution soon after research

Nonary commented 4 weeks ago

I've identified the bug and fixed it, I'm just polishing the code and will submit a PR later today for review and resolution.