LizardByte / Sunshine

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

Stuttering on any rendering with PVE + Ubuntu 24.04 VM + vGPU #3308

Open ypei92 opened 1 month ago

ypei92 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?

None

Describe the Bug

Operating system: PVE 8.2.7 + Fresh installed Ubuntu 24.04 virtual machine GPU: NVIDIA GRID RTX6000-12Q (RTX 2080 Ti vGPU) Sunshine version: v0.23.1 Moonlight version: 6.1.0 Connection: 2.5G LAN

Any rendering other than the static desktop causes significant stuttering and FPS drop because GPU usage almost 100%. Tried to change resolution on both the host and the client but it does not help, even at 720p. NVENC is running by executing nvidia-smi -q | grep "Encoder". GPU drivers are patched with https://github.com/keylase/nvidia-patch. I have the same setting except the OS is Windows 10 and everything works very smoothly (Thank you for this software!).

Example:

  1. Cursor on empty desktop: FPS is close to 60Hz, there is not FPS throttling. no_rendering

  2. Moving cursor on icons that invokes some rendering: stuttering and FPS drtop due to GPU usage 100% rendering

Expected Behavior

Smooth experience with no stuttering or FPS drop

Additional Context

Sunshine installation script

# Installation
sudo apt install -f ./sunshine-ubuntu-24.04-amd64.deb

# Access to uinput to create mouse and gamepad events
echo 'KERNEL=="uinput", SUBSYSTEM=="misc", OPTIONS+="static_node=uinput", TAG+="uaccess"' | \
sudo tee /etc/udev/rules.d/60-sunshine.rules
sudo udevadm control --reload-rules
sudo udevadm trigger
sudo modprobe uinput

# Enable permission fro KMS capture
sudo setcap cap_sys_admin+p $(readlink -f $(which sunshine))

Nvidia driver installation script

sudo apt install linux-headers-$(uname -r) gcc make dkms libglvnd-core-dev libglvnd0 libglvnd-dev pkg-config
echo "blacklist nouveau" >> /etc/modprobe.d/blacklist-nouveau.conf
sudo update-initramfs -u -k all

chmod +x ./NVIDIA-Linux-x86_64-535.161.08-grid.run
./NVIDIA-Linux-x86_64-535.161.08-grid.run --compat32-libdir option

Host Operating System

Linux

Operating System Version

Ubuntu 24.04

Architecture

amd64/x86_64

Sunshine commit or version

v0.23.1

Package

Linux - deb

GPU Type

Nvidia

GPU Model

NVIDIA GRID RTX6000-12Q (RTX 2080 Ti vGPU)

GPU Driver/Mesa Version

535.161.08

Capture Method

NvFBC (Linux)

Config

Empty

Apps

No response

Relevant log output

[2024:10:14:21:13:31]: Info: Sunshine version: v0.23.1
[2024:10:14:21:13:31]: Info: System tray created
[2024:10:14:21:13:31]: Info: Found [1] outputs
[2024:10:14:21:13:31]: Info: Virtual Desktop: 3840x2160
[2024:10:14:21:13:31]: Info: XrandR: available
[2024:10:14:21:13:31]: Info: -- Output --
[2024:10:14:21:13:31]: Info:   Resolution: 3840x2160
[2024:10:14:21:13:31]: Info:   Offset: 0x0
[2024:10:14:21:13:31]: Info: Detecting monitors
[2024:10:14:21:13:31]: Info: Detected monitor 0: DVI-D-0, connected: true
[2024:10:14:21:13:31]: Info: Detected monitor 1: DVI-D-1, connected: false
[2024:10:14:21:13:31]: Info: Detected monitor 2: DVI-D-2, connected: false
[2024:10:14:21:13:31]: Info: Detected monitor 3: DVI-D-3, connected: false
[2024:10:14:21:13:31]: Info: // Testing for available encoders, this may generate errors. You can safely ignore those errors. //
[2024:10:14:21:13:31]: Info: Trying encoder [nvenc]
[2024:10:14:21:13:31]: Info: Screencasting with NvFBC
[2024:10:14:21:13:31]: Info: SDR color coding [Rec. 601]
[2024:10:14:21:13:31]: Info: Color depth: 8-bit
[2024:10:14:21:13:31]: Info: Color range: [JPEG]
[2024:10:14:21:13:31]: Info: SDR color coding [Rec. 601]
[2024:10:14:21:13:31]: Info: Color depth: 8-bit
[2024:10:14:21:13:31]: Info: Color range: [JPEG]
[2024:10:14:21:13:32]: Info: SDR color coding [Rec. 601]
[2024:10:14:21:13:32]: Info: Color depth: 8-bit
[2024:10:14:21:13:32]: Info: Color range: [JPEG]
[2024:10:14:21:13:32]: Warning: [av1_nvenc @ 0x5ecbddb00a00] Codec not supported
[2024:10:14:21:13:32]: Error: [av1_nvenc @ 0x5ecbddb00a00] Provided device doesn't support required NVENC features
[2024:10:14:21:13:32]: Error: Could not open codec [av1_nvenc]: Function not implemented
[2024:10:14:21:13:32]: Error: Couldn't destroy session handle: The context is not bound
[2024:10:14:21:13:32]: Info: Screencasting with NvFBC
[2024:10:14:21:13:32]: Info: SDR color coding [Rec. 709]
[2024:10:14:21:13:32]: Info: Color depth: 10-bit
[2024:10:14:21:13:32]: Info: Color range: [JPEG]
[2024:10:14:21:13:32]: Error: cuda::cuda_t doesn't support any format other than AV_PIX_FMT_NV12
[2024:10:14:21:13:32]: Error: Couldn't destroy session handle: The context is not bound
[2024:10:14:21:13:32]: Info:
[2024:10:14:21:13:32]: Info: // Ignore any errors mentioned above, they are not relevant. //
[2024:10:14:21:13:32]: Info:
[2024:10:14:21:13:32]: Info: Found H.264 encoder: h264_nvenc [nvenc]
[2024:10:14:21:13:32]: Info: Found HEVC encoder: hevc_nvenc [nvenc]
[2024:10:14:21:13:32]: Info: Adding avahi service Sunshine
[2024:10:14:21:13:32]: Info: Configuration UI available at [https://localhost:47990]
[2024:10:14:21:13:32]: Info: Avahi service Sunshine successfully established.
[2024:10:14:21:13:53]: Info: // Testing for available encoders, this may generate errors. You can safely ignore those errors. //
[2024:10:14:21:13:53]: Info: Trying encoder [nvenc]
[2024:10:14:21:13:53]: Info: Screencasting with NvFBC
[2024:10:14:21:13:53]: Info: SDR color coding [Rec. 601]
[2024:10:14:21:13:53]: Info: Color depth: 8-bit
[2024:10:14:21:13:53]: Info: Color range: [JPEG]
[2024:10:14:21:13:53]: Info: SDR color coding [Rec. 601]
[2024:10:14:21:13:53]: Info: Color depth: 8-bit
[2024:10:14:21:13:53]: Info: Color range: [JPEG]
[2024:10:14:21:13:53]: Info: SDR color coding [Rec. 601]
[2024:10:14:21:13:53]: Info: Color depth: 8-bit
[2024:10:14:21:13:53]: Info: Color range: [JPEG]
[2024:10:14:21:13:53]: Warning: [av1_nvenc @ 0x79f1507c8a00] Codec not supported
[2024:10:14:21:13:53]: Error: [av1_nvenc @ 0x79f1507c8a00] Provided device doesn't support required NVENC features
[2024:10:14:21:13:53]: Error: Could not open codec [av1_nvenc]: Function not implemented
[2024:10:14:21:13:53]: Error: Couldn't destroy session handle: The context is not bound
[2024:10:14:21:13:53]: Info: Screencasting with NvFBC
[2024:10:14:21:13:53]: Info: SDR color coding [Rec. 709]
[2024:10:14:21:13:53]: Info: Color depth: 10-bit
[2024:10:14:21:13:53]: Info: Color range: [JPEG]
[2024:10:14:21:13:53]: Error: cuda::cuda_t doesn't support any format other than AV_PIX_FMT_NV12
[2024:10:14:21:13:53]: Error: Couldn't destroy session handle: The context is not bound
[2024:10:14:21:13:53]: Info:
[2024:10:14:21:13:53]: Info: // Ignore any errors mentioned above, they are not relevant. //
[2024:10:14:21:13:53]: Info:
[2024:10:14:21:13:53]: Info: Found H.264 encoder: h264_nvenc [nvenc]
[2024:10:14:21:13:53]: Info: Found HEVC encoder: hevc_nvenc [nvenc]
[2024:10:14:21:13:53]: Info: Executing [Desktop]
[2024:10:14:21:13:54]: Info: CLIENT CONNECTED
[2024:10:14:21:13:54]: Info: Found [1] outputs
[2024:10:14:21:13:54]: Info: Virtual Desktop: 3840x2160
[2024:10:14:21:13:54]: Info: XrandR: available
[2024:10:14:21:13:54]: Info: -- Output --
[2024:10:14:21:13:54]: Info:   Resolution: 3840x2160
[2024:10:14:21:13:54]: Info:   Offset: 0x0
[2024:10:14:21:13:54]: Info: Setting default sink to: [sink-sunshine-stereo]
[2024:10:14:21:13:54]: Info: Found default monitor by name: sink-sunshine-stereo.monitor
[2024:10:14:21:13:54]: Info: Screencasting with NvFBC
[2024:10:14:21:13:54]: Info: SDR color coding [Rec. 601]
[2024:10:14:21:13:54]: Info: Color depth: 8-bit
[2024:10:14:21:13:54]: Info: Color range: [MPEG]
[2024:10:14:21:14:34]: Info: CLIENT DISCONNECTED
[2024:10:14:21:14:34]: Info: Setting default sink to: [auto_null]
[2024:10:14:21:14:34]: Error: Couldn't set default-sink [auto_null]: No such entity
[2024:10:14:21:14:34]: Error: Couldn't release NvFBC context from current thread:
[2024:10:14:21:16:47]: Info: // Testing for available encoders, this may generate errors. You can safely ignore those errors. //
[2024:10:14:21:16:47]: Info: Trying encoder [nvenc]
[2024:10:14:21:16:47]: Info: Screencasting with NvFBC
[2024:10:14:21:16:47]: Info: SDR color coding [Rec. 601]
[2024:10:14:21:16:47]: Info: Color depth: 8-bit
[2024:10:14:21:16:47]: Info: Color range: [JPEG]
[2024:10:14:21:16:47]: Info: SDR color coding [Rec. 601]
[2024:10:14:21:16:47]: Info: Color depth: 8-bit
[2024:10:14:21:16:47]: Info: Color range: [JPEG]
[2024:10:14:21:16:47]: Info: SDR color coding [Rec. 601]
[2024:10:14:21:16:47]: Info: Color depth: 8-bit
[2024:10:14:21:16:47]: Info: Color range: [JPEG]
[2024:10:14:21:16:47]: Warning: [av1_nvenc @ 0x79f1507c8a00] Codec not supported
[2024:10:14:21:16:47]: Error: [av1_nvenc @ 0x79f1507c8a00] Provided device doesn't support required NVENC features
[2024:10:14:21:16:47]: Error: Could not open codec [av1_nvenc]: Function not implemented
[2024:10:14:21:16:47]: Error: Couldn't destroy session handle: The context is not bound
[2024:10:14:21:16:47]: Info: Screencasting with NvFBC
[2024:10:14:21:16:47]: Info: SDR color coding [Rec. 709]
[2024:10:14:21:16:47]: Info: Color depth: 10-bit
[2024:10:14:21:16:47]: Info: Color range: [JPEG]
[2024:10:14:21:16:47]: Error: cuda::cuda_t doesn't support any format other than AV_PIX_FMT_NV12
[2024:10:14:21:16:47]: Error: Couldn't destroy session handle: The context is not bound
[2024:10:14:21:16:47]: Info:
[2024:10:14:21:16:47]: Info: // Ignore any errors mentioned above, they are not relevant. //
[2024:10:14:21:16:47]: Info:
[2024:10:14:21:16:47]: Info: Found H.264 encoder: h264_nvenc [nvenc]
[2024:10:14:21:16:47]: Info: Found HEVC encoder: hevc_nvenc [nvenc]
[2024:10:14:21:16:47]: Info: CLIENT CONNECTED
[2024:10:14:21:16:47]: Info: Setting default sink to: [sink-sunshine-stereo]
[2024:10:14:21:16:47]: Info: Found default monitor by name: sink-sunshine-stereo.monitor
[2024:10:14:21:16:49]: Info: Found [1] outputs
[2024:10:14:21:16:49]: Info: Virtual Desktop: 3840x2160
[2024:10:14:21:16:49]: Info: XrandR: available
[2024:10:14:21:16:49]: Info: -- Output --
[2024:10:14:21:16:49]: Info:   Resolution: 3840x2160
[2024:10:14:21:16:49]: Info:   Offset: 0x0
[2024:10:14:21:16:49]: Info: Screencasting with NvFBC
[2024:10:14:21:16:49]: Info: SDR color coding [Rec. 601]
[2024:10:14:21:16:49]: Info: Color depth: 8-bit
[2024:10:14:21:16:49]: Info: Color range: [MPEG]
[2024:10:14:21:17:06]: Info: CLIENT DISCONNECTED
[2024:10:14:21:17:06]: Info: Setting default sink to: [auto_null]
[2024:10:14:21:17:06]: Error: Couldn't set default-sink [auto_null]: No such entity
[2024:10:14:21:17:06]: Error: Couldn't release NvFBC context from current thread:
ReenigneArcher commented 1 month ago

Try the beta/pre-release.

ypei92 commented 1 month ago

Hi, thank you for the support. I tried the most recent pre-release, the same stuttering issue persists:

[2024-10-15 12:37:34.913]: Info: Sunshine version: v2024.1015.41553
[2024-10-15 12:37:34.913]: Info: Package Publisher: LizardByte
[2024-10-15 12:37:34.913]: Info: Publisher Website: https://app.lizardbyte.dev
[2024-10-15 12:37:34.913]: Info: Get support: https://app.lizardbyte.dev/support
[2024-10-15 12:37:34.960]: Info: System tray created
[2024-10-15 12:37:35.343]: Info: Found [1] outputs
[2024-10-15 12:37:35.343]: Info: Virtual Desktop: 1920x1080
[2024-10-15 12:37:35.344]: Info: XrandR: available
[2024-10-15 12:37:35.344]: Info: -- Output --
[2024-10-15 12:37:35.344]: Info:   Resolution: 1920x1080
[2024-10-15 12:37:35.344]: Info:   Offset: 0x0
[2024-10-15 12:37:35.362]: Error: Couldn't release NvFBC context from current thread: 
[2024-10-15 12:37:35.362]: Info: Detecting displays
[2024-10-15 12:37:35.363]: Info: Detected display: DVI-D-0 (id: 0)DVI-D-0 connected: true
[2024-10-15 12:37:35.363]: Info: Detected display: DVI-D-1 (id: 1)DVI-D-1 connected: false
[2024-10-15 12:37:35.363]: Info: Detected display: DVI-D-2 (id: 2)DVI-D-2 connected: false
[2024-10-15 12:37:35.363]: Info: Detected display: DVI-D-3 (id: 3)DVI-D-3 connected: false
[2024-10-15 12:37:35.369]: Warning: Gamepad ds5 is disabled due to Permission denied
[2024-10-15 12:37:35.369]: Info: // Testing for available encoders, this may generate errors. You can safely ignore those errors. //
[2024-10-15 12:37:35.369]: Info: Trying encoder [nvenc]
[2024-10-15 12:37:35.369]: Info: Screencasting with NvFBC
[2024-10-15 12:37:35.437]: Info: Creating encoder [h264_nvenc]
[2024-10-15 12:37:35.437]: Info: Color coding: SDR (Rec. 601)
[2024-10-15 12:37:35.437]: Info: Color depth: 8-bit
[2024-10-15 12:37:35.437]: Info: Color range: JPEG
[2024-10-15 12:37:35.569]: Info: Creating encoder [hevc_nvenc]
[2024-10-15 12:37:35.569]: Info: Color coding: SDR (Rec. 601)
[2024-10-15 12:37:35.569]: Info: Color depth: 8-bit
[2024-10-15 12:37:35.569]: Info: Color range: JPEG
[2024-10-15 12:37:35.643]: Info: Creating encoder [av1_nvenc]
[2024-10-15 12:37:35.643]: Info: Color coding: SDR (Rec. 601)
[2024-10-15 12:37:35.643]: Info: Color depth: 8-bit
[2024-10-15 12:37:35.643]: Info: Color range: JPEG
[2024-10-15 12:37:35.646]: Warning: [av1_nvenc @ 0x616fbed64a40] Codec not supported
[2024-10-15 12:37:35.646]: Error: [av1_nvenc @ 0x616fbed64a40] Provided device doesn't support required NVENC features
[2024-10-15 12:37:35.648]: Error: Could not open codec [av1_nvenc]: Function not implemented
[2024-10-15 12:37:35.689]: Error: Couldn't release NvFBC context from current thread: 
[2024-10-15 12:37:35.689]: Info: Screencasting with NvFBC
[2024-10-15 12:37:35.778]: Info: Creating encoder [hevc_nvenc]
[2024-10-15 12:37:35.779]: Info: Color coding: SDR (Rec. 709)
[2024-10-15 12:37:35.779]: Info: Color depth: 10-bit
[2024-10-15 12:37:35.779]: Info: Color range: JPEG
[2024-10-15 12:37:35.806]: Error: cuda::cuda_t doesn't support any format other than AV_PIX_FMT_NV12
[2024-10-15 12:37:35.849]: Error: Couldn't release NvFBC context from current thread: 
[2024-10-15 12:37:35.849]: Info: 
[2024-10-15 12:37:35.849]: Info: // Ignore any errors mentioned above, they are not relevant. //
[2024-10-15 12:37:35.849]: Info: 
[2024-10-15 12:37:35.849]: Info: Found H.264 encoder: h264_nvenc [nvenc]
[2024-10-15 12:37:35.849]: Info: Found HEVC encoder: hevc_nvenc [nvenc]
[2024-10-15 12:37:35.854]: Info: Adding avahi service ubuntu-dev0
[2024-10-15 12:37:35.858]: Info: Configuration UI available at [https://localhost:47990]
[2024-10-15 12:37:36.848]: Info: Avahi service ubuntu-dev0 successfully established.
[2024-10-15 12:38:07.114]: Info: // Testing for available encoders, this may generate errors. You can safely ignore those errors. //
[2024-10-15 12:38:07.114]: Info: Trying encoder [nvenc]
[2024-10-15 12:38:07.114]: Info: Screencasting with NvFBC
[2024-10-15 12:38:07.220]: Info: Creating encoder [h264_nvenc]
[2024-10-15 12:38:07.220]: Info: Color coding: SDR (Rec. 601)
[2024-10-15 12:38:07.220]: Info: Color depth: 8-bit
[2024-10-15 12:38:07.220]: Info: Color range: JPEG
[2024-10-15 12:38:07.260]: Info: Creating encoder [hevc_nvenc]
[2024-10-15 12:38:07.260]: Info: Color coding: SDR (Rec. 601)
[2024-10-15 12:38:07.260]: Info: Color depth: 8-bit
[2024-10-15 12:38:07.260]: Info: Color range: JPEG
[2024-10-15 12:38:07.290]: Info: Creating encoder [av1_nvenc]
[2024-10-15 12:38:07.290]: Info: Color coding: SDR (Rec. 601)
[2024-10-15 12:38:07.290]: Info: Color depth: 8-bit
[2024-10-15 12:38:07.290]: Info: Color range: JPEG
[2024-10-15 12:38:07.292]: Warning: [av1_nvenc @ 0x7e5660065f80] Codec not supported
[2024-10-15 12:38:07.292]: Error: [av1_nvenc @ 0x7e5660065f80] Provided device doesn't support required NVENC features
[2024-10-15 12:38:07.293]: Error: Could not open codec [av1_nvenc]: Function not implemented
[2024-10-15 12:38:07.311]: Error: Couldn't release NvFBC context from current thread: 
[2024-10-15 12:38:07.311]: Info: Screencasting with NvFBC
[2024-10-15 12:38:07.382]: Info: Creating encoder [hevc_nvenc]
[2024-10-15 12:38:07.382]: Info: Color coding: SDR (Rec. 709)
[2024-10-15 12:38:07.382]: Info: Color depth: 10-bit
[2024-10-15 12:38:07.382]: Info: Color range: JPEG
[2024-10-15 12:38:07.399]: Error: cuda::cuda_t doesn't support any format other than AV_PIX_FMT_NV12
[2024-10-15 12:38:07.430]: Error: Couldn't release NvFBC context from current thread: 
[2024-10-15 12:38:07.430]: Info: 
[2024-10-15 12:38:07.430]: Info: // Ignore any errors mentioned above, they are not relevant. //
[2024-10-15 12:38:07.430]: Info: 
[2024-10-15 12:38:07.430]: Info: Found H.264 encoder: h264_nvenc [nvenc]
[2024-10-15 12:38:07.430]: Info: Found HEVC encoder: hevc_nvenc [nvenc]
[2024-10-15 12:38:07.430]: Info: Executing [Desktop]
[2024-10-15 12:38:07.554]: Info: CLIENT CONNECTED
[2024-10-15 12:38:07.645]: Info: Found [1] outputs
[2024-10-15 12:38:07.645]: Info: Virtual Desktop: 1920x1080
[2024-10-15 12:38:07.645]: Info: XrandR: available
[2024-10-15 12:38:07.645]: Info: -- Output --
[2024-10-15 12:38:07.645]: Info:   Resolution: 1920x1080
[2024-10-15 12:38:07.645]: Info:   Offset: 0x0
[2024-10-15 12:38:07.666]: Error: Couldn't release NvFBC context from current thread: 
[2024-10-15 12:38:07.666]: Info: Screencasting with NvFBC
[2024-10-15 12:38:07.989]: Info: Setting default sink to: [sink-sunshine-stereo]
[2024-10-15 12:38:07.990]: Info: Found default monitor by name: sink-sunshine-stereo.monitor
[2024-10-15 12:38:08.019]: Info: Opus initialized: 48 kHz, 2 channels, 96 kbps (total), LOWDELAY
[2024-10-15 12:38:08.108]: Info: Creating encoder [hevc_nvenc]
[2024-10-15 12:38:08.108]: Info: Color coding: SDR (Rec. 601)
[2024-10-15 12:38:08.108]: Info: Color depth: 8-bit
[2024-10-15 12:38:08.108]: Info: Color range: MPEG
[2024-10-15 12:38:28.789]: Info: CLIENT DISCONNECTED
[2024-10-15 12:38:28.798]: Info: Setting default sink to: [auto_null]
[2024-10-15 12:38:28.798]: Error: Couldn't set default-sink [auto_null]: No such entity
[2024-10-15 12:38:28.852]: Error: Couldn't release NvFBC context from current thread: 
[2024-10-15 12:38:28.852]: Error: Couldn't release NvFBC context from current thread: