-
Notifications
You must be signed in to change notification settings - Fork 5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HVS Core Rate Requirements for KMS #4365
HVS Core Rate Requirements for KMS #4365
Conversation
Thanks, this helped a bit with 4096x2160-30 but the issues are not fully resolved. Testing on LibreELEC (kernel 5.10.39, May 24 fw) initial boot-up in 4096x2160-30 is fine. But after switching to 1920x1080-60 and then switching to 4096x2160-30 in kodi the screen blanked out after a few seconds (no signal on TV) - and I got flip_done timeout in dmesg. I could also reproduce that with just modetest (kodi not started at all), simply running I monitored core freq (with bcmstat), before and during modetest it ran at 277MHz but after exiting modetest it reported 267MHz. Here's dmesg: http://ix.io/3nX4 |
drm_atomic_get_crtc_state relies on drm_atomic_get_existing_crtc_state that is deprecated and isn't really clear on which state it provides. Even worse, after the states have been swapped, if the CRTC is present in the state drm_atomic_get_existing_crtc_state will return the old state, whereas if the CRTC is not present, we'll use a copy of crtc->state. crtc->state for the CRTC that is there at that point is the new state though, which leads to confusion. Let's provide two new helpers that make it clear what our expectations are. Signed-off-by: Maxime Ripard <[email protected]>
We'll need that function in vc4_kms to compute the core clock rate requirements. Signed-off-by: Maxime Ripard <[email protected]>
Depending on a given HVS output (HVS to PixelValves) and input (planes attached to a channel) load, the HVS needs for the core clock to be raised above its boot time default. Failing to do so will result in a vblank timeout and a stalled display pipeline. Signed-off-by: Maxime Ripard <[email protected]>
2e37303
to
59c7fa8
Compare
I've pushed two fixes that should address the issue you pointed out |
Thanks, with the updated version 4096x2160-30 is working fine! When running Compared to fkms kms doesn't seem to scale core below 267MHz (or 533 with hdmi_enable_4kp60=1) - fkms switches to 220MHz at 640x480-60 but kms runs core at 267 (or 533) MHz. |
I had a look and while I don't have 640x480, 720x480 puts the core clock at 200MHz. The firmware reports 200MHz as the minimum clock rate so Linux doesn't try to go below it, but I can't see the 267MHz? |
I just tested with my 1920x1200 monitor and with that I get 200MHz core clock as well (also on 1920x1200p60 mode). I saw the 267MHz clock when testng with my LG 55C8. Which monitor / edid did you use? I did another test with my 1920x1200 monitor, using firmware edid override with the LG edid but no kernel / DRM edid override - so FW had the LG edid, configured 3840x2160p30, then linux/DRM read the edid from the monitor and switched to 1920x1200p60 - and that gave 267MHz core clock as well. Quite interestingly clk debug info reported 200MHz min rate. Puzzling.
Here's the config.txt settings I added (I also attached the EDD file):
And these are the KMS config.txt settings we use in LibreELEC:
Anyways, the initial issue of 4096x2160p30 not working is fixed by the PR and this may be a different issue - just wanted to report it. |
I did another test: if I force 1920x1080p60 via config.txt, in addition to the fw edid override, I get 200MHz core clock.
config.txt:
@popcornmix could that be a FW (or fw clock driver) issue, like initial/boot FW core boost not being cleared when kms takes over? BTW: I also checked with latest FW/kernel, same result (267MHz at 2160p30)
|
Your guess is likely correct. Initially hdmi mode and framebuffer requires clock boost and are inherited by simple framebuffer in kernel. We don't have a mechanism to know when these are finished with. Forcing a lower pixel clock mode in config.txt is a temporary workaround. |
I think this is okay to merge. It improves broken 4k output with kms driver. |
See: raspberrypi/linux#4365 kernel: overlays: ghost-amp: Change early-disable sequence
See: raspberrypi/linux#4365 kernel: overlays: ghost-amp: Change early-disable sequence
These commits are now in rpi-5.11.y as well, but they'll need patching up for 5.12. |
How should we handle this? I guess the easiest would be for me to rebase the branch and send a new PR? |
@mripard yes, a PR to 5.12 would be welcome. |
Can you reproduce? |
I noticed that some things were off indeed on friday and am working on a fix. It's taking a bit longer than anticipated, sorry. A revert is fine by me |
Yes. Build https://github.com/tomba/kmsxx/ and run |
Confirmed - it falls over with hdmi display and |
Revert breakage to graphic stack by PR#4365 util fixed upstream 1. raspberrypi/linux#4365
Hi,
It turns out the HVS has a bunch of requirements for the clock rate while it operates depending on both the input and output. Those requirements were completely ignored so far and were ultimately resulting in a vblank timeout.
This implements a proper boost of the core clock based on the planes being used and the pixel valves modes.