Skip to content

RPi4/kms: boot hangs if two monitors are connected #4465

Closed

Description

@HiassofT

With current rpi-update kernel/firmware Hexxeh/rpi-firmware@dd59f0e boot hangs if vc4-kms-v3d is enabled and two monitors are connected (1920x1200 monitors here). With just one monitor connected boot completes successfully.

root@raspberrypi:~# uname -a
Linux raspberrypi 5.10.50-v7l+ #1438 SMP Mon Jul 19 10:46:09 BST 2021 armv7l GNU/Linux
root@raspberrypi:~# vcgencmd version
Jul 21 2021 16:21:46     
Copyright (c) 2012 Broadcom
version 6a796bb0062a6c75191c57cba1c13f9300076d02 (clean) (release) (start)

serial console log: http://ix.io/3tDb

I initially noticed that on LibreELEC running kernel e6410af

console log from LibreELEC: http://ix.io/3tDe

Bisecting through rpi-update firmwares the last working version is Hexxeh/rpi-firmware@9dbcd6d, the first bad vesion is Hexxeh/rpi-firmware@6d1196a

ping @mripard

Activity

  1. popcornmix commented on Jul 22, 2021

    @popcornmix
    Collaborator

    The regression started with #4441

    Specifically with the switch from downstream to upstream versions of:
    5948c83
    04e385b

    if I revert these two commits (with minor conflicts) the issue is gone.
    However the upstream and downstream forms of these commits are not trivially different, and it's tricky to re-apply the downstream, with the other intervening upstream commits.

    We may need to revert the whole sequence in the PR (and even that now has conflicts with other commits).

  2. mripard commented on Jul 23, 2021

    @mripard
    Contributor

    It's likely to be a kernel crash then. When Linux switches fbcon as soon as the DRM driver is registered, it takes the global console lock, and thus if you happen to have a crash during that first commit it will never output the usual stacktrace.

    I'll have a look

  3. popcornmix commented on Jul 23, 2021

    @popcornmix
    Collaborator

    Also tested rpi-5.14.y kernel which had a cleaner separation of upstream and downstream commits.
    Upstream is okay. The downstream commit where the issue starts is 41aa271 (i.e. same place I was seeing on 5.10 kernel).
    I believe the older form of this commit originally merged to 5.10 is okay, but the newer one submitted upstream is not.

  4. mripard commented on Jul 23, 2021

    @mripard
    Contributor

    Yeah, upstream doesn't have that commit yet, which kind of confirms that this is the culprit. I've been trying to figure out what's going on so far, but haven't really found anything yet.

  5. timg236 commented on Jul 23, 2021

    @timg236
    Contributor

    @mripard Do you think this is the same root cause as the clk_request_done panic that we were discussing the other day?

  6. mripard commented on Jul 23, 2021

    @mripard
    Contributor

    The PR #4470 should fix this issue.

    It's actually something that was found using KASAN, but I never backported it thinking it would reach stable, and yet it never did.. Sorry for that.

    @timg236 Yes, I believe it could be the same root cause. If you could give it a quick test it would be awesome

  7. timg236 commented on Jul 26, 2021

    @timg236
    Contributor

    Yes, I still see the same failure after launching Chromium a couple of times. The first time I also saw
    [code]
    [ 18.075549] r9:00000001 r8:30c5387d r7:30c5383d r6:ffffffff r5:20000010 r4:b6fd644c
    [ 18.075555] ---[ end trace 42e645bc91440d3c ]---
    [ 63.195149] [drm:drm_atomic_helper_wait_for_flip_done [drm_kms_helper]] ERROR [CRTC:76:crtc-3] flip_done timed out
    [ 63.195255] [drm:drm_atomic_helper_wait_for_dependencies [drm_kms_helper]] ERROR [CRTC:76:crtc-3] flip_done timed out
    [ 73.435041] vc4-drm gpu: [drm] ERROR Timed out waiting for flip_done
    [/code]

    and with a 4K display it looks like we are getting HVS underflows. I'll check whether something is trying to enable 4Kp60 without hdmi_enable_4kp60=1

  8. timg236 commented on Jul 26, 2021

    @timg236
    Contributor

    It's 4Kp30. FKMS has a steady core-clock frequency of 267218256 and I don't see underflows. I couldn't tell from the code whether this is safe but if KMS is adjusting core-clock frequency depending on the scene content then it needs to always pick the maximum of the next scene and the on-display scene (for each display)

  9. timg236 commented on Jul 26, 2021

    @timg236
    Contributor

    The problem is over-scan. FKMS crops, KMS is scaling. Scaling a 4K layer is quite expensive so that needs to be taking into account in the core-clock complexity. Or perhaps better, crop the image instead of scaling.

  10. timg236 commented on Jul 26, 2021

    @timg236
    Contributor

    Not core-clock related. This corruption is #4475

  11. 6by9 commented on Jul 27, 2021

    @6by9
    Contributor

    The problem is over-scan. FKMS crops, KMS is scaling.

    Legacy crops. Both FKMS and KMS scale. Unfortunately that was the implementation that mainline chose for margin support, I suspect because they advertise all the timings to userspace so trimming those modes down to reflect the overscan is trickier, and you'd have to retain the untrimmed modes internally in order to configure the actual hardware.

  12. popcornmix commented on Jul 27, 2021

    @popcornmix
    Collaborator

    I believe this is resolved with latest rpi-update kernel.

  13. HiassofT commented on Jul 28, 2021

    @HiassofT
    ContributorAuthor

    Testing on LibreELEC and RPiOS with two monitors connected was fine. Thanks!

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions