Repository navigation
Description
Background:
Mutter 40 (using in Ubuntu 21.10 and beyond) is using atomic KMS, which can be disabled by setting MUTTER_DEBUG_ENABLE_ATOMIC_KMS=0.
The issue is this: After mutter sets the display to go to sleep, it never comes up again, reporting this error within minutes of going to sleep:
[ 500.967377] [drm:drm_atomic_helper_wait_for_flip_done [drm_kms_helper]] *ERROR* [CRTC:77:crtc-3] flip_done timed out
[ 500.967374] [drm:drm_crtc_commit_wait [drm]] *ERROR* flip_done timed out
[ 500.967659] [drm:drm_atomic_helper_wait_for_dependencies [drm_kms_helper]] *ERROR* [CRTC:77:crtc-3] commit wait timed out
[ 511.207505] [drm:drm_crtc_commit_wait [drm]] *ERROR* flip_done timed out
[ 511.207773] [drm:drm_atomic_helper_wait_for_dependencies [drm_kms_helper]] *ERROR* [PLANE:71:plane-3] commit wait timed out
[ 521.447604] [drm:drm_crtc_commit_wait [drm]] *ERROR* flip_done timed out
[ 521.447862] vc4-drm gpu: [drm] *ERROR* Timed out waiting for commit
A reboot is needed to resolve this.
This isn't unique to kernel 5.15. Ubuntu is seeing it in their release 5.13 kernels too, but I have verified that this issue still exists by building the current 5.15-rc5 kernel here.
The issue exists with current firmware.
It has been mentioned at https://bugs.launchpad.net/ubuntu/+source/linux-raspi/+bug/1944397/comments/20 and https://bugs.launchpad.net/ubuntu/+source/linux-raspi/+bug/1944397/comments/45 by people with familiarity with KMS far far above mine.
As @vanvugt suggests, this may be a kernel issue:
Oct 08 16:16:31 pi400 gnome-shell[968]: Mode setting implementation for '/dev/dri/card1' (vc4) forced (non-atomic).
...
Oct 08 16:24:38 pi400 kernel: [drm:drm_crtc_commit_wait [drm]] *ERROR* flip_done timed out
Oct 08 16:24:38 pi400 kernel: [drm:drm_atomic_helper_wait_for_dependencies [drm_kms_helper]] *ERROR* [CRTC:76:crtc-3] commit wait timed out
Oct 08 16:24:48 pi400 kernel: [drm:drm_crtc_commit_wait [drm]] *ERROR* flip_done timed out
Oct 08 16:24:48 pi400 kernel: [drm:drm_atomic_helper_wait_for_dependencies [drm_kms_helper]] *ERROR* [PLANE:70:plane-3] commit wait timed out
I guess the vc4 kernel is trying to implement non-atomic KMS using a buggy atomic implementation. :(
To reproduce
dtoverlay=vc4-kms-v3d-pi4 is being used.
With a kernel newer than 5.11, install mutter 40, and let the display go to sleep. The display can then not be woken.
Expected behaviour
Display should wake again.
Actual behaviour
Display goes blank.
System
Debug output:
gowat-10_13_2021_1435EDT.txt
- Which model of Raspberry Pi? RPi4B
- Which OS and version (
cat /etc/rpi-issue)? Ubuntu 21.10 - Which firmware version (
vcgencmd version)?
(This is the release firmware for Ubuntu 21.10)
Aug 31 2021 14:52:47
Copyright (c) 2012 Broadcom
version 67615e950e1e28b92dfae6303cf7a8b879a8908f (clean) (release) (start)
I have also tried this firmware:
Sep 30 2021 19:21:03
Copyright (c) 2012 Broadcom
version 51215b4f6e3966401ecd99652a35cf1c25069113 (clean) (release) (start)
- Which kernel version (
uname -a)?
5.15.0-rc5-v8-gc0acaa66d (built from c0acaa6 )
Logs
[ 500.967377] [drm:drm_atomic_helper_wait_for_flip_done [drm_kms_helper]] *ERROR* [CRTC:77:crtc-3] flip_done timed out
[ 500.967374] [drm:drm_crtc_commit_wait [drm]] *ERROR* flip_done timed out
[ 500.967659] [drm:drm_atomic_helper_wait_for_dependencies [drm_kms_helper]] *ERROR* [CRTC:77:crtc-3] commit wait timed out
[ 511.207505] [drm:drm_crtc_commit_wait [drm]] *ERROR* flip_done timed out
[ 511.207773] [drm:drm_atomic_helper_wait_for_dependencies [drm_kms_helper]] *ERROR* [PLANE:71:plane-3] commit wait timed out
[ 521.447604] [drm:drm_crtc_commit_wait [drm]] *ERROR* flip_done timed out
[ 521.447862] vc4-drm gpu: [drm] *ERROR* Timed out waiting for commit
Activity
pelwell commentedon Oct 13, 2021
FYI you have a typo in your config.txt:
satmandu commentedon Oct 13, 2021
@pelwell Thanks for the correction! I should stop doing edits over ssh from my phone!
Unfortunately, I see the same issue with that fix:
popcornmix commentedon Oct 14, 2021
Can you test with our 5.10 kernel?
I think this is an upstream regression that hit 5.10 when we pulled in upstream commits, and was resolved with a (partial) revert.
I don't think upstream has been fixed yet.
satmandu commentedon Oct 14, 2021
This is indeed not an issue with the 5.10 kernel from here.
Any chance of getting this fix upstreamed, or merged with the 5.15 kernel here to confirm that it isn't some other issue?
popcornmix commentedon Oct 14, 2021
@mripard has been investigating but it wasn't trivial to see what was wrong with the upstream code.
mripard commentedon Oct 14, 2021
One of the issue is that it's not clear what the fix is exactly :)
But as it turns out, I'm working on it at the moment. One of the reason it's been taking some time to address has been that there's several issues intertwined, and it's hard to isolate and fix them. It could also be that there's been a regression in 5.11 that has never been uncovered since it receives less testing than 5.10 can.
I've pushed my current fixes rebased on rpi-5.15.y here:
https://github.com/mripard/rpi-linux/tree/rpi/5.15-async-modeset-helpers
If it doesn't fix the issue you're seeing, could you let me know where I can grab/create an image of the system that triggers it?
satmandu commentedon Oct 14, 2021
Thanks. I'll do a build from that branch and see what happens.
satmandu commentedon Oct 14, 2021
@mripard building with your current kernel tree
pelwell commentedon Oct 14, 2021
It's a bad merge. Try deleting one of the two
commitdeclarations.satmandu commentedon Oct 14, 2021
After patching the rpi top of tree 5.15 with the two last commits in @mripard's tree, namely mripard@061eb3b and mripard@72be6d5, and then running
sed -i '/struct drm_crtc_commit \*commit\;/{x;//!d;x}' drivers/gpu/drm/vc4/vc4_kms.cand building the kernel, I still get:Building your kernel @mripard I get the same error after the system goes to sleep:
Happy to help debug this further.
My configuration may be particular because of the edid file I am using in cmdline.txt...
mripard commentedon Oct 15, 2021
Can you give me a way to download or create your image so that I can test?
satmandu commentedon Oct 15, 2021
@mripard Let me see if I can get a reproducer setup based on the Ubuntu Desktop 21.10 image at https://ubuntu.com/download/raspberry-pi
satmandu commentedon Oct 15, 2021
Actually, I made minor settings changes to the stock Ubuntu 21.10 image and got this issue running on a RPI4B. I think the only relevant change was to enable automatic login (during setup) and then disable automatic screen lock thus:
Settings -> Privacy -> Automatic Screen Lock (set to disabled.)
I left the blank screen delay at 5 minutes.
I then rebooted and waited. Once the screen went to sleep, I got the error.
juergh commentedon Oct 18, 2021
@satmandu You're running Ubuntu and we are working on this: https://bugs.launchpad.net/bugs/1946368.
I'm in discussion with Maxime so please be a little a patient. In the meantime you can try the kernel mentioned in comment 13 .
satmandu commentedon Oct 18, 2021
@juergh It was silly of me to assume this discussion had not already gone upstream. Thanks all!
2 remaining items
mripard commentedon Oct 19, 2021
I meant you as in @satmandu
satmandu commentedon Oct 28, 2021
For what it is worth. I built a 5.15-rc7 kernel at 3a3fc22 yesterday, and I noticed that the screen shows up correctly at boot, but that playing videos with
ffplayappears to not actually show videos on the screen, which is interesting. Reverting to the stock ubuntu kernel (linux-image-5.13.0-1008-raspi) does allow videos to play correctly. Maybe this is another issue though...popcornmix commentedon Oct 28, 2021
I've noticed kodi doesn't display video for the first few seconds on 5.15-rc7, but then starts and is fine for rest of file.
No errors in dmesg. Is this ffplay from ubuntu?
Any idea if it is trying to display a drm YUV plane? (modetest from another ssh session may show what should be onscreen).
satmandu commentedon Oct 28, 2021
Yes I'm using the ubuntu ffplay.
Here's what I see running
FFREPORT=level=56:file=/tmp/ffplay.log XDG_RUNTIME_DIR=/run/user/1000 DISPLAY=:0 WAYLAND_DISPLAY=wayland-0 SDL_VIDEODRIVER=x11 /usr/bin/flock -n /tmp/ffplayvideo.lock nice -n 20 /usr/bin/ffplay -vcodec h264_v4l2m2m -rtsp_transport tcp rtsp://<rtsp URL> -fs -framedrop -fastTurns out that adding
-vcodec h264_v4l2m2mto the ffplay command line is what breaks the output. When I remove that I get video on the screen:popcornmix commentedon Oct 28, 2021
Funnily enough my kodi issue seems to be h264 only. hevc and sw decode are okay. Possibly a v4l2 decoder issue.
satmandu commentedon Oct 28, 2021
@popcornmix It does look like trying to offload h264 decoding causes the problem here.
satmandu commentedon Oct 28, 2021
Aside from that, 3a3fc22 does appear to have the sleep ->
vc4-drm gpu: [drm] *ERROR* Timed out waiting for commitissue resolved. I can runsudo vcgencmd display_power 1to bring the screen back on...popcornmix commentedon Oct 28, 2021
Are you able to revert 56c8fad and test?
That fixes it for kodi.
popcornmix commentedon Oct 28, 2021
Changing line
enable = (unsigned int)-5;to-6makes it work for me.I think the limit to the number of buffers allowed is too low and can deadlock if client holds onto more than expected.
Kodi gets out of it as it resets stream after a few seconds (and for some reason that is subsequently happy).
jc-kynesim commentedon Oct 28, 2021
I thought/hoped/prayed that that setting only affected input buffers, but I guess I was too hopeful. At this point I'm not sure what the correct answer is.
popcornmix commentedon Jan 24, 2023
Sounds like this was resolved - okay to close?
satmandu commentedon Jan 24, 2023
Definitely resolved. I haven't seen this in a long time.