LizardByte / Sunshine

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

Unable to connect to IddSampleDriver display #2076

Closed Klapeyron closed 3 months ago

Klapeyron commented 9 months ago

Is there an existing issue for this?

Is your issue described in the documentation?

Is your issue present in the nightly release?

Describe the Bug

I have a setup with NVIDIA 4090 and integrated AMD graphics cards:

Zrzut ekranu 2024-01-30 o 10 35 49

Display#10 is IddSampleDriver and Display#1 is HDMI plug connected to HDMI port on NVIDIA 4090. For some reason, moonlight is not able to connect to sunshine once display is set as Display#10 ('Output Name' in Audio/Video settings), there is black screen on the client for few seconds and an error indicating that it does not recieve signal on ports 47998 and 48000. If I set it to Display#1 I am able to connect and then change the screen with Ctrl + Alt + Shift + F1-F2, virtual display works as expected.

In addition, if I unplug the HDMI plug and keep only virtual desktop and leave 'Output Name' empty, then moonlight is not able to connect as well.

Here is my device manager configuration:

Zrzut ekranu 2024-01-30 o 10 34 41 Zrzut ekranu 2024-01-30 o 10 34 30

Expected Behavior

I would like to connect to virtual display driver.

Additional Context

No response

Host Operating System

Windows

Operating System Version

11

Architecture

64 bit

Sunshine commit or version

0.21.0

Package

Windows - installer

GPU Type

Nvidia

GPU Model

GeForce RTX 4090

GPU Driver/Mesa Version

551.23

Capture Method (Linux Only)

No response

Config

av1_mode = 3
hevc_mode = 3
min_log_level = 1
output_name = \\.\DISPLAY1

Apps

No response

Relevant log output

On sunshine side I am getting:

[2024:01:30:09:57:20]: Error: DuplicateOutput() test failed [0x887A0004]

Full log is available here. Here is part of the log from sunshine around moonlight client connection:

---End Response---
[2024:01:30:09:57:19]: Debug: handle_read(): Handle read of size: 1072 bytes
[2024:01:30:09:57:19]: Debug: handle_payload(): Handle read of size: 900 bytes
[2024:01:30:09:57:19]: Debug: Found Content-Length: 1386 bytes
[2024:01:30:09:57:19]: Debug: handle_payload(): Handle read of size: 486 bytes
[2024:01:30:09:57:19]: Debug: Found Content-Length: 1386 bytes
[2024:01:30:09:57:19]: Debug: type [REQUEST]
[2024:01:30:09:57:19]: Debug: sequence number [6]
[2024:01:30:09:57:19]: Debug: protocol :: RTSP/1.0
[2024:01:30:09:57:19]: Debug: payload :: v=0
o=android 0 14 IN IPv4 192.168.1.22
s=NVIDIA Streaming Client
a=x-ml-general.featureFlags:1 
a=x-nv-video[0].clientViewportWd:3840 
a=x-nv-video[0].clientViewportHt:2160 
a=x-nv-video[0].maxFPS:120 
a=x-nv-video[0].packetSize:1392 
a=x-nv-video[0].rateControlMode:4 
a=x-nv-video[0].timeoutLengthMs:7000 
a=x-nv-video[0].framesWithInvalidRefThreshold:0 
a=x-nv-video[0].initialBitrateKbps:100000 
a=x-nv-video[0].initialPeakBitrateKbps:100000 
a=x-nv-vqos[0].bw.minimumBitrateKbps:100000 
a=x-nv-vqos[0].bw.maximumBitrateKbps:100000 
a=x-nv-vqos[0].fec.enable:1 
a=x-nv-vqos[0].videoQualityScoreUpdateTime:5000 
a=x-nv-vqos[0].qosTrafficType:5 
a=x-nv-aqos.qosTrafficType:4 
a=x-nv-general.featureFlags:167 
a=x-nv-general.useReliableUdp:13 
a=x-nv-vqos[0].fec.minRequiredFecPackets:2 
a=x-nv-vqos[0].bllFec.enable:0 
a=x-nv-vqos[0].drc.enable:0 
a=x-nv-general.enableRecoveryMode:0 
a=x-nv-video[0].videoEncoderSlicesPerFrame:1 
a=x-nv-clientSupportHevc:1 
a=x-nv-vqos[0].bitStreamFormat:1 
a=x-nv-video[0].dynamicRangeMode:1 
a=x-nv-video[0].maxNumReferenceFrames:0 
a=x-nv-video[0].clientRefreshRateX100:0 
a=x-nv-audio.surround.numChannels:8 
a=x-nv-audio.surround.channelMask:1599 
a=x-nv-audio.surround.enable:1 
a=x-nv-audio.surround.AudioQuality:1 
a=x-nv-aqos.packetDuration:5 
a=x-nv-video[0].encoderCscMode:0 
t=0 0
m=video 47998  
[2024:01:30:09:57:19]: Debug: command :: ANNOUNCE
[2024:01:30:09:57:19]: Debug: target :: streamid=control/13/0
[2024:01:30:09:57:19]: Debug: CSeq :: 6
[2024:01:30:09:57:19]: Debug: X-GS-ClientVersion :: 14
[2024:01:30:09:57:19]: Debug: Host :: 192.168.1.22
[2024:01:30:09:57:19]: Debug: Session :: DEADBEEFCAFE
[2024:01:30:09:57:19]: Debug: Content-type :: application/sdp
[2024:01:30:09:57:19]: Debug: Content-length :: 1386
[2024:01:30:09:57:19]: Debug: ---Begin MessageBuffer---
ANNOUNCE
---End MessageBuffer---
[2024:01:30:09:57:19]: Debug: /CN=NVIDIA GameStream Client -- verified
[2024:01:30:09:57:19]: Debug: TUNNEL :: HTTPS
[2024:01:30:09:57:19]: Debug: METHOD :: GET
[2024:01:30:09:57:19]: Debug: DESTINATION :: /serverinfo
[2024:01:30:09:57:19]: Debug: User-Agent -- Mozilla/5.0
[2024:01:30:09:57:19]: Debug: Accept-Language -- pl-PL,en,*
[2024:01:30:09:57:19]: Debug: Accept-Encoding -- gzip, deflate
[2024:01:30:09:57:19]: Debug: Connection -- Keep-Alive
[2024:01:30:09:57:19]: Debug: Host -- 192.168.1.22:47984
[2024:01:30:09:57:19]: Debug:  [--] 
[2024:01:30:09:57:19]: Debug: uuid -- aa23437dbe114094ad6a9b0169e6a621
[2024:01:30:09:57:19]: Debug: uniqueid -- 0123456789ABCDEF
[2024:01:30:09:57:19]: Debug:  [--] 
[2024:01:30:09:57:19]: Info: nvprefs: No need to modify application profile settings
[2024:01:30:09:57:19]: Info: nvprefs: No need to modify global profile settings
[2024:01:30:09:57:19]: Debug: ---Begin Response---
RTSP/1.0 200 OK
CSeq: 6

---End Response---
[2024:01:30:09:57:19]: Debug: handle_read(): Handle read of size: 95 bytes
[2024:01:30:09:57:19]: Debug: handle_payload(): Handle read of size: 0 bytes
[2024:01:30:09:57:19]: Debug: type [REQUEST]
[2024:01:30:09:57:19]: Debug: sequence number [7]
[2024:01:30:09:57:19]: Debug: protocol :: RTSP/1.0
[2024:01:30:09:57:19]: Debug: payload :: 
[2024:01:30:09:57:19]: Debug: command :: PLAY
[2024:01:30:09:57:19]: Debug: target :: /
[2024:01:30:09:57:19]: Debug: CSeq :: 7
[2024:01:30:09:57:19]: Debug: X-GS-ClientVersion :: 14
[2024:01:30:09:57:19]: Debug: Host :: 192.168.1.22
[2024:01:30:09:57:19]: Debug: Session :: DEADBEEFCAFE
[2024:01:30:09:57:19]: Debug: ---Begin MessageBuffer---
PLAY
---End MessageBuffer---
[2024:01:30:09:57:19]: Debug: ---Begin Response---
RTSP/1.0 200 OK
CSeq: 7

---End Response---
[2024:01:30:09:57:19]: Info: CLIENT CONNECTED
[2024:01:30:09:57:19]: Debug: type [IDX_REQUEST_IDR_FRAME]
[2024:01:30:09:57:19]: Debug: type [IDX_START_B]
[2024:01:30:09:57:19]: Debug: RAISE: 192.168.1.188:61073 :: VIDEO
[2024:01:30:09:57:19]: Debug: Received ping from 192.168.1.188:61073 [474E4950]
[2024:01:30:09:57:19]: Debug: Start capturing Video
[2024:01:30:09:57:19]: Debug: Detecting monitors...
[2024:01:30:09:57:19]: Debug: 
====== ADAPTER =====
Device Name      : AMD Radeon(TM) Graphics
Device Vendor ID : 0x00001002
Device Device ID : 0x0000164E
Device Video Mem : 485 MiB
Device Sys Mem   : 0 MiB
Share Sys Mem    : 15946 MiB

    ====== OUTPUT ======
[2024:01:30:09:57:19]: Debug:     Output Name       : \\.\DISPLAY1
    AttachedToDesktop : yes
    Resolution        : 1920x1080

[2024:01:30:09:57:19]: Debug: --begin relative mouse move packet--
deltaX [1]
deltaY [1]
--end relative mouse move packet--
[2024:01:30:09:57:19]: Debug: --begin relative mouse move packet--
deltaX [-1]
deltaY [-1]
--end relative mouse move packet--
[2024:01:30:09:57:20]: Debug: RAISE: 192.168.1.188:62935 :: AUDIO
[2024:01:30:09:57:20]: Debug: Received ping from 192.168.1.188:62935 [474E4950]
[2024:01:30:09:57:20]: Debug: Start capturing Audio
[2024:01:30:09:57:20]: Debug: Stereo: supported
[2024:01:30:09:57:20]: Debug: Surround 5.1: supported
[2024:01:30:09:57:20]: Debug: Surround 7.1: supported
[2024:01:30:09:57:20]: Debug: Stereo: supported
[2024:01:30:09:57:20]: Debug: Surround 5.1: supported
[2024:01:30:09:57:20]: Debug: Surround 7.1: supported
[2024:01:30:09:57:20]: Debug: Stereo: supported
[2024:01:30:09:57:20]: Debug: Surround 5.1: supported
[2024:01:30:09:57:20]: Debug: Surround 7.1: supported
[2024:01:30:09:57:20]: Error: DuplicateOutput() test failed [0x887A0004]
[2024:01:30:09:57:20]: Debug:     Output Name       : \\.\DISPLAY10
    AttachedToDesktop : yes
    Resolution        : 3840x2160

[2024:01:30:09:57:20]: Debug: Stereo: supported
[2024:01:30:09:57:20]: Debug: Surround 5.1: supported
[2024:01:30:09:57:20]: Debug: Surround 7.1: supported
[2024:01:30:09:57:20]: Debug: 
RealZack commented 9 months ago

trz to Disable the igpu

Klapeyron commented 9 months ago

@RealZack thanks, disabling iGPU in BIOS solves this

SanderloProductions commented 9 months ago

I have the same issue.

What does it mean to disable the iGPU? (How do I do it and what does it mean)

And isn't that a quite invasive thing to do on my laptop that's used for other things than Moonlight?

Can't this be fixed in other ways?

Klapeyron commented 9 months ago

Probably your laptop has 2 graphics cards, one integrated in Cpu and other dedicated like NVidia. You can try to disable integrated card in BIOS settings or try in Windows device manager (I disabled in BIOS permanently).

Can't this be fixed in other ways?

I tried to set in Sunshine settings to always use my dedicated card and I set to run Sunshine always on dedicated card (you force some apps to run on given graphics card like games etc.). None of them worked for me

SanderloProductions commented 9 months ago

Thank you for the guide - I'll try to see if that helps.

I however see that this issue has been "closed", but I guess that there in fact is an issue, as it's still very much of a quite invasive workaround to make it work (the iGPU is great when using a laptop as a laptop).

Is it possible to get this issue opened again?

Without knowing about the technical details, my other streaming apps like Steam Link and Google Chrome Remote Desktop work fine with the virtual screen, so I guess it should be possible for Sunshine as well? Also, when I installed the virtual display driver at first it worked fine - but after restarting my computer it stopped working.

SanderloProductions commented 8 months ago

I have now disabled the integrated graphics card - just in Windows Device Manager by following the guide you sent. And it did make it work :-) so thank you very much.

Would you however consider to reopen the issue as this is still a bug in Sunshine even though there is this workaround?

Nonary commented 8 months ago

Thank you for the guide - I'll try to see if that helps.

I however see that this issue has been "closed", but I guess that there in fact is an issue, as it's still very much of a quite invasive workaround to make it work (the iGPU is great when using a laptop as a laptop).

Is it possible to get this issue opened again?

Without knowing about the technical details, my other streaming apps like Steam Link and Google Chrome Remote Desktop work fine with the virtual screen, so I guess it should be possible for Sunshine as well? Also, when I installed the virtual display driver at first it worked fine - but after restarting my computer it stopped working.

I am looking into it, but as for it being a Sunshine bug, no its not a Sunshine issue.

It's a problem with DXGI, and the trick is figuring out how to make IddSampleDriver always attach to the dedicated GPU. If I ever figure out a way, I will let you know. otherwise, this is not really fixable.

DR34M3R-T commented 8 months ago

Thank you for the guide - I'll try to see if that helps. I however see that this issue has been "closed", but I guess that there in fact is an issue, as it's still very much of a quite invasive workaround to make it work (the iGPU is great when using a laptop as a laptop). Is it possible to get this issue opened again? Without knowing about the technical details, my other streaming apps like Steam Link and Google Chrome Remote Desktop work fine with the virtual screen, so I guess it should be possible for Sunshine as well? Also, when I installed the virtual display driver at first it worked fine - but after restarting my computer it stopped working.

I am looking into it, but as for it being a Sunshine bug, no its not a Sunshine issue.

It's a problem with DXGI, and the trick is figuring out how to make IddSampleDriver always attach to the dedicated GPU. If I ever figure out a way, I will let you know. otherwise, this is not really fixable.

Many thanks. I am suffering from the same bug. Things got worked after I switch the Intel Xe GPU to "disabled". But an interesting thing happens: after I successfully streamed my virtual display to my pad, I tried to switch the Intel Xe GPU to "enabled" again. Then the screen on my pad froze at once. After a while I switched the iGPU back to "enabled", and the frozen screen on my pad recovered at once. I don't know whether it is the phenomenon "IddSampleDriver cannot always attach to the dedicated GPU" in your description, but I hope this bug can be fixed. Making the iGPU always disabled doesn't seem like a good solution.

HeChengH commented 7 months ago

Probably your laptop has 2 graphics cards, one integrated in Cpu and other dedicated like NVidia. You can try to disable integrated card in BIOS settings or try in Windows device manager (I disabled in BIOS permanently).

Can't this be fixed in other ways?

I tried to set in Sunshine settings to always use my dedicated card and I set to run Sunshine always on dedicated card (you force some apps to run on given graphics card like games etc.). None of them worked for me

I only have iGPU but also get into the same problem. What can I do?