ValveSoftware / gamescope

SteamOS session compositing window manager
Other
2.94k stars 197 forks source link

[VRR] Adaptive Sync stops working with -r option #975

Open GrabbenD opened 10 months ago

GrabbenD commented 10 months ago

Problem

20231008_190105 (Screen: 120 Hz | Game: 84 FPS)

My monitor has a built in FPS counter in the on screen display menu. This allows me to monitor if the screen correctly adjusts the refresh rate to match the in-game frame rate.

The refresh rate is synced with the game as long as I don't specify -r option.

I don't have to use MangoHud to see my game's frame rate as the monitor is stuck at static 120 Hz all the time (even without Gamemode and Mangohud) in GPU bound games where my average FPS is 80 as well as in cut scenes which are capped to 60 FPS.

Reproducibility

System configuration

Setup:

VGA:

$ sudo lshw -C display -numeric ``` *-display description: VGA compatible controller product: Navi 21 [Radeon RX 6800/6800 XT / 6900 XT] [1002:73BF] vendor: Advanced Micro Devices, Inc. [AMD/ATI] [1002] physical id: 0 bus info: pci@0000:0b:00.0 logical name: /dev/fb0 version: c1 width: 64 bits clock: 33MHz capabilities: pm pciexpress msi vga_controller bus_master cap_list rom fb configuration: depth=32 driver=amdgpu latency=0 resolution=3840,1600 resources: irq:153 memory:d0000000-dfffffff memory:e0000000-e01fffff ioport:e000(size=256) memory:fcc00000-fccfffff memory:fcd00000-fcd1ffff ```

Monitor:

$ wlr-randr ``` DP-3 "Dell Inc. Dell AW3821DW #HLAYMxgwABTR (DP-3)" Make: Dell Inc. Model: Dell AW3821DW Serial: #HLAYMxgwABTR Physical size: 880x370 mm Enabled: yes Modes: 3840x1600 px, 59.993999 Hz (preferred) 3840x1600 px, 143.998001 Hz 3840x1600 px, 120.044998 Hz (current) 3840x1600 px, 119.982002 Hz 3840x1600 px, 99.970001 Hz 3840x1600 px, 96.036003 Hz 3840x1600 px, 84.971001 Hz 3840x1600 px, 72.019997 Hz 3840x1600 px, 60.007999 Hz 3840x1600 px, 50.002998 Hz 3840x1600 px, 48.008999 Hz 3840x1600 px, 29.971001 Hz 3840x1600 px, 30.000000 Hz 3840x1600 px, 25.000999 Hz 3840x1600 px, 23.976000 Hz 3840x1600 px, 24.002001 Hz 1920x1200 px, 59.993999 Hz 1920x1080 px, 59.993999 Hz 1600x1200 px, 59.993999 Hz 1680x1050 px, 59.993999 Hz 1280x1024 px, 59.993999 Hz 1440x900 px, 59.993999 Hz 1280x800 px, 59.993999 Hz 1280x720 px, 59.993999 Hz 1024x768 px, 60.004002 Hz 800x600 px, 60.317001 Hz 640x480 px, 60.000000 Hz 640x480 px, 59.939999 Hz Position: 0,0 Transform: normal Scale: 1.000000 Adaptive Sync: enabled ```

Memory config:

$ sudo dmidecode --type 17 ``` # dmidecode 3.5 Getting SMBIOS data from sysfs. SMBIOS 3.3.0 present. Handle 0x003E, DMI type 17, 92 bytes Memory Device Array Handle: 0x0036 Error Information Handle: 0x003D Total Width: 64 bits Data Width: 64 bits Size: 16 GB Form Factor: DIMM Set: None Locator: DIMM_A1 Bank Locator: BANK 0 Type: DDR4 Type Detail: Synchronous Unbuffered (Unregistered) Speed: 2133 MT/s Manufacturer: G Skill Intl Serial Number: 00000000 Asset Tag: Not Specified Part Number: F4-3600C14-16GTZN Rank: 2 Configured Memory Speed: 2133 MT/s Minimum Voltage: 1.2 V Maximum Voltage: 1.2 V Configured Voltage: 1.2 V Memory Technology: DRAM Memory Operating Mode Capability: Volatile memory Firmware Version: Unknown Module Manufacturer ID: Bank 5, Hex 0xCD Module Product ID: Unknown Memory Subsystem Controller Manufacturer ID: Unknown Memory Subsystem Controller Product ID: Unknown Non-Volatile Size: None Volatile Size: 16 GB Cache Size: None Logical Size: None Handle 0x0041, DMI type 17, 92 bytes Memory Device Array Handle: 0x0036 Error Information Handle: 0x0040 Total Width: 64 bits Data Width: 64 bits Size: 16 GB Form Factor: DIMM Set: None Locator: DIMM_A2 Bank Locator: BANK 1 Type: DDR4 Type Detail: Synchronous Unbuffered (Unregistered) Speed: 2133 MT/s Manufacturer: G Skill Intl Serial Number: 00000000 Asset Tag: Not Specified Part Number: F4-3600C14-16GTZN Rank: 2 Configured Memory Speed: 2133 MT/s Minimum Voltage: 1.2 V Maximum Voltage: 1.2 V Configured Voltage: 1.2 V Memory Technology: DRAM Memory Operating Mode Capability: Volatile memory Firmware Version: Unknown Module Manufacturer ID: Bank 5, Hex 0xCD Module Product ID: Unknown Memory Subsystem Controller Manufacturer ID: Unknown Memory Subsystem Controller Product ID: Unknown Non-Volatile Size: None Volatile Size: 16 GB Cache Size: None Logical Size: None Handle 0x0044, DMI type 17, 92 bytes Memory Device Array Handle: 0x0036 Error Information Handle: 0x0043 Total Width: 64 bits Data Width: 64 bits Size: 16 GB Form Factor: DIMM Set: None Locator: DIMM_B1 Bank Locator: BANK 2 Type: DDR4 Type Detail: Synchronous Unbuffered (Unregistered) Speed: 2133 MT/s Manufacturer: G Skill Intl Serial Number: 00000000 Asset Tag: Not Specified Part Number: F4-3600C14-16GTZN Rank: 2 Configured Memory Speed: 2133 MT/s Minimum Voltage: 1.2 V Maximum Voltage: 1.2 V Configured Voltage: 1.2 V Memory Technology: DRAM Memory Operating Mode Capability: Volatile memory Firmware Version: Unknown Module Manufacturer ID: Bank 5, Hex 0xCD Module Product ID: Unknown Memory Subsystem Controller Manufacturer ID: Unknown Memory Subsystem Controller Product ID: Unknown Non-Volatile Size: None Volatile Size: 16 GB Cache Size: None Logical Size: None Handle 0x0047, DMI type 17, 92 bytes Memory Device Array Handle: 0x0036 Error Information Handle: 0x0046 Total Width: 64 bits Data Width: 64 bits Size: 16 GB Form Factor: DIMM Set: None Locator: DIMM_B2 Bank Locator: BANK 3 Type: DDR4 Type Detail: Synchronous Unbuffered (Unregistered) Speed: 2133 MT/s Manufacturer: G Skill Intl Serial Number: 00000000 Asset Tag: Not Specified Part Number: F4-3600C14-16GTZN Rank: 2 Configured Memory Speed: 2133 MT/s Minimum Voltage: 1.2 V Maximum Voltage: 1.2 V Configured Voltage: 1.2 V Memory Technology: DRAM Memory Operating Mode Capability: Volatile memory Firmware Version: Unknown Module Manufacturer ID: Bank 5, Hex 0xCD Module Product ID: Unknown Memory Subsystem Controller Manufacturer ID: Unknown Memory Subsystem Controller Product ID: Unknown Non-Volatile Size: None Volatile Size: 16 GB Cache Size: None Logical Size: None ```

EDID:

$ cat /sys/class/drm/card0-DP-3/edid | sudo edid-decode ``` edid-decode (hex): 00 ff ff ff ff ff ff 00 10 ac 7f a1 4c 46 35 30 2e 1e 01 04 b5 58 25 78 3b 8b d1 ae 50 44 ac 26 0f 50 54 21 08 00 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 3c 9b 00 a0 f0 40 38 60 30 20 35 00 70 6f 31 00 00 1a 00 00 00 ff 00 23 48 4c 41 59 4d 78 67 77 41 42 54 52 00 00 00 fd 00 01 90 f6 f6 63 01 0a 20 20 20 20 20 20 00 00 00 fc 00 44 65 6c 6c 20 41 57 33 38 32 31 44 57 02 4f 02 03 20 f1 23 09 07 01 83 01 00 00 65 4b 04 00 01 01 e3 05 c0 00 e2 00 6a e6 06 05 01 78 60 1f 31 dd 00 a0 f0 40 42 60 30 20 35 00 70 6f 31 00 00 1a 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 70 70 13 79 03 00 0f 00 0a a4 14 0e 0e 07 01 20 45 00 00 02 01 0d 31 e6 ea 4f 46 b4 ac 6c 22 0f 01 45 54 03 01 3c 93 3d 01 04 ff 0e 9f 00 2f 80 1f 00 3f 06 5d 00 02 00 04 00 a4 81 01 04 ff 0e 9f 00 2f 80 1f 00 3f 06 71 00 02 00 04 00 1b 06 01 04 ff 0e 9f 00 2f 80 1f 00 3f 06 4d 00 02 00 04 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0b 90 ---------------- Block 0, Base EDID: EDID Structure Version & Revision: 1.4 Vendor & Product Identification: Manufacturer: DEL Model: 41343 Serial Number: 808797772 Made in: week 46 of 2020 Basic Display Parameters & Features: Digital display Bits per primary color channel: 10 DisplayPort interface Maximum image size: 88 cm x 37 cm Gamma: 2.20 DPMS levels: Off Supported color formats: RGB 4:4:4, YCrCb 4:4:4, YCrCb 4:2:2 First detailed timing includes the native pixel format and preferred refresh rate Display is continuous frequency Color Characteristics: Red : 0.6816, 0.3125 Green: 0.2675, 0.6748 Blue : 0.1513, 0.0595 White: 0.3125, 0.3291 Established Timings I & II: DMT 0x04: 640x480 59.940476 Hz 4:3 31.469 kHz 25.175000 MHz DMT 0x09: 800x600 60.316541 Hz 4:3 37.879 kHz 40.000000 MHz DMT 0x10: 1024x768 60.003840 Hz 4:3 48.363 kHz 65.000000 MHz Standard Timings: none Detailed Timing Descriptors: DTD 1: 3840x1600 59.993961 Hz 12:5 99.350 kHz 397.400000 MHz (880 mm x 367 mm) Hfront 48 Hsync 32 Hback 80 Hpol P Vfront 3 Vsync 5 Vback 48 Vpol N Display Product Serial Number: '#HLAYMxgwABTR' Display Range Limits: Monitor ranges (Bare Limits): 1-144 Hz V, 246-246 kHz H, max dotclock 990 MHz Display Product Name: 'Dell AW3821DW' Extension blocks: 2 Checksum: 0x4f ---------------- Block 1, CTA-861 Extension Block: Revision: 3 Underscans IT Video Formats by default Basic audio support Supports YCbCr 4:4:4 Supports YCbCr 4:2:2 Native detailed modes: 1 Audio Data Block: Linear PCM: Max channels: 2 Supported sample rates (kHz): 48 44.1 32 Supported sample sizes (bits): 16 Speaker Allocation Data Block: FL/FR - Front Left/Right Vendor-Specific Data Block (NVIDIA), OUI 00-04-4B: 01 01 '..' Colorimetry Data Block: BT2020YCC BT2020RGB Video Capability Data Block: YCbCr quantization: No Data RGB quantization: Selectable (via AVI Q) PT scan behavior: Always Underscanned IT scan behavior: Always Underscanned CE scan behavior: Always Underscanned HDR Static Metadata Data Block: Electro optical transfer functions: Traditional gamma - SDR luminance range SMPTE ST2084 Supported static metadata descriptors: Static metadata type 1 Desired content max luminance: 120 (672.717 cd/m^2) Desired content max frame-average luminance: 96 (400.000 cd/m^2) Desired content min luminance: 31 (0.099 cd/m^2) Detailed Timing Descriptors: DTD 2: 3840x1600 84.971489 Hz 12:5 141.562 kHz 566.250000 MHz (880 mm x 367 mm) Hfront 48 Hsync 32 Hback 80 Hpol P Vfront 3 Vsync 5 Vback 58 Vpol N Checksum: 0x70 Unused space in Extension Block: 77 bytes ---------------- Block 2, DisplayID Extension Block: Version: 1.3 Extension Count: 0 Display Product Type: Standalone display device Display Interface Data Block: Interface Type: DisplayPort Number of Links: 4 Interface Standard Version: 1.4 Supported bpc for RGB encoding: 8, 10, 12 Supported bpc for YCbCr 4:4:4 encoding: 8, 10, 12 Supported bpc for YCbCr 4:2:2 encoding: 8, 10, 12 Supported Content Protection: HDCP 2.0 Spread Spectrum: Down Spread 0.5% Color Characteristics Data Block: Uses spatial color Uses 1931 CIE (x, y) coordinates Primary #0: (0.6812, 0.3120) Primary #1: (0.2671, 0.6746) Primary #2: (0.1514, 0.0591) White point #0: (0.3127, 0.3291) Video Timing Modes Type 1 - Detailed Timings Data Block: DTD: 3840x1600 119.982290 Hz 16:9 203.250 kHz 813.000000 MHz (aspect 16:9, no 3D stereo) Hfront 48 Hsync 32 Hback 80 Hpol P Vfront 3 Vsync 5 Vback 86 Vpol N DTD: 3840x1600 143.997958 Hz 16:9 246.812 kHz 987.250000 MHz (aspect 16:9, no 3D stereo) Hfront 48 Hsync 32 Hback 80 Hpol P Vfront 3 Vsync 5 Vback 106 Vpol N DTD: 3840x1600 99.970203 Hz 16:9 167.750 kHz 671.000000 MHz (aspect 16:9, no 3D stereo) Hfront 48 Hsync 32 Hback 80 Hpol P Vfront 3 Vsync 5 Vback 70 Vpol N Checksum: 0x0b Checksum: 0x90 ```
Joshua-Ashton commented 10 months ago

Just to make sure, you are using Gamescope in a tty/session mode and not in a nested compositor, correct?

VRR will only work from tty, not nested in another compositor.

EDIT: I assume Gamescope Embedded = gamescope inside another compositor in a window?

GrabbenD commented 10 months ago

Just to make sure, you are using Gamescope in a tty/session mode and not in a nested compositor, correct?

I'm starting Gamescope from a dedicated TTY session/shell (gamescope's --help refers to this as embedded mode) 🙂

$ tty
/dev/tty1

To clarify further, this system doesn't use a Display Manager either.

iguanajuice commented 9 months ago

VRR will only work from tty, not nested in another compositor.

This seems to no longer be the case. VRR works fine for me on the latest version of gamescope on sway.

Edit: after further testing, this only seems to be the case if the GPU is at full usage. Meaning, if FPS is artificially capped, or is being CPU limited; VRR won't work correctly. The monitor still "tries" to change refresh rate to match FPS (as indicated by my monitor's refresh rate counter), but doesn't do it right.

Really hope it's even possible to get VRR working in nested mode, correctly.

Lawstorant commented 7 months ago

Nested VRR always worked for me no problem. May you, perhaps, have a RDNA2 powered GPU? These have issues with default power mode being too aggressive and creating massive stutters when GPU is not completely loaded.

GrabbenD commented 7 months ago

Nested VRR

I think there's some confusion here The first comment just wanted me to clarify that I'm not using VRR in Nested mode :)

The goal of this issue report is to get Gamescope to use VRR in embedded session

devurandom commented 3 months ago

Is this related to https://github.com/ValveSoftware/gamescope/issues/721 ?