gamescope icon indicating copy to clipboard operation
gamescope copied to clipboard

Gamescope fails to write: 51FPS/51HZ, 55FPS/55HZ, 65FPS/HZ to LE OLED Deck panel, causing stutters on SteamOS 3.6/3.7

Open matte-schwartz opened this issue 1 year ago • 1 comments

On SteamOS 3.6 and SteamOS 3.7, the 51FPS/51HZ, 55FPS/55HZ, and 65FPS/HZ options fail to successfully write the refresh rate change when the notches are selected - perhaps only on BOE OLED panels. The result of this on SteamOS 3.6 and SteamOS 3.7 is a drop to ~15fps in game frametime with massive stutters while using direct scan-out. The stutters and poor frametime can be mitigated via Force Compositing or by loading 6.1.52-valve19. I have submitted a System Report under the Steam username: njtransit215 for confirmation of precise hardware details.

(deck@steamdeck ~)$ gamescopectl
gamescopectl version 3.14.22
gamescope_control info:
  - Connector Name: eDP-1
  - Display Make: Valve Corporation
  - Display Model: ANX7530 U
  - Display Flags: 0x3
  - ValidRefreshRates: 45, 47, 48, 49, 50, 51, 53, 55, 56, 59, 60, 62, 64, 65, 66, 68, 72, 73, 76, 77, 78, 80, 81, 82, 84, 85, 86, 87, 88, 90
  Features:
  - Reshade Shaders (1) - Version: 1 - Flags: 0x0
  - Display Info (2) - Version: 1 - Flags: 0x0
  - Pixel Filter (3) - Version: 1 - Flags: 0x0
  - Refresh Cycle Only Change Refresh Rate (4) - Version: 1 - Flags: 0x0
  - Mura Correction (5) - Version: 1 - Flags: 0x0
You can execute any debug command in Gamescope using this tool.
For a list of commands and convars, use 'gamescopectl help'

my edid outputs on SteamOS 3.6.8:

(130)(deck@steamdeck ~)$ cat /sys/class/drm/card0-eDP-1/edid | hexdump -C
00000000  00 ff ff ff ff ff ff 00  59 96 04 30 01 00 00 00  |........Y..0....|
00000010  ff 20 01 04 a5 0a 10 78  17 6c 71 af 50 3e b7 23  |. .....x.lq.P>.#|
00000020  0c 50 54 00 00 00 01 01  01 01 01 01 01 01 01 01  |.PT.............|
00000030  01 01 01 01 01 01 d8 27  20 3a 30 00 28 50 12 04  |.......' :0.(P..|
00000040  82 00 64 a0 00 00 00 1e  00 00 00 fc 00 41 4e 58  |..d..........ANX|
00000050  37 35 33 30 20 55 0a 20  20 20 00 00 00 fd 00 2d  |7530 U.   .....-|
00000060  5a 76 77 0e 00 0a 20 20  20 20 20 20 00 00 00 10  |Zvw...      ....|
00000070  00 00 00 00 00 00 00 00  00 00 00 00 00 00 01 16  |................|
00000080  02 03 0b 00 e6 06 01 01  6a 6a 03 00 00 00 00 00  |........jj......|
00000090  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
000000f0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 2b  |...............+|
00000100
 (deck@steamdeck ~)$ cat /home/deck/.config/gamescope/edid.bin | hexdump -C
00000000  00 ff ff ff ff ff ff 00  59 96 04 30 01 00 00 00  |........Y..0....|
00000010  ff 20 01 04 a5 10 0a 78  17 6c 71 af 50 3e b7 23  |. .....x.lq.P>.#|
00000020  0c 50 54 00 00 00 01 01  01 01 01 01 01 01 01 01  |.PT.............|
00000030  01 01 01 01 01 01 d8 27  00 3a 50 20 28 30 12 04  |.......'.:P (0..|
00000040  82 00 64 a0 00 00 00 1e  00 00 00 fc 00 41 4e 58  |..d..........ANX|
00000050  37 35 33 30 20 55 0a 20  20 20 00 00 00 fd 00 2d  |7530 U.   .....-|
00000060  5a 76 77 0e 00 0a 20 20  20 20 20 20 00 00 00 10  |Zvw...      ....|
00000070  00 00 00 00 00 00 00 00  00 00 00 00 00 00 01 16  |................|
00000080  02 03 0b 00 e6 06 07 01  8b 80 00 00 00 00 00 00  |................|
00000090  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
000000f0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 f1  |................|
00000100

journalctl output of initial 48HZ/48FPS modeset, failed 51HZ/51FPS modeset, and a successful 90HZ/90FPS modeset on SteamOS 3.6.8:

Jun 27 16:18:57 steamdeck gamescope-session[7859]: drm: selecting mode 800x1280@48Hz
Jun 27 16:18:57 steamdeck steam[8082]: [Gamescope WSI] Swapchain recieved new refresh cycle: 20.76ms
Jun 27 16:19:02 steamdeck gamescope-session[7859]: drm: selecting mode 800x1280@51Hz
Jun 27 16:19:02 steamdeck kernel: [drm] Failed to add display topology, DTM TA is not initialized.
Jun 27 16:19:02 steamdeck gamescope-session[7859]: drm: selecting mode 800x1280@51Hz
Jun 27 16:19:03 steamdeck steam[8082]: [Gamescope WSI] Swapchain recieved new refresh cycle: 19.38ms
Jun 27 16:19:03 steamdeck gamescope-session[7859]: drm: selecting mode 800x1280@51Hz
Jun 27 16:19:03 steamdeck gamescope-session[7859]: drm: selecting mode 800x1280@51Hz
Jun 27 16:19:03 steamdeck gamescope-session[7859]: drm: selecting mode 800x1280@51Hz
Jun 27 16:19:03 steamdeck gamescope-session[7859]: drm: selecting mode 800x1280@51Hz
Jun 27 16:19:03 steamdeck gamescope-session[7859]: drm: selecting mode 800x1280@51Hz
Jun 27 16:19:03 steamdeck gamescope-session[7859]: drm: selecting mode 800x1280@51Hz
Jun 27 16:19:03 steamdeck gamescope-session[7859]: drm: selecting mode 800x1280@51Hz
Jun 27 16:19:03 steamdeck gamescope-session[7859]: drm: selecting mode 800x1280@51Hz
Jun 27 16:19:03 steamdeck gamescope-session[7859]: drm: selecting mode 800x1280@51Hz
Jun 27 16:19:03 steamdeck gamescope-session[7859]: drm: selecting mode 800x1280@51Hz
...
Jun 27 16:19:25 steamdeck gamescope-session[7859]: drm: selecting mode 800x1280@51Hz
Jun 27 16:19:25 steamdeck gamescope-session[7859]: drm: selecting mode 800x1280@51Hz
Jun 27 16:19:25 steamdeck gamescope-session[7859]: drm: selecting mode 800x1280@51Hz
Jun 27 16:19:25 steamdeck gamescope-session[7859]: drm: selecting mode 800x1280@51Hz
Jun 27 16:19:26 steamdeck gamescope-session[7859]: drm: selecting mode 800x1280@51Hz
Jun 27 16:19:26 steamdeck gamescope-session[7859]: drm: selecting mode 800x1280@51Hz
Jun 27 16:19:26 steamdeck gamescope-session[7859]: drm: selecting mode 800x1280@51Hz
Jun 27 16:19:26 steamdeck gamescope-session[7859]: drm: selecting mode 800x1280@51Hz
Jun 27 16:19:26 steamdeck gamescope-session[7859]: drm: selecting mode 800x1280@51Hz
Jun 27 16:19:26 steamdeck gamescope-session[7859]: drm: selecting mode 800x1280@51Hz
Jun 27 16:19:26 steamdeck gamescope-session[7859]: drm: selecting mode 800x1280@51Hz
Jun 27 16:19:26 steamdeck gamescope-session[7859]: drm: selecting mode 800x1280@51Hz
Jun 27 16:19:26 steamdeck gamescope-session[7859]: drm: selecting mode 800x1280@51Hz
Jun 27 16:19:26 steamdeck gamescope-session[7859]: drm: selecting mode 800x1280@51Hz
Jun 27 16:19:26 steamdeck gamescope-session[7859]: drm: selecting mode 800x1280@51Hz
Jun 27 16:19:26 steamdeck gamescope-session[7859]: drm: selecting mode 800x1280@51Hz
Jun 27 16:19:26 steamdeck gamescope-session[7859]: drm: selecting mode 800x1280@51Hz
Jun 27 16:19:26 steamdeck gamescope-session[7859]: drm: selecting mode 800x1280@51Hz
Jun 27 16:19:26 steamdeck gamescope-session[7859]: drm: selecting mode 800x1280@51Hz
Jun 27 16:19:26 steamdeck gamescope-session[7859]: drm: selecting mode 800x1280@51Hz
Jun 27 16:19:26 steamdeck gamescope-session[7859]: drm: selecting mode 800x1280@51Hz
Jun 27 16:19:26 steamdeck gamescope-session[7859]: drm: selecting mode 800x1280@51Hz
Jun 27 16:19:26 steamdeck gamescope-session[7859]: drm: selecting mode 800x1280@51Hz
Jun 27 16:19:27 steamdeck gamescope-session[7859]: drm: selecting mode 800x1280@51Hz
Jun 27 16:19:27 steamdeck gamescope-session[7859]: drm: selecting mode 800x1280@51Hz
Jun 27 16:19:27 steamdeck gamescope-session[7859]: drm: selecting mode 800x1280@51Hz
Jun 27 16:19:27 steamdeck gamescope-session[7859]: drm: selecting mode 800x1280@51Hz
Jun 27 16:19:27 steamdeck gamescope-session[7859]: drm: selecting mode 800x1280@51Hz
Jun 27 16:19:27 steamdeck gamescope-session[7859]: drm: selecting mode 800x1280@51Hz
Jun 27 16:19:27 steamdeck gamescope-session[7859]: drm: selecting mode 800x1280@51Hz
Jun 27 16:19:27 steamdeck gamescope-session[7859]: drm: selecting mode 800x1280@90Hz
Jun 27 16:19:27 steamdeck kernel: [drm] Failed to add display topology, DTM TA is not initialized.
Jun 27 16:19:27 steamdeck steam[8082]: [Gamescope WSI] Swapchain recieved new refresh cycle: 11.10ms

And a video of the behavior I'm describing on SteamOS 3.6.8:

https://github.com/ValveSoftware/gamescope/assets/136293710/a133206c-4b49-4566-8b0f-3b75ee319077

Force compositing mitigates the issue on 6.5.0-valve12 in that it will raise frametimes back up to the specific notch level, although the continuous writes in addition to the compositing may have a performance impact.

If I load kernel 6.1.52-valve19 on to SteamOS 3.6.8, the continuous writes persist but the refresh rate locks to the nearest "good" notch without needing to composite. For example, 51HZ/51FPS even with continual drm: selecting mode 800x1280@51Hz does not stutter and instead locks the game to 52fps rather than ~18fps.

matte-schwartz avatar Jun 28 '24 00:06 matte-schwartz

These 2 logs are from Ori and the Will of the Wisps, which gives some additional drm debugging info thanks to the HDR content being played:

6.5.0-valve11-good-modeset.log

6.5.0-valve11-bad-modeset.log

In the good modeset log, you can see that there are two groups of:

[  438.072663] [drm:dm_update_plane_state [amdgpu]] Disabling DRM plane: 90 on DRM crtc 99
[  438.073592] amdgpu 0000:04:00.0: [drm:drm_atomic_get_private_obj_state] Added new private object 00000000f3ed6ef7 state 00000000862a14c5 to 000000007c67723c
[  438.073603] [drm:dm_update_plane_state [amdgpu]] Disabling DRM plane: 84 on DRM crtc 99
[  438.074230] [drm:dm_update_plane_state [amdgpu]] Disabling DRM plane: 72 on DRM crtc 99
[  438.074978] [drm:update_stream_scaling_settings [amdgpu]] Destination Rectangle x:0  y:0  width:800  height:1280
[  438.075707] [drm:dm_update_crtc_state [amdgpu]] Enabling DRM crtc: 99
[  438.076402] [drm:update_stream_scaling_settings [amdgpu]] Destination Rectangle x:0  y:0  width:800  height:1280
[  438.077465] [drm:dm_update_plane_state [amdgpu]] Enabling DRM plane: 90 on DRM crtc 99
[  438.080357] [drm:dm_update_plane_state [amdgpu]] Enabling DRM plane: 84 on DRM crtc 99
[  438.082935] [drm:dm_update_plane_state [amdgpu]] Enabling DRM plane: 72 on DRM crtc 99

before it eventually "settles" onto the modeset. This is the majority of the refresh rates available on the slider.

In the bad modeset log, you can see those DRM plane cycles continue to cycle repeatedly:

[  538.248313] amdgpu 0000:04:00.0: [drm:drm_atomic_get_private_obj_state] Added new private object 00000000f3ed6ef7 state 00000000c3ab07a9 to 0000000042e1f87b
[  538.248321] [drm:dm_update_plane_state [amdgpu]] Disabling DRM plane: 84 on DRM crtc 99
[  538.248816] [drm:dm_update_plane_state [amdgpu]] Disabling DRM plane: 72 on DRM crtc 99
[  538.249301] [drm:update_stream_scaling_settings [amdgpu]] Destination Rectangle x:0  y:0  width:800  height:1280
[  538.249871] [drm:dm_update_crtc_state [amdgpu]] Enabling DRM crtc: 99
[  538.250379] [drm:update_stream_scaling_settings [amdgpu]] Destination Rectangle x:0  y:0  width:800  height:1280
[  538.251246] [drm:dm_update_plane_state [amdgpu]] Enabling DRM plane: 90 on DRM crtc 99
[  538.254440] [drm:dm_update_plane_state [amdgpu]] Enabling DRM plane: 84 on DRM crtc 99
[  538.258035] [drm:dm_update_plane_state [amdgpu]] Enabling DRM plane: 72 on DRM crtc 99
...
[  538.260713] amdgpu 0000:04:00.0: [drm:drm_atomic_add_affected_planes] Adding all current planes for [CRTC:99:crtc-0] to 000000009e94c141
[  538.260718] [drm:dm_update_plane_state [amdgpu]] Disabling DRM plane: 90 on DRM crtc 99
[  538.261529] amdgpu 0000:04:00.0: [drm:drm_atomic_get_private_obj_state] Added new private object 00000000f3ed6ef7 state 00000000757074e9 to 000000009e94c141
[  538.261537] [drm:dm_update_plane_state [amdgpu]] Disabling DRM plane: 84 on DRM crtc 99
[  538.261871] [drm:dm_update_plane_state [amdgpu]] Disabling DRM plane: 72 on DRM crtc 99
[  538.262227] [drm:update_stream_scaling_settings [amdgpu]] Destination Rectangle x:0  y:0  width:800  height:1280
[  538.262676] [drm:dm_update_crtc_state [amdgpu]] Enabling DRM crtc: 99
[  538.263085] [drm:update_stream_scaling_settings [amdgpu]] Destination Rectangle x:0  y:0  width:800  height:1280
[  538.263857] [drm:dm_update_plane_state [amdgpu]] Enabling DRM plane: 90 on DRM crtc 99
[  538.266676] [drm:dm_update_plane_state [amdgpu]] Enabling DRM plane: 84 on DRM crtc 99
[  538.269297] [drm:dm_update_plane_state [amdgpu]] Enabling DRM plane: 72 on DRM crtc 99

This results in the same behavior as I recorded in the original post, except it includes extra logs for [drm] Losing delta precision while programming shaper LUT.


These next 2 are logs from Hades 2, which displays using direct scan-out even with latest gamescope on 6.1.52-valve19:

6.1.52-valve19-good-modeset.log

6.1.52-valve19-bad-modeset.log

in the good modeset log, you can again see

[  690.372647] [drm:dm_update_plane_state [amdgpu]] Disabling DRM plane: 90 on DRM crtc 100
[  690.372787] amdgpu 0000:04:00.0: [drm:drm_atomic_get_private_obj_state] Added new private object 00000000d7c5e974 state 00000000587e5797 to 00000000f0a347a4
[  690.372790] [drm:dm_update_plane_state [amdgpu]] Disabling DRM plane: 84 on DRM crtc 100
[  690.372885] [drm:dm_update_plane_state [amdgpu]] Disabling DRM plane: 72 on DRM crtc 100
[  690.373002] [drm:update_stream_scaling_settings [amdgpu]] Destination Rectangle x:0  y:0  width:800  height:1280
[  690.373231] [drm:dm_update_crtc_state [amdgpu]] Enabling DRM crtc: 100
[  690.373335] [drm:update_stream_scaling_settings [amdgpu]] Destination Rectangle x:0  y:0  width:800  height:1280
[  690.373450] [drm:dm_update_plane_state [amdgpu]] Enabling DRM plane: 90 on DRM crtc 100
[  690.373569] [drm:dm_update_plane_state [amdgpu]] Enabling DRM plane: 84 on DRM crtc 100
[  690.373686] [drm:dm_update_plane_state [amdgpu]] Enabling DRM plane: 72 on DRM crtc 100

only occurs after the successful modeset and no repeat cycles. there is no frametime lag.

while in the bad modeset log, you can see the same exact cycle as 6.5.0-valve11. the only difference is that there is no frametime lag on this kernel, even when using direct scan-out.

matte-schwartz avatar Jul 04 '24 04:07 matte-schwartz

image

took a look with tracy profiling and it seems to back up my idea that it's forced into trying to use a bad modeset for the display

This is how it should look (53fps frame limit set) image

This is how it looks with a 51fps frame limit set, with the same scaling as the preview screenshot

image

gpuvis also shows a massive difference between the two refresh rate settings:

image

image

let me know if you want either of these profiler logs to examine further, but easiest way would just be to check a BOE panel Deck (SDC owners report no issues with these three refresh rate/frame limit options). these were all taken on SteamOS Main

matte-schwartz avatar Aug 06 '24 17:08 matte-schwartz

Wait, I am confused by what you mean about bad modesets on 6.1.52?

misyltoad avatar Aug 06 '24 17:08 misyltoad

6.1.52 51fps@51hz bounces between 50-52fps but never locks to 51, but this effectively works around the issue https://github.com/user-attachments/assets/a8de400e-957d-4b19-9ed5-61b61cf3b473

6.5 regressed and made it so 51fps@51hz is more overtly broken https://github.com/user-attachments/assets/c246caee-2492-47c1-9cf9-4457d55370ca

both of the kernels spam drm: selecting mode 800x1280@51hz to journal

Edit; also, all I changed was the kernel here to install linux-neptune-61 on SteamOS Main, not a full switch back to Stable.

matte-schwartz avatar Aug 06 '24 17:08 matte-schwartz

actually let me just log dump these too rather than cherry picking bits and pieces of it:

linux-neptune-61:

90-to-53-neptune-61.log

53-to-51-neptune-61.log

echo 0x1e > /sys/module/drm/parameters/debug shows a constant stream of

Aug 06 13:17:36 steamdeck kernel: amdgpu 0000:04:00.0: [drm:drm_atomic_helper_check_modeset] Updating routing for [CONNECTOR:113:eDP-1]
Aug 06 13:17:36 steamdeck kernel: amdgpu 0000:04:00.0: [drm:drm_atomic_helper_check_modeset] [CONNECTOR:113:eDP-1] keeps [ENCODER:112:TMDS-112], now on [CRTC:99:crtc-0]
Aug 06 13:17:36 steamdeck kernel: amdgpu 0000:04:00.0: [drm:drm_atomic_add_encoder_bridges] Adding all bridges for [encoder:112:TMDS-112] to 00000000302fe190
Aug 06 13:17:36 steamdeck kernel: amdgpu 0000:04:00.0: [drm:drm_atomic_add_encoder_bridges] Adding all bridges for [encoder:112:TMDS-112] to 00000000302fe190

at 51fps/hz that is not present in the 53fps/hz log, but there is no noticeable difference to device performance.

(130)(B+)(root@steamdeck deck)# uname -a
Linux steamdeck 6.1.52-valve19-1-neptune-61 #1 SMP PREEMPT_DYNAMIC Tue, 05 Mar 2024 00:05:53 +0000 x86_64 GNU/Linux

linux-neptune-65:

90-to-53-neptune-65.log

53-to-51-neptune-65.log

echo 0x1e > /sys/module/drm/parameters/debug shows the same pattern, but with the performance hit that I showed in the video clip.

(130)(B+)(root@steamdeck deck)# uname -a
Linux steamdeck 6.5.0-valve15-1-neptune-65-g7de78a02ab71 #1 SMP PREEMPT_DYNAMIC Fri, 02 Aug 2024 06:06:04 +0000 x86_64 GNU/Linux

matte-schwartz avatar Aug 06 '24 20:08 matte-schwartz