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
RPI4 : "flip_done timed out" after switching resolution #1357
Comments
I don't think you should be using vcgencmd to change resolution with FKMS (or any sort of DRM system) as this changes the resolution without DRM knowing it has happened. Same with tvservice - you are pulling the rug out from underneath DRM. Use the correct DRM tools to change resolution. Think it might be arandr? Not sure. |
Thanks for pointing me to this thread. |
AIUI, on startup the firmware will pass any config.txt data that specifies the screen size to DRM as a sort of EDID with a single entry. So that is how DRM know what resolution to use at startup, so can you use that? Or do you really need to change the resolution on the fly because I do not know how we could do that with DRM. It's not a bug with vcgencmd, it's simply not designed to work that way with DRM. |
@6by9 might have some ideas. |
@JamesH65 |
Something I wanted to add. |
If the timings result in timeouts when specified in config.txt then I'd read that as the timings being invalid. What are these magic timing values that you're using? If any of the horizontal timings are odd numbers then I suspect you will get issues as the Pi4 HVS runs at 2 pixels/clock. libdrm provides the relevant calls to set up new modes - see https://cgit.freedesktop.org/drm/libdrm/tree/xf86drmMode.h |
Hello, I may not have been clear enough or my english is not perfect (best option) in my very last messages. But it's not exactly my concern, with previous pi/os, I was able to change resolution and use exact timing I wanted with I'm not using X but only CLI |
It's not possible to have exactly the same functionality as before as we have moved to DRM/KMS/Mesa for the Pi4 (because the VC6 on the Pi4 is different). So you should not be using vcgencmd to change resolution, but an alternative, which is the modeset linked by 6by9 above. |
DRM/KMS resolution switch is a real pain.... Update hdmi_timings thru I have many compatibility issue because hdmi_timings is not working as on pi3... |
If you wish to ignore DRM/KMS then feel free. Remove We are moving towards using DRM/KMS by default as it is the Linux standard interface for rendering. Obsolete APIs will be marked as deprecated, and future support is not guaranteed. |
Did you try the modeset program from the link above? Did it work? If you haven't tried it, why not? It's no different to using vcgencmd (which will NOT be updated to work with DRM, as its a Pi specific API and being slowly deprecated ). Pi4 != Pi3. A very big change., and moving towards a more standardised API. Now is the time to move to that brave new, standardised, world. |
@JamesH65
So if you call modeset, you can only switch from I'm ok to switch to the new world, but when things were working fine, why removing them ;-) |
We haven't removed any code, its just that the vcgencmd only work in legacy graphics mode, and was never intended for use with DRM. It would mean writing a whole bunch of new code to make this work and we won't be doing that. The whole point is to move to a more open standard API, not make even more closed source stuff. Seems like this is a deficiency in DRM, you cannot pass your own parameters to set up the system at run time? @6by9? |
modetest is a test app only. Did you look at the underlying library?
with Google for drmModeAttachMode gives https://gist.github.com/sigmaris/df6863a64f6f768f5fb0e07c3c5f5d63, which looks like it has a good chance of mode switching as a test app. Likewise drmModeSetCrtc looks to be an alternate way to (temporarily?) set a new mode with user specified timings. https://cgit.freedesktop.org/mesa/drm/tree/xf86drmMode.h#n425
If running X, then xrandr allows you to add additional modes. This is standard for all DRM implementations therefore the Ubuntu page at https://askubuntu.com/questions/377937/how-to-set-a-custom-resolution is all valid. This is known to work as I've used it on multiple occasions with VGA666 (ie a DPI interface) where there is no EDID. I had asked what sort of timings values you were setting, ie please provide values. Without that then there will be no investigation as to whether or not things work. Sorry, I'm not going to try second guessing what you're doing. |
Hello, |
There's not much point in continually referring back to vcgencmd. The entire graphics system has changed on the Pi4, so that is where we need to concentrate. We won't be making any changes to vcgencmd in this area. It does sound like there may be an issue with the DPI drivers in DRM so that is what needs investigating. |
@JamesH65 As you guessed, this tool was really handy for me. I miss it. |
@JamesH65 @6by9 Has there been any progress on this? From what I understand neither a command line tool nor an API exists than can adjust DPI/vga666 display timings on the fly on the Pi4? Seems like the RetroArch folks are now using the DRM APIs instead of vcgencmd to do mode switching: ...but there still is the issue with the DPI interface not working without additional changes with that approach. @Cpasjuste has developed a custom kernel module + device tree overlay that fixes this: http://mydedibox.fr/rpi4-custom-modes-on-a-crt-tv-the-holy-grail/ Could this be merged/fixed so we don't require a workaround / add-on to have on-the-fly mode switching working with the DPI like it did with the legacy graphics stack? |
Based on a very quick look at that module, I believe the same can be achieved through the vc4-kms-dpi-generic overlay, which takes all the timing parameters via the overlay (not a secondary file). I'd only have a closer look at it if a PR was generated based on it. As I've said in #1357 (comment), the DRM/KMS API has always allowed the application to add and select a new mode or timings that aren't propagated from the driver. It's how |
@blitzcode I recently made a PR at retroarch to have full KMS modeswitching on OpenGL. I tested it on a specific Pi4 lakka build on both HDMI and DPI with a VGA666, works good. You don't need anything else. Just know that DPI can't do interlaced. All this to confirm @6by9 words: on KMS you can set any mode timing when creating a CRTC, there is no need for dark magic anywhere |
@6by9 @substring Thanks so much for letting me this is supposed to just work now. It is really hard to find any meaningful information about this, all my Google searches just bring up the same old discussions that say this is broken on the Pi4 and will never work. The best I could find after a lot of Googling was the blog post I linked, and even that is very dated information now. Is there a specific kernel version and also a RA release (v1.10.0 is on the latest RetroPie image) were all those changes would be included? In terms of configuration, something like this should work on a Pi4 with current firmware, right?
Or should I use The lack of interlaced video output is a hardware limitation, correct? |
The README documents what all the overlays do. dtoverlay=vga666 only sets up the GPIO mappings for when using the firmware drivers, hence saying "NOT for use with vc4-kms-v3d." There is vc4-kms-vga666. It'll default to basic resolutions, but has the option to enable the DDC link using GPIOs 0&1 should you wish to hook up to a genuine VGA monitor with EDID to be read. vc4-kms-dpi-generic allows you to set up the desired timing from the overlay. dpi_group/dpi_mode/dpi_timings are going to do nothing. Interlacing support has issues over how it should be configured from the simplified progressive mode that is passed in. There are options for odd field first or even field first, and what delay should be inserted on the two fields etc. Without a standardised way to interpret that information, there's no way to make a generic solution. |
And you can read bits of the README with the |
@blitzcode Let's not hijack further this issue. Just know that libretro/RetroArch@f24893b is my contribution to Retroarch, you can build it. It will be anyway shipped in RA 1.16. I used the generic vc4-kms-vga666 overlay, but I really preferred using HDMI (because interlaced works there). Getting your pi to boot in 240p will be quite tricky, even more with kernel 6.1, see https://forums.raspberrypi.com/viewtopic.php?t=344246&start=225#p2086061 |
@substring you linked to a post about
but that was fixed in raspberrypi/linux#5378 (and that fix has reached apt kernels). |
Thanks @6by9 / @substring / @pelwell for answering my dumb questions, I'll stop now ;-) It seems even years later for me the best strategy would be just keep waiting for fixes/improvements. I don't think I want to update my kernel, compile my own RetroArch and edit a device tree overlay and then debug whatever tricky issues arise with kernel 6.1 and what else I've missed. It's a shame this has regressed so much from the Pi3 days. I can see why so many people in the CRT gaming community still think this isn't working at all on the Pi4. Seems like the RGBPi/Recalbox folk have figured out a solution a while ago that works for them, but I don't think I'll try to bring my own setup forward to the Pi4 at this point. |
Hello,
On some applications (retroarch, emulationstation,..), system is hanged if the resolution have been previously changed with command
vcgencmd hdmi_timings
dmesg show sometimes this error :
[drm:drm_atomic_helper_wait_for_flip_done [drm_kms_helper]] *ERROR* [CRTC:49:crtc-0] flip_done timed out
or sometimes :
[drm:drm_atomic_helper_wait_for_dependencies [drm_kms_helper]] *ERROR* [CRTC:49:crtc-0] flip_done timed out
Also,
vcdbg log msg
is giving this errorTV service:host side not connected, dropping notification
to unlock the system, you have to issue a
tvservice -s
from another console.Applications are runing fine if resolution have not been changed previously.
RPI4 is configured with
vc4-fkms-v3d
overlay, monitor connected to the dpi port (no hdmi connected)Thanks
The text was updated successfully, but these errors were encountered: