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

Enabling Freesync on the host halves capture framerate #2499

Closed Slashic closed 3 months ago

Slashic commented 7 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

Issue: When Freesync is enabled the stream capture as shown in the status is half of the actual game framerate, ex: 45fps (moonlight stats) and the game running at 80fps as shown by the steam FPS counter. No v-sync is enabled in the game/drivers and the game runs in exclusive fullscreen (also tested with borderless windowed, same issue)

Streaming from a host with: Radeon 7900 XTX (AMD VCE/AMF encoder) 4K 120hz HDR Moonlight v5.0.1

Client: Radeon 6600 (HW decoding) 4K 120hz HDR Moonlight v5.0.1

Tested with Horizon Forbidden West, GranBlue Fantasy Re:Link

Once freesync disabled the streams behaves as intended and the stream is perfectly in sync with the game.

Horizon

Expected Behavior

The capture/stream framerate should be in sync with the game framerate whether freesync is enabled or not.

Additional Context

Also tested on 2024-05-02T17:52:54Z: same issue

Host Operating System

Windows

Operating System Version

10 22H2

Architecture

64 bit

Sunshine commit or version

0.23.1

Package

Windows - installer

GPU Type

AMD

GPU Model

7900 XTX

GPU Driver/Mesa Version

24.4.1

Capture Method (Linux Only)

No response

Config

address_family = both
gamepad = x360
encoder = amdvce
amd_rc = cbr
amd_enforce_hrd = enabled

Apps

No response

Relevant log output

[2024:05:04:00:15:15]: Info: SDR color coding [Rec. 709]
[2024:05:04:00:15:15]: Info: Color depth: 10-bit
[2024:05:04:00:15:15]: Info: Color range: [JPEG]
[2024:05:04:00:15:15]: Info: SDR color coding [Rec. 709]
[2024:05:04:00:15:15]: Info: Color depth: 10-bit
[2024:05:04:00:15:15]: Info: Color range: [JPEG]
[2024:05:04:00:15:15]: Info: // Testing for available encoders, this may generate errors. You can safely ignore those errors. //
[2024:05:04:00:15:15]: Info: 
[2024:05:04:00:15:15]: Info: // Ignore any errors mentioned above, they are not relevant. //
[2024:05:04:00:15:15]: Info: 
[2024:05:04:00:15:15]: Info: Found H.264 encoder: h264_amf [amdvce]
[2024:05:04:00:15:15]: Info: Found HEVC encoder: hevc_amf [amdvce]
[2024:05:04:00:15:15]: Info: Found AV1 encoder: av1_amf [amdvce]
[2024:05:04:00:15:15]: Info: Executing Do Cmd: [cmd /C "C:\Program Files\Sunshine\tools\ChangeScreenResolution.exe" /w=%SUNSHINE_CLIENT_WIDTH% /h=%SUNSHINE_CLIENT_HEIGHT% /f=%SUNSHINE_CLIENT_FPS% /d=0]
[2024:05:04:00:15:15]: Info: cmd /C "C:\Program Files\Sunshine\tools\ChangeScreenResolution.exe" /w=%SUNSHINE_CLIENT_WIDTH% /h=%SUNSHINE_CLIENT_HEIGHT% /f=%SUNSHINE_CLIENT_FPS% /d=0 running with PID 8744
[2024:05:04:00:15:16]: Info: Spawning [steam steam://open/bigpicture] in ["C:\Program Files (x86)\Steam"]
[2024:05:04:00:15:16]: Info: steam steam://open/bigpicture running with PID 9220
[2024:05:04:00:15:16]: Info: Executing [Desktop]
[2024:05:04:00:15:16]: Info: nvprefs: NvAPI_Initialize() failed, ignore if you don't have NVIDIA video card
[2024:05:04:00:15:16]: Info: CLIENT CONNECTED
[2024:05:04:00:15:16]: Info: 
Device Description : AMD Radeon RX 7900 XTX
Device Vendor ID   : 0x00001002
Device Device ID   : 0x0000744C
Device Video Mem   : 24512 MiB
Device Sys Mem     : 0 MiB
Share Sys Mem      : 16296 MiB
Feature Level      : 0x0000B100
Capture size       : 3840x2160
Offset             : 0x0
Virtual Desktop    : 5760x2160
[2024:05:04:00:15:16]: Info: Active GPU has HAGS disabled
[2024:05:04:00:15:16]: Info: Using realtime GPU priority
[2024:05:04:00:15:16]: Info: Desktop resolution [3840x2160]
[2024:05:04:00:15:16]: Info: Desktop format [DXGI_FORMAT_B8G8R8A8_UNORM]
[2024:05:04:00:15:16]: Info: Display refresh rate [120Hz]
[2024:05:04:00:15:16]: Info: Requested frame rate [120fps]
[2024:05:04:00:15:16]: Info: 
Colorspace         : DXGI_COLOR_SPACE_RGB_FULL_G22_NONE_P709
Bits Per Color     : 8
Red Primary        : [0.686523,0.307617]
Green Primary      : [0.258789,0.669922]
Blue Primary       : [0.149414,0.0576172]
White Point        : [0.313477,0.329102]
Min Luminance      : 0.2339 nits
Max Luminance      : 408 nits
Max Full Luminance : 408 nits
[2024:05:04:00:15:16]: Info: Capture format [DXGI_FORMAT_B8G8R8A8_UNORM]
[2024:05:04:00:15:16]: Info: SDR color coding [Rec. 601]
[2024:05:04:00:15:16]: Info: Color depth: 10-bit
[2024:05:04:00:15:16]: Info: Color range: [MPEG]
[2024:05:04:00:15:16]: Warning: Number of fragments for reed solomon exceeds DATA_SHARDS_MAX
360 > 255, skipping error correction
[2024:05:04:00:15:16]: Warning: Number of fragments for reed solomon exceeds DATA_SHARDS_MAX
360 > 255, skipping error correction
[2024:05:04:00:15:16]: Warning: Number of fragments for reed solomon exceeds DATA_SHARDS_MAX
359 > 255, skipping error correction
[2024:05:04:00:15:16]: Info: Gamepad 0 will be Xbox 360 controller (manual selection)
[2024:05:04:00:15:16]: Warning: Gamepad 0 has motion sensors, but they are not usable when emulating an Xbox 360 controller
[2024:05:04:00:15:17]: Warning: Number of fragments for reed solomon exceeds DATA_SHARDS_MAX
436 > 255, skipping error correction
[2024:05:04:00:15:17]: Warning: Number of fragments for reed solomon exceeds DATA_SHARDS_MAX
436 > 255, skipping error correction
[2024:05:04:00:15:17]: Warning: Number of fragments for reed solomon exceeds DATA_SHARDS_MAX
434 > 255, skipping error correction
[2024:05:04:00:15:20]: Info: Resetting sink to [virtual-Surround 5.1{0.0.0.00000000}.{cb229297-678e-4059-8dff-489ffe290f8a}] after default changed
[2024:05:04:00:15:21]: Info: Reinitializing audio capture
[2024:05:04:00:15:34]: Info: 
Device Description : AMD Radeon RX 7900 XTX
Device Vendor ID   : 0x00001002
Device Device ID   : 0x0000744C
Device Video Mem   : 24512 MiB
Device Sys Mem     : 0 MiB
Share Sys Mem      : 16296 MiB
Feature Level      : 0x0000B100
Capture size       : 3840x2160
Offset             : 0x0
Virtual Desktop    : 5760x2160
[2024:05:04:00:15:34]: Info: Active GPU has HAGS disabled
[2024:05:04:00:15:34]: Info: Using realtime GPU priority
[2024:05:04:00:15:34]: Info: Desktop resolution [3840x2160]
[2024:05:04:00:15:34]: Info: Desktop format [DXGI_FORMAT_R16G16B16A16_FLOAT]
[2024:05:04:00:15:34]: Info: Display refresh rate [120Hz]
[2024:05:04:00:15:34]: Info: Requested frame rate [120fps]
[2024:05:04:00:15:34]: Info: 
Colorspace         : DXGI_COLOR_SPACE_RGB_FULL_G2084_NONE_P2020
Bits Per Color     : 8
Red Primary        : [0.686523,0.307617]
Green Primary      : [0.258789,0.669922]
Blue Primary       : [0.149414,0.0576172]
White Point        : [0.313477,0.329102]
Min Luminance      : 0.2339 nits
Max Luminance      : 408 nits
Max Full Luminance : 408 nits
[2024:05:04:00:15:34]: Info: Capture format [DXGI_FORMAT_R16G16B16A16_FLOAT]
[2024:05:04:00:15:34]: Info: HDR color coding [Rec. 2020 + SMPTE 2084 PQ]
[2024:05:04:00:15:34]: Info: Color depth: 10-bit
[2024:05:04:00:15:34]: Info: Color range: [MPEG]
[2024:05:04:00:17:10]: Info: 
Device Description : AMD Radeon RX 7900 XTX
Device Vendor ID   : 0x00001002
Device Device ID   : 0x0000744C
Device Video Mem   : 24512 MiB
Device Sys Mem     : 0 MiB
Share Sys Mem      : 16296 MiB
Feature Level      : 0x0000B100
Capture size       : 3840x2160
Offset             : 0x0
Virtual Desktop    : 5760x2160
[2024:05:04:00:17:10]: Info: Active GPU has HAGS disabled
[2024:05:04:00:17:10]: Info: Using realtime GPU priority
[2024:05:04:00:17:10]: Info: Desktop resolution [3840x2160]
[2024:05:04:00:17:10]: Info: Desktop format [DXGI_FORMAT_B8G8R8A8_UNORM]
[2024:05:04:00:17:10]: Info: Display refresh rate [120Hz]
[2024:05:04:00:17:10]: Info: Requested frame rate [120fps]
[2024:05:04:00:17:10]: Info: 
Colorspace         : DXGI_COLOR_SPACE_RGB_FULL_G22_NONE_P709
Bits Per Color     : 8
Red Primary        : [0.686523,0.307617]
Green Primary      : [0.258789,0.669922]
Blue Primary       : [0.149414,0.0576172]
White Point        : [0.313477,0.329102]
Min Luminance      : 0.2339 nits
Max Luminance      : 408 nits
Max Full Luminance : 408 nits
moi952 commented 6 months ago

I think you need to disabled freesync/gsync on host

Slashic commented 6 months ago

@moi952 This wasn't the case with previous sunshine version (v0.21.0), and I really don't see why adaptive sync produce this effect on the encoder part, others like OBS are working fine.

Snarfster commented 6 months ago

@Slashic not noticing this on a nightly with Nvidia (windows host/windows moonlight) fwiw.

Edit this is from a baremetal 4080 host 4k/120/HEVC --> NUC 11 dedicated

Slashic commented 6 months ago

@Snarfster This seems to be AMD and freesync only i guess then.

LizardByte-bot commented 3 months ago

It seems this issue hasn't had any activity in the past 90 days. If it's still something you'd like addressed, please let us know by leaving a comment. Otherwise, to help keep our backlog tidy, we'll be closing this issue in 10 days. Thanks!

LizardByte-bot commented 3 months ago

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