I'd like DRM/FKMS to be able to set any mode in the cea/cmt list rather than be limited by the ones reported by the monitor. I don't mind that the list will be 200 lines long. is there a way to do this, either by generating a fake edid that covers all modes, or some other bootup configuration flag?
I'm using FKMS on a pi4 at the console (no X11). I realize I could do this by editing the boot/config.txt file and rebooting but that's pretty slow and goes horribly wrong if the mode in question isn't actually supported.
on a pi3 or earlier the edid doesn't matter since you can just force whatever mode you want with tvservice.
-
- Posts: 2917
- Joined: Sat Aug 18, 2012 2:33 pm
Re: any way to add all dmt/cea modes to a fake edid file?
fkms goes thru the firmware, so you can use the old tvservice command to force the firmware into any mode you want, and it accepts the cea/dmt numbers
last time i tried it, the fkms itself crashed though, so your main sign of if its working, will be the difference between a solid black image and the monitor complaining about an invalid signal
then you would have to force the chosen mode in config.txt
https://en.wikipedia.org/wiki/Extended_ ... ata_format
last time i tried it, the fkms itself crashed though, so your main sign of if its working, will be the difference between a solid black image and the monitor complaining about an invalid signal
then you would have to force the chosen mode in config.txt
by looking into the specs of how an EDID file works, it should be possible to generate a custom one fairly easily6by9 wrote: ↑Mon Sep 21, 2020 8:00 amThe EDID can advertise either fully specified timings, CEA mode lookups, or DMT mode lookups. The drm framework has to be able to convert all of these into complete timing information, hence why it has an implementation of the cvt algorithm, along with a complete list of the DMT and CEA modes.
https://en.wikipedia.org/wiki/Extended_ ... ata_format
Re: any way to add all dmt/cea modes to a fake edid file?
This is not about configuring the console (although to be fair I have asked about that in the past) - it's about getting programs that draw graphics to use non advertised modes/refresh rates. So setting config.txt and rebooting every time is certainly not a great solution.
Re: any way to add all dmt/cea modes to a fake edid file?
having read the edid spec provided above, a generic edid might not be a great idea because there's a lot specified in the file besides supported resolutions. The ideal solution would be if the pi supported a config flag that just set all CEA/DMT modes as supported, rather than selectively adding just those at the end of the EDID. Anybody listening? 

-
- Raspberry Pi Engineer & Forum Moderator
- Posts: 10584
- Joined: Wed Dec 04, 2013 11:27 am
- Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.
Re: any way to add all dmt/cea modes to a fake edid file?
So you add all the DMT and CEA modes, the DRM's emulated framebuffer or X chooses a mode that your monitor doesn't support, and now you can't see the display and complain about that.
FKMS parses the EDID, so all mode selections from config.txt are ignored.
You can add additional modes to fit your requirements using either the DRM API or xrandr within X, and at least that way it is under your control (and your mess if you get it wrong).
FKMS parses the EDID, so all mode selections from config.txt are ignored.
You can add additional modes to fit your requirements using either the DRM API or xrandr within X, and at least that way it is under your control (and your mess if you get it wrong).
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.
I'm not interested in doing contracts for bespoke functionality - please don't ask.
Re: any way to add all dmt/cea modes to a fake edid file?
still isn't that a better option than forcing a hdmi mode in config.txt and having it generated using the cvt algorithm instead of the defined cea/dht modes? and isn't it better to give users the option to choose a mode after bootup rather than guessing blindly by editing the config.txt and rebooting? right now we have very little options if our EDID is wrong, so we will definitely complain. at least this suggestion leaves complaining only for cases where we have a bad edid *and* mess up. You could always require a magic number just like the current hdmi_ignore_edid option in config.txt
not every app has source code available and even if they do, a large percentage of your users (I'd guess 99%) can't be expected to learn the drm api to add modes directly. xrandr is a reasonable option but only if you are using X. I've already figured out how to add custom modes with DRM but speaking from experience it was a challenging and poorly documented process that took a couple hours to get right. I don't think it's reasonable to expect everybody to do that.
have you ever dealt with a bad EDID that was missing modes? If you have I'd think you'd be more sympathetic to our pain.
-
- Raspberry Pi Engineer & Forum Moderator
- Posts: 10584
- Joined: Wed Dec 04, 2013 11:27 am
- Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.
Re: any way to add all dmt/cea modes to a fake edid file?
I've done more EDID analysis and generation that I've ever wished to do.
If your monitor advertises a partial/incomplete EDID then complain to the monitor manufacturer.
How do you fix it on your Linux desktop PC? All the same techniques should now work on the Pi.
All the kernel code is open source, so if you want to mess with how DRM generates modes from the kernel command line, then knock yourself out. I'd suggest you start a discussion on the dri-devel mailing list if you want such a thing merged.
One potentially valid option would be an additional flag to the video= parser to denote "choose the CEA (or DMT) mode with these width/height/refresh parameters, and ignore me totally if such a thing doesn't exist". Actually I note that the fbdev docs say 'M' is
so one could argue that DRM using CVT or GTF differs from the docs. When I have a few more minutes I may check to see what the fbdev code actually does with 'M'.If 'M' is specified in the mode_option argument (after <yres> and before <bpp> and <refresh>, if specified) the timings will be calculated using VESA(TM) Coordinated Video Timings instead of looking up the mode from a table.
Sorry, I still feel that enabling all modes is not sensible.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.
I'm not interested in doing contracts for bespoke functionality - please don't ask.
-
- Raspberry Pi Engineer & Forum Moderator
- Posts: 10584
- Joined: Wed Dec 04, 2013 11:27 am
- Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.
Re: any way to add all dmt/cea modes to a fake edid file?
To follow up, fbdev uses the table at https://github.com/raspberrypi/linux/bl ... dedb.c#L36 via fb_find_mode.
With 'M' uses the cvt algorithm, whilst without it it uses the table. It'd need some digging to find out why DRM didn't follow that.
With 'M' uses the cvt algorithm, whilst without it it uses the table. It'd need some digging to find out why DRM didn't follow that.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.
I'm not interested in doing contracts for bespoke functionality - please don't ask.
Re: any way to add all dmt/cea modes to a fake edid file?
One option would be to enable all modes, but default to a safe mode, e.g. 1024x768@60Hz. That way the user could select whichever mode they wanted, but the display should still come up first to allow them to choose their preferred mode. This would be useful in the case where a user would otherwise have no working display, unless they fiddled with settings. I'm thinking of either a cmdline.txt or config.txt setting which could be enabled easily be accessing the FAT partition. Or maybe a magic file, like ssh{.txt}.
Re: any way to add all dmt/cea modes to a fake edid file?
the best choice would be to default to the preferred resolution from the edid - that's never wrong.andrum99 wrote: One option would be to enable all modes, but default to a safe mode, e.g. 1024x768@60Hz.
Re: any way to add all dmt/cea modes to a fake edid file?
Except when it is. Some displays have wonky EDIDs due to the manufacturer not getting it right. For example, my old TV has the EDID for a completely different display - it's not even the same brand. There is also at least one mode that the Pi 4 does not support, i.e. 1366x768.
Re: any way to add all dmt/cea modes to a fake edid file?
I suppose there's always exceptions.andrum99 wrote: Except when it is. Some displays have wonky EDIDs due to the manufacturer not getting it right. For example, my old TV has the EDID for a completely different display - it's not even the same brand. There is also at least one mode that the Pi 4 does not support, i.e. 1366x768.
in any case no need to default to anything, since the config.txt file allows you to select any mode you want (though it generates the mode via generic cvt timings rather than using the official standards if it's not in the edid).
also 6by9 has said this feature isn't going to happen so unless there's a groundswell of support beyond you and me, I'm sure it's never going to happen

Re: any way to add all dmt/cea modes to a fake edid file?
really you just want a setting to make all standard modes available, as there's already a config setting to select a mode during bootup.
Re: any way to add all dmt/cea modes to a fake edid file?
Good point - I had forgotten that there was this option. For anyone that hits this thread via google, forcing (F)KMS to use a specific video mode is documented at https://www.raspberrypi.org/documentati ... ine-txt.md
Re: any way to add all dmt/cea modes to a fake edid file?
Why not
hdmi_mode=16
(or whatever)
in config.txt ?
hdmi_mode=16
(or whatever)
in config.txt ?