alanbork
Posts: 125
Joined: Thu Apr 23, 2020 11:18 pm

any way to add all dmt/cea modes to a fake edid file?

Wed Oct 14, 2020 9:26 pm

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.

cleverca22
Posts: 2917
Joined: Sat Aug 18, 2012 2:33 pm

Re: any way to add all dmt/cea modes to a fake edid file?

Wed Oct 14, 2020 9:39 pm

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
6by9 wrote:
Mon Sep 21, 2020 8:00 am
The 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.
by looking into the specs of how an EDID file works, it should be possible to generate a custom one fairly easily
https://en.wikipedia.org/wiki/Extended_ ... ata_format

alanbork
Posts: 125
Joined: Thu Apr 23, 2020 11:18 pm

Re: any way to add all dmt/cea modes to a fake edid file?

Wed Oct 14, 2020 11:16 pm

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.

alanbork
Posts: 125
Joined: Thu Apr 23, 2020 11:18 pm

Re: any way to add all dmt/cea modes to a fake edid file?

Sat Oct 24, 2020 5:39 pm

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? ;-)

6by9
Raspberry Pi Engineer & Forum Moderator
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?

Sun Oct 25, 2020 6:06 pm

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).
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.

alanbork
Posts: 125
Joined: Thu Apr 23, 2020 11:18 pm

Re: any way to add all dmt/cea modes to a fake edid file?

Mon Oct 26, 2020 7:17 pm

6by9 wrote:
Sun Oct 25, 2020 6:06 pm
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.
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
6by9 wrote:
Sun Oct 25, 2020 6:06 pm
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).
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.

6by9
Raspberry Pi Engineer & Forum Moderator
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?

Tue Oct 27, 2020 7:57 am

alanbork wrote:
Mon Oct 26, 2020 7:17 pm
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.
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
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.
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'.

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.

6by9
Raspberry Pi Engineer & Forum Moderator
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?

Tue Oct 27, 2020 2:21 pm

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.
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.

andrum99
Posts: 1384
Joined: Fri Jul 20, 2012 2:41 pm

Re: any way to add all dmt/cea modes to a fake edid file?

Wed Oct 28, 2020 10:08 pm

6by9 wrote:
Tue Oct 27, 2020 7:57 am
Sorry, I still feel that enabling all modes is not sensible.

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}.

alanbork
Posts: 125
Joined: Thu Apr 23, 2020 11:18 pm

Re: any way to add all dmt/cea modes to a fake edid file?

Wed Oct 28, 2020 10:24 pm

andrum99 wrote: One option would be to enable all modes, but default to a safe mode, e.g. 1024x768@60Hz.
the best choice would be to default to the preferred resolution from the edid - that's never wrong.

andrum99
Posts: 1384
Joined: Fri Jul 20, 2012 2:41 pm

Re: any way to add all dmt/cea modes to a fake edid file?

Thu Oct 29, 2020 12:19 pm

alanbork wrote:
Wed Oct 28, 2020 10:24 pm
andrum99 wrote: One option would be to enable all modes, but default to a safe mode, e.g. 1024x768@60Hz.
the best choice would be to default to the preferred resolution from the edid - that's never wrong.
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.

alanbork
Posts: 125
Joined: Thu Apr 23, 2020 11:18 pm

Re: any way to add all dmt/cea modes to a fake edid file?

Thu Oct 29, 2020 4:03 pm

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.
I suppose there's always exceptions.

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 :-(

andrum99
Posts: 1384
Joined: Fri Jul 20, 2012 2:41 pm

Re: any way to add all dmt/cea modes to a fake edid file?

Fri Oct 30, 2020 5:12 pm

alanbork wrote:
Thu Oct 29, 2020 4:03 pm
in any case no need to default to anything

By 'default' I was meaning that there be a setting which, when enabled, forces the console to come up in a default video mode, and tells Linux to make all other standard modes available.

alanbork
Posts: 125
Joined: Thu Apr 23, 2020 11:18 pm

Re: any way to add all dmt/cea modes to a fake edid file?

Fri Oct 30, 2020 5:35 pm

andrum99 wrote:
Fri Oct 30, 2020 5:12 pm
By 'default' I was meaning that there be a setting which, when enabled, forces the console to come up in a default video mode, and tells Linux to make all other standard modes available.
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.

andrum99
Posts: 1384
Joined: Fri Jul 20, 2012 2:41 pm

Re: any way to add all dmt/cea modes to a fake edid file?

Sun Nov 01, 2020 6:10 pm

alanbork wrote:
Fri Oct 30, 2020 5:35 pm
andrum99 wrote:
Fri Oct 30, 2020 5:12 pm
By 'default' I was meaning that there be a setting which, when enabled, forces the console to come up in a default video mode, and tells Linux to make all other standard modes available.
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.
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

alanbork
Posts: 125
Joined: Thu Apr 23, 2020 11:18 pm

Re: any way to add all dmt/cea modes to a fake edid file?

Sun Nov 01, 2020 6:21 pm

Why not

hdmi_mode=16

(or whatever)

in config.txt ?

Return to “Advanced users”