Skip to content

RPi3 B 1.2: 'flip_done timed out' when turning monitor off and on again #4962

Closed

Description

@z0rti

I got this error with my RPi3 using 'dtoverlay=vc4-kms-v3d' (on bullseye)
I'm using 'hdmi_mode=4' in config.txt
It boots up fine (HDMI monitor is on)
but when i turn the monitor off and on again i don't get a picture anymore, until i do a hard reset (pull power off)

Mar 26 20:08:28 pi3 kernel: [ 2500.612845] ------------[ cut here ]------------
Mar 26 20:08:28 pi3 kernel: [ 2500.612857] Timeout waiting for VC4_HDMI_SCHEDULER_CONTROL_HDMI_ACTIVE
Mar 26 20:08:28 pi3 kernel: [ 2500.612978] WARNING: CPU: 2 PID: 6289 at drivers/gpu/drm/vc4/vc4_hdmi.c:1336 vc4_hdmi_encoder_post_crtc_enable+0x1064/0x11a8 [vc
4]
Mar 26 20:08:28 pi3 kernel: [ 2500.612983] Modules linked in: ccm rfcomm algif_hash algif_skcipher af_alg bnep hci_uart btbcm bluetooth ecdh_generic ecc 8021q
garp stp llc snd_soc_hdmi_codec rt2800usb rt2800lib rt2x00usb rt2x00lib joydev brcmfmac mac80211 brcmutil crc_ccitt vc4 libarc4 cec cfg80211 drm_kms_helper rfk
ill snd_soc_core snd_compress snd_pcm_dmaengine syscopyarea sysfillrect sysimgblt fb_sys_fops raspberrypi_hwmon i2c_bcm2835 bcm2835_codec(C) bcm2835_v4l2(C) bc
m2835_isp(C) bcm2835_mmal_vchiq(C) v4l2_mem2mem videobuf2_vmalloc videobuf2_dma_contig videobuf2_memops videobuf2_v4l2 snd_bcm2835(C) videobuf2_common snd_pcm
snd_timer snd vc_sm_cma(C) videodev mc uio_pdrv_genirq uio i2c_dev aes_neon_bs aes_neon_blk crypto_simd cryptd drm drm_panel_orientation_quirks backlight fuse
ip_tables x_tables ipv6
Mar 26 20:08:28 pi3 kernel: [ 2500.613222] CPU: 2 PID: 6289 Comm: kworker/2:2 Tainted: G         C        5.10.92-v8+ raspberrypi/firmware#1514
Mar 26 20:08:28 pi3 kernel: [ 2500.613226] Hardware name: Raspberry Pi 3 Model B Rev 1.2 (DT)
Mar 26 20:08:28 pi3 kernel: [ 2500.613294] Workqueue: events output_poll_execute [drm_kms_helper]
Mar 26 20:08:28 pi3 kernel: [ 2500.613304] pstate: 80000005 (Nzcv daif -PAN -UAO -TCO BTYPE=--)
Mar 26 20:08:28 pi3 kernel: [ 2500.613331] pc : vc4_hdmi_encoder_post_crtc_enable+0x1064/0x11a8 [vc4]
Mar 26 20:08:28 pi3 kernel: [ 2500.613357] lr : vc4_hdmi_encoder_post_crtc_enable+0x1064/0x11a8 [vc4]
Mar 26 20:08:28 pi3 kernel: [ 2500.613361] sp : ffffffc0132538a0
Mar 26 20:08:28 pi3 kernel: [ 2500.613365] x29: ffffffc0132538a0 x28: 0000000000000001
Mar 26 20:08:28 pi3 kernel: [ 2500.613375] x27: ffffffc0090e43e8 x26: 0000000000000500
Mar 26 20:08:28 pi3 kernel: [ 2500.613385] x25: ffffff80076d3c50 x24: ffffff80076d3c30
Mar 26 20:08:28 pi3 kernel: [ 2500.613395] x23: ffffffc010e1d178 x22: ffffff80076d3c28
Mar 26 20:08:28 pi3 kernel: [ 2500.613405] x21: 0000024637dffa7e x20: ffffff80076d34b8
Mar 26 20:08:28 pi3 kernel: [ 2500.613415] x19: ffffff80076d3080 x18: 0000000000000000
Mar 26 20:08:28 pi3 kernel: [ 2500.613425] x17: 0000000000000000 x16: 0000000000000000
Mar 26 20:08:28 pi3 kernel: [ 2500.613434] x15: 0000007f8adf46a8 x14: 0000000000000000
Mar 26 20:08:28 pi3 kernel: [ 2500.613444] x13: 0000000000000000 x12: ffffffc0113154f8
Mar 26 20:08:28 pi3 kernel: [ 2500.613453] x11: 0000000000000003 x10: ffffffc0112fd4b8
Mar 26 20:08:28 pi3 kernel: [ 2500.613463] x9 : ffffffc0100e6558 x8 : 0000000000017fe8
Mar 26 20:08:28 pi3 kernel: [ 2500.613473] x7 : c0000000ffffefff x6 : ffffffc013253500
Mar 26 20:08:28 pi3 kernel: [ 2500.613483] x5 : 0000000000000001 x4 : 0000000000000000
Mar 26 20:08:28 pi3 kernel: [ 2500.613492] x3 : 0000000000000001 x2 : 0000000000000000
Mar 26 20:08:28 pi3 kernel: [ 2500.613502] x1 : bcd5c0829e029300 x0 : 0000000000000000
Mar 26 20:08:28 pi3 kernel: [ 2500.613511] Call trace:
Mar 26 20:08:28 pi3 kernel: [ 2500.613539]  vc4_hdmi_encoder_post_crtc_enable+0x1064/0x11a8 [vc4]
Mar 26 20:08:28 pi3 kernel: [ 2500.613565]  vc4_crtc_atomic_enable+0x3d0/0x4a8 [vc4]
Mar 26 20:08:28 pi3 kernel: [ 2500.613609]  drm_atomic_helper_commit_modeset_enables+0x210/0x258 [drm_kms_helper]
Mar 26 20:08:28 pi3 kernel: [ 2500.613635]  vc4_atomic_complete_commit+0x1dc/0x6a8 [vc4]
Mar 26 20:08:28 pi3 kernel: [ 2500.613660]  vc4_atomic_commit+0x1b0/0x200 [vc4]
Mar 26 20:08:28 pi3 kernel: [ 2500.613785]  drm_atomic_commit+0x54/0x68 [drm]
Mar 26 20:08:28 pi3 kernel: [ 2500.613877]  drm_client_modeset_commit_atomic.isra.16+0x1ec/0x290 [drm]
Mar 26 20:08:28 pi3 kernel: [ 2500.613963]  drm_client_modeset_commit_locked+0x68/0x1a8 [drm]
Mar 26 20:08:28 pi3 kernel: [ 2500.614050]  drm_client_modeset_commit+0x38/0x60 [drm]
Mar 26 20:08:28 pi3 kernel: [ 2500.614094]  __drm_fb_helper_restore_fbdev_mode_unlocked+0xd4/0x118 [drm_kms_helper]
Mar 26 20:08:28 pi3 kernel: [ 2500.614139]  drm_fb_helper_set_par+0x44/0x80 [drm_kms_helper]
Mar 26 20:08:28 pi3 kernel: [ 2500.614184]  drm_fb_helper_hotplug_event.part.24+0xb4/0xe8 [drm_kms_helper]
Mar 26 20:08:28 pi3 kernel: [ 2500.614228]  drm_fbdev_client_hotplug+0x44/0x1b8 [drm_kms_helper]
Mar 26 20:08:28 pi3 kernel: [ 2500.614314]  drm_client_dev_hotplug+0x80/0xc8 [drm]
Mar 26 20:08:28 pi3 kernel: [ 2500.614357]  drm_kms_helper_hotplug_event+0x3c/0x50 [drm_kms_helper]
Mar 26 20:08:28 pi3 kernel: [ 2500.614401]  output_poll_execute+0x1e0/0x230 [drm_kms_helper]
Mar 26 20:08:28 pi3 kernel: [ 2500.614413]  process_one_work+0x1f4/0x4d8
Mar 26 20:08:28 pi3 kernel: [ 2500.614419]  worker_thread+0x50/0x480
Mar 26 20:08:28 pi3 kernel: [ 2500.614427]  kthread+0x148/0x158
Mar 26 20:08:28 pi3 kernel: [ 2500.614435]  ret_from_fork+0x10/0x30
Mar 26 20:08:28 pi3 kernel: [ 2500.614440] ---[ end trace cca87e7ca102e151 ]---
Mar 26 20:08:28 pi3 kernel: [ 2500.614515] ------------[ cut here ]------------
[...]
Mar 26 20:08:39 pi3 kernel: [ 2510.824308] [drm:drm_atomic_helper_wait_for_flip_done [drm_kms_helper]] *ERROR* [CRTC:76:crtc-3] flip_done timed out
$ lsb_release -d
Description:    Debian GNU/Linux 11 (bullseye)
$ uname -a
Linux pi3 5.10.92-v8+ raspberrypi/firmware#1514 SMP PREEMPT Mon Jan 17 17:39:38 GMT 2022 aarch64 GNU/Linux

So i'm currently using 'dtoverlay=vc4-fkms-v3d' where this doesn't happen.

Activity

  1. popcornmix commented on Mar 27, 2022

    @popcornmix
    Collaborator

    Can you try running rpi-update to switch to the 5.15 kernel branch? Is the issue still there?
    This is intended to become the stable kernel in apt in the very near future.

  2. simnalamburt commented on Mar 28, 2022

    @simnalamburt

    @popcornmix I could reproduce this issue with 5.15.30-v8+.

  3. popcornmix commented on Mar 28, 2022

    @popcornmix
    Collaborator

    That's good. That should be default kernel pretty soon.

  4. pelwell commented on Mar 28, 2022

    @pelwell
    Contributor

    It doesn't sound good if @simnalamburt can reproduce the issue with 5.15.30.

  5. popcornmix commented on Mar 28, 2022

    @popcornmix
    Collaborator

    Sorry - I misread his post. I'll see if I can reproduce.

  6. popcornmix commented on Mar 28, 2022

    @popcornmix
    Collaborator

    I didn't see this on my monitor when switching into/out of standby.
    I didn't see when switching AV indput on monitor.
    I didn't see when unplugging/replugging hdmi cable.
    I did see it when unplugging monitor from mains / plugging back in (specifically on plugging back in).

    (note: what happens to hotplug signal and ability to read edid in each of these cases tends to be monitor specific).

  7. added
    KMS Issue
    on Mar 28, 2022
  8. popcornmix commented on Mar 28, 2022

    @popcornmix
    Collaborator

    Transferred to linux kernel issues and added KMS label.

  9. popcornmix commented on Mar 28, 2022

    @popcornmix
    Collaborator

    I have a look, but not seen anything obvious. Increasing the timeout to 10s doesn't help.
    HDMI_SCHEDULER_CONTROL=0xcb029 so we've requested hdmi mode but it's not reported as being active.

    aside: we are setting VC4_HDMI_SCHEDULER_CONTROL_VERT_ALWAYS_KEEPOUT when I don't think we should - that is only needed with HDCP which we will never support. But I don't believe that is related.

    I have seen the failure when replugging hdmi cable, but it's not happening every time.
    I haven't seen it on my monitor when switching to standby (as monitor doesn't deassert hotplug).

    @mripard @timg236 any thoughts?
    I'm guessing we are in the wrong state to do this (e.g. missing clock, or shutdown or reset of something), but I don't know much about the hdmi block.

    10 hdmi unplug/replug cycles on Pi4 hasn't triggered it.

  10. popcornmix commented on Mar 30, 2022

    @popcornmix
    Collaborator

    @z0rti adding video=HDMI-A-1:D to end of /boot/cmdline.txt might provide a workaround for this issue (while we continue to look into it).

  11. popcornmix commented on Mar 30, 2022

    @popcornmix
    Collaborator

    @mripard before the failure (from /sys/kernel/debug/clk/clk_summary):
    fw-clk-pixel 1 1 0 148500000 0 0 50000 Y

    $ vcgencmd measure_clock pixel
    frequency(29)=148500000
    

    and after:
    fw-clk-pixel 0 0 0 148500000 0 0 50000 Y

    $ vcgencmd measure_clock pixel
    frequency(29)=0
    

    So I guess fw-clk-pixel is not running in the failure mode, and you can't switch hdmi mode (through HDMI_SCHEDULER_CONTROL) without the pixel clock running.

  12. mripard commented on Mar 31, 2022

    @mripard
    Contributor

    I had a look this morning, but couldn't reproduce it here

    I didn't see this on my monitor when switching into/out of standby.
    I didn't see when switching AV indput on monitor.
    I didn't see when unplugging/replugging hdmi cable.
    I did see it when unplugging monitor from mains / plugging back in (specifically on plugging back in).

    I'm not sure I understand the difference between the last two. Did you unplug the HDMI cable on the first, and the power plug on the last?

    I'll look at the code to see if there's anything obvious

  13. mripard commented on Mar 31, 2022

    @mripard
    Contributor

    The only case where this could happen is if one of the functions in vc4_hdmi_encoder_pre_crtc_configure that can error (clk_set_rate, clk_set_min_rate, clk_prepare_enable or pm_runtime_resume_and_get) does return an error. Can you print the rest of the logs before that warning? All these functions should have an error message logged if they fail.

  14. mripard commented on Mar 31, 2022

    @mripard
    Contributor

    Another thing I just remembered, we don't use the hotplug interrupts on the 3B and the polling interval is 10s so plugging/unplugging the monitor fairly fast might be ignored and lead to inconsistent behaviours.

  15. 38 remaining items

  16. 21a1ss3 commented on Aug 30, 2022

    @21a1ss3

    I can confirm that issue has been fixed for me as well. Now if X goes to screensaver and turns off monitor clocks went down to 0 and afterwards, on wake up, successully restores backward to previous value.

  17. popcornmix commented on Aug 31, 2022

    @popcornmix
    Collaborator

    @mripard

    But there's is a dedicated VEC power domain, right?

    No, I don't believe so (in a hardware sense). Software treats HDMI and VEC domains identically:

       case SYSMAN_BLOCK_HDMI:         return POWER_DOMAIN_IMAGE | POWER_DOMAIN_IMAGE_PERI | POWER_DOMAIN_HDMI_LDO;
       case SYSMAN_BLOCK_VEC:          return POWER_DOMAIN_IMAGE | POWER_DOMAIN_IMAGE_PERI | POWER_DOMAIN_HDMI_LDO; // pllh is inside hdmi phy
    

    SYSMAN_BLOCK_HDMI / SYSMAN_BLOCK_VEC is what kernel passes in through RPI_FIRMWARE_SET_DOMAIN_STATE. But they both behave the same.
    It is reference counted so you can request HDMI and VEC then release VEC and HDMI and the power domains will only be disabled when both releases are in. But it would behave no differently from you using HDMI in both cases.

  18. popcornmix commented on Aug 31, 2022

    @popcornmix
    Collaborator

    So we effectively have a dependency of the VEC power domain on the HDMI one?

    More specifically they are really the same domain as they share the same hardware resource (PLLH).

  19. mripard commented on Sep 1, 2022

    @mripard
    Contributor

    So, if it is reference counted, I'm not sure what the original issue that got addressed by the new firmware was? Was the power domain itself reference counted, but not the clock side?

  20. popcornmix commented on Sep 1, 2022

    @popcornmix
    Collaborator

    Yes, clock are set to zero when all users of POWER_DOMAIN_HDMI_LDO are gone (and that occurs on hotplug deassert). They were not being set back by firmware or kernel when POWER_DOMAIN_HDMI_LDO was enabled again.
    The lack of clocks (and PLLH) caused register accessed to HDMI to fail after hotplug assert.

    Someone needs to start clocks again. With the recent firmware update that is done by firmware (restoring VEC and PIXEL clocks to values they had when domain went down).

  21. mripard commented on Sep 7, 2022

    @mripard
    Contributor

    Ok, thanks for the explanation :)

  22. popcornmix commented on Oct 18, 2022

    @popcornmix
    Collaborator

    Closing as believed to be fixed.

  23. aaronriekenberg commented on Oct 19, 2022

    @aaronriekenberg

    Just for understanding: is there a way to know from firmware version and/or linux kernel version if running with the fix for this?

    Thank you!

  24. popcornmix commented on Oct 19, 2022

    @popcornmix
    Collaborator

    The fix was in firmware here:
    raspberrypi/firmware@ecc243c

    If vcgencmd version reports Aug 26 2022 or later you should be fine.

  25. aaronriekenberg commented on Oct 19, 2022

    @aaronriekenberg

    Looks like this has made it into current Raspberry Pi OS even without running rpi-update

    $ vcgencmd version
    Aug 26 2022 14:04:36
    Copyright (c) 2012 Broadcom
    version 102f1e848393c2112206fadffaaf86db04e98326 (clean) (release) (start)
    

    Thanks again @popcornmix !

  26. fritol commented on Oct 29, 2022

    @fritol

    Closing as believed to be fixed
    note really

    it started for me after firmware update
    pi 4
    64bit rasp

    fine before

  27. popcornmix commented on Oct 30, 2022

    @popcornmix
    Collaborator

    it started for me after firmware update
    pi 4
    64bit rasp

    This issue only affected pi0-3 and is fixed.
    If you have an issue with Pi4 then create a new issue giving full details of how it occurs.

  28. added a commit that references this issue on Jul 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    KMS Issue

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions