amdgpu internal page-flip failure with "Mode validation failed for stream update!"
Brief summary of the problem:
gamescope is a compositor that tries to use KMS planes to scan out games. gamescope uses KMS atomic commits to perform page-flips. When running some clients, the atomic commit will succeed, but amdgpu will later internally fail the page-flip.
Since user-space isn't aware of the issue, it freezes, waiting for a page-flip event from the kernel.
Surprisingly enough, the bug goes away when user-space passes
DRM_MODE_ATOMIC_ALLOW_MODESET on each commit (though this isn't desirable, it's just a workaround).
Expected behavior: amdgpu should perform all checks needed for a page-flip in the atomic check handler
amdgpu_dm_atomic_check. If a game can't be directly scanned out, amdgpu should fail the atomic commit to let user-space know about the failure. In this particular case, it seems like amdgpu could still be capable of scanning out the game (since
ALLOW_MODESET makes it work).
- CPU: AMD Ryzen 5 3500U
- GPU: APU (PCI 1002:15d8 Advanced Micro Devices, Inc. [AMD/ATI] Picasso)
- System Memory: 6GiB
- Display(s): integrated screen
- Type of Diplay Connection: eDP
- Distro name and Version: Arch Linux
- Kernel version: 5.9.3-arch1-1
- Custom kernel: N/A
- AMD package version: N/A
How to reproduce the issue:
- Clone gamescope
- Apply this patch to stop setting
ALLOW_MODESETon all commits: https://l.sr.ht/DHTC.txt
- Build gamescope
- Run it with Steam and enable use of KMS planes:
build/gamescope -e -l -d -- steam -tenfoot -steamos >gamescope.log 2>&1
- Start Portal 1 (also reproduces with a lot of other games)
- gamescope freezes, dmesg should contain:
[16283.676840] [drm:dc_commit_updates_for_stream [amdgpu]] *ERROR* Mode validation failed for stream update! [16293.708914] [drm:drm_atomic_helper_wait_for_flip_done [drm_kms_helper]] *ERROR* [CRTC:62:crtc-0] flip_done timed out
Downstream bug: https://github.com/Plagman/gamescope/issues/67
DRM debug dmesg logs: https://l.sr.ht/NVUL.log (also contains errors about the cursor plane, but this is a separate and unrelated issue)