ValveSoftware / steam-for-linux

Issue tracking for the Steam for Linux beta client
4.26k stars 174 forks source link

Slow framerate, high latency, input lag during Remote Play of Vulkan games on Ubuntu to Steam Link (SlowGamePercent) #11053

Open Davidian1024 opened 5 months ago

Davidian1024 commented 5 months ago

Your system information

Please describe your issue in as much detail as possible:

When I stream games to a Steam Link device (I have tested with a Raspberry Pi 4B and an Androind phone) I get very low FPS for any Vulkan based game. Games using OpenGL seem unaffected. I think all of the games I run with Proton are affected by this. I think those all use Vulkan now.

In ~/.local/share/Steam/logs/streaming_log.txt I see lines like these: Slow framerate: game 45.95, capture 0.51, convert 0.01, encode 13.89, network 9.30, decode 1.67, display 7.88 (game) Followed by a SessionStats section that mentions SlowGamePercent with a number that's usually above 20. While all the other Slow...Percent stats are 0.

I can most easily determine which games are using Vulkan or OpenGL with the Remote Play Client Details Performance Overlay. For Vulkan games the encoder is reported as Game Vulkan NV12. For OpenGL games is is Game Delayed OpenGL NV12.

I have tried many many different combinations of both advanced host and client options under Steam's Remote Play settings. Nothing seems to improve the situation when streaming Vulkan games.

Steps for reproducing this issue:

Launch a Vulkan based game directly on the Ubuntu host with the Steam In-game FPS Counter enabled. Observe a high framerate. Launch the same game on the same host through a Steam Link device. Observe a low framerate.

Games I've spent the most time testing with: Vulkan Games (Encoder: Game Vulkan NV12)

OpenGL Games (Encoder: Game Delayed OpenGL NV12)

For what it's worth I see roughly the exact same FPS for any Vulkan game when streamed to any of my Steam Link devices. It's almost always 22FPS or very close to that number.

kokossVN commented 5 months ago

same issue for me, ~2 weeks ago my encoder has change from NVENC to libx264 ( using cpu for encoding ) and very laggy

in my streaming log, ffmpeg cant find my nvidia driver in lib32

Video Encoder Changed                                                                                
>>> Capture method set to Desktop OpenGL NV12 + NVENC HEVC                                           
>>> Capture resolution set to 1260x788                                                               
>>> Capture colorspace set to BT.601 limited range                                                   
NVENC - Submitting frame for encoding failed: 20                                                     
CGameStreamVideoStageVAAPI: Reinitializing 1260x788 at 5000 Kbit/s and 60.00 FPS with quality 0      
ffmpeg verbose: libva: VA-API version 1.21.0                                                         
ffmpeg verbose: libva: User environment variable requested driver 'nvidia'                           
ffmpeg verbose: libva: Trying to open /usr/lib32/dri/nvidia_drv_video.so                             
ffmpeg verbose: libva: va_openDriver() returns -1                                                    
ffmpeg error: Failed to initialise VAAPI connection: -1 (unknown libva error).                       
CGameStreamVideoStageVAAPI: Failed to create device context: Input/output error                      
Detected 4 logical processors, using 3 threads                                                       
Configuring encoder: [threads=3][width=1260][height=788][preset=superfast][tune=zerolatency]         
Video Encoder Changed                                                                                
>>> Capture method set to Desktop OpenGL NV12 + libx264 main (3 threads)
rstrube commented 2 months ago

I've also been running into this same issue with Nvidia driver version > 555. NVENC is not being used, and the host falls back to software encoding.

I believe it's the same issue that's being tracked over here: https://github.com/ValveSoftware/steam-for-linux/issues/10984