Page 1 of 1

Where to find the source handling hdmi_safe in config.txt?

Posted: Sat Sep 21, 2019 9:18 am
by thinking
Hi all,

I try to find the source code where hdmi_safe is parsed from config.txt and processed and I can't find much about it where this setting is coded.

So anybody knows where I can find the source code?


The reasons is, that I have a display which works if hdmi_safe is enabled, but with every other setting it fails.
There are also a bunch of resources - which differ in settings - that mention that hdmi_safe=1 is the same as
hdmi_force_hotplug=1
hdmi_ignore_edid=0xa5000080
config_hdmi_boost=4
hdmi_group=2
hdmi_mode=4
disable_overscan=0
overscan_left=24
overscan_right=24
overscan_top=24
overscan_bottom=24
e.g. see https://www.raspberrypi.org/documentati ... t/video.md.

But if I set these settings and disable hdmi_safe, the display doesnt work like with every other setting I tried.
I also found other posts where this behaviour is mentioned. So I would like to look this up in the source code and if I can track this down, provide further information here on how hdmi_safe works.

Many thanks

Re: Where to find the source handling hdmi_safe in config.txt?

Posted: Sat Sep 21, 2019 9:28 am
by jamesh
That is parsed in the GPU firmware, so is closed source.

What is the display,? When connected without the settings below (which disable edid), you can dump the EDID of the display, then decode it. That can help determine what the problem is.

(It's not 1366x768 is it?)

Re: Where to find the source handling hdmi_safe in config.txt?

Posted: Sat Sep 21, 2019 11:42 am
by thinking
Many thanks for your fast reply.

Its a 10" touch screen connected via hdmi to my raspberry pi 4.
The resolution should be 1280x800.

I disabled all custom settings including hdmi_safe and the monitor shows "No signal".
Then ssh into the pi and executed below commands.
root@raspberrypi:~# tvservice -d edid.dat
Written 256 bytes to edid.dat
root@raspberrypi:~# edidparser edid.dat
Enabling fuzzy format match...
Parsing edid.dat...
HDMI:EDID version 1.3, 1 extensions, unknown aspect ratio
HDMI:EDID features - videodef 0x80 !standby !suspend !active off; colour encoding:RGB444|YCbCr422; sRGB is not default colourspace; preferred format is native; does not support GTF
HDMI:EDID found monitor range descriptor tag 0xfd
HDMI:EDID monitor range offsets: V min=0, V max=0, H min=0, H max=0
HDMI:EDID monitor range: vertical is 50-76 Hz, horizontal is 30-80 kHz, max pixel clock is 160 MHz
HDMI:EDID monitor range does not support GTF
HDMI:EDID found monitor name descriptor tag 0xfc
HDMI:EDID monitor name is AAA
HDMI:EDID failed to find a matching detail format for 1280x800p hfp:48 hs:32 hbp:43 vfp:3 vs:6 vbp:12 pixel clock:69 MHz
HDMI:EDID calculated refresh rate is 60 Hz
HDMI:EDID guessing the format to be 1280x800p @60 Hz
HDMI:EDID found preferred DMT detail timing format: 1280x800p @ 60 Hz (27)
HDMI:EDID found DMT detail timing format: 1280x768p @ 60 Hz (23)
HDMI:EDID established timing I/II bytes are A3 08 00
HDMI:EDID found DMT format: code 4, 640x480p @ 60 Hz in established timing I/II
HDMI:EDID found DMT format: code 8, 800x600p @ 56 Hz in established timing I/II
HDMI:EDID found DMT format: code 9, 800x600p @ 60 Hz in established timing I/II
HDMI:EDID found DMT format: code 16, 1024x768p @ 60 Hz in established timing I/II
HDMI:EDID standard timings block x 8: 0x81C0 0101 0101 0101 0101 0101 0101 0101
HDMI:EDID found DMT format: code 85, 1280x720p @ 60 Hz (16:9) in standard timing 0
HDMI:EDID parsing v3 CEA extension 0
HDMI:EDID monitor support - underscan IT formats:no, basic audio:yes, yuv444:yes, yuv422:yes, #native DTD:1
HDMI:EDID found CEA detail timing format: 1280x720p @ 60 Hz (4)
HDMI:EDID found CEA detail timing format: 720x480p @ 60 Hz (2)
HDMI:EDID found CEA detail timing format: 1920x1080i @ 50 Hz (20)
HDMI:EDID found CEA detail timing format: 1280x720p @ 50 Hz (19)
HDMI:EDID found CEA detail timing format: 720x576p @ 50 Hz (17)
HDMI:EDID found CEA format: code 16, 1920x1080p @ 60Hz (native)
HDMI:EDID found CEA format: code 5, 1920x1080i @ 60Hz
HDMI:EDID found CEA format: code 4, 1280x720p @ 60Hz
HDMI:EDID found CEA format: code 3, 720x480p @ 60Hz
HDMI:EDID found CEA format: code 7, 1440x480i @ 60Hz
HDMI:EDID found CEA format: code 2, 720x480p @ 60Hz
HDMI:EDID found CEA format: code 6, 1440x480i @ 60Hz
HDMI:EDID found CEA format: code 1, 640x480p @ 60Hz
HDMI:EDID found CEA format: code 31, 1920x1080p @ 50Hz
HDMI:EDID found CEA format: code 20, 1920x1080i @ 50Hz
HDMI:EDID found CEA format: code 19, 1280x720p @ 50Hz
HDMI:EDID found CEA format: code 18, 720x576p @ 50Hz
HDMI:EDID found CEA format: code 22, 1440x576i @ 50Hz
HDMI:EDID found CEA format: code 17, 720x576p @ 50Hz
HDMI:EDID found CEA format: code 21, 1440x576i @ 50Hz
HDMI:EDID found CEA format: code 32, 1920x1080p @ 24Hz
HDMI:EDID found audio format 2 channels PCM, sample rate: 32|44|48 kHz, sample size: 16|20|24 bits
HDMI:EDID found HDMI VSDB length 8
HDMI:EDID HDMI VSDB has physical address 1.0.0.0
HDMI:EDID HDMI VSDB supports AI:yes, dual link DVI:no
HDMI:EDID HDMI VSDB deep colour support - 48-bit:no 36-bit:yes 30-bit:yes DC_yuv444:yes
HDMI:EDID HDMI VSDB max TMDS clock 225 MHz
HDMI:EDID HDMI VSDB video latency 0 ms
HDMI:EDID HDMI VSDB audio latency 56 ms
HDMI:EDID HDMI VSDB interlaced audio latency 226 ms
HDMI:EDID HDMI VSDB does not support content type
HDMI:EDID filtering formats with pixel clock unlimited MHz or h. blanking unlimited
HDMI:EDID best score mode initialised to DMT (4) 640x480p @ 60 Hz with pixel clock 25 MHz (score 0)
HDMI:EDID best score mode is now CEA (1) 640x480p @ 60 Hz with pixel clock 25 MHz (score 43432)
HDMI:EDID best score mode is now CEA (2) 720x480p @ 60 Hz with pixel clock 27 MHz (score 3545736)
HDMI:EDID CEA mode (3) 720x480p @ 60 Hz with pixel clock 27 MHz has a score of 45736
HDMI:EDID best score mode is now CEA (4) 1280x720p @ 60 Hz with pixel clock 74 MHz (score 4080296)
HDMI:EDID DMT mode (4) 640x480p @ 60 Hz with pixel clock 25 MHz has a score of 36864
HDMI:EDID CEA mode (5) 1920x1080i @ 60 Hz with pixel clock 74 MHz has a score of 87208
HDMI:EDID CEA mode (6) 1440x480i @ 60 Hz with pixel clock 27 MHz has a score of 35368
HDMI:EDID CEA mode (7) 1440x480i @ 60 Hz with pixel clock 27 MHz has a score of 35368
HDMI:EDID DMT mode (8) 800x600p @ 56 Hz with pixel clock 36 MHz has a score of 53760
HDMI:EDID DMT mode (9) 800x600p @ 60 Hz with pixel clock 40 MHz has a score of 57600
HDMI:EDID CEA mode (16) 1920x1080p @ 60 Hz with pixel clock 148 MHz has a score of 211624
HDMI:EDID DMT mode (16) 1024x768p @ 60 Hz with pixel clock 65 MHz has a score of 94370
HDMI:EDID CEA mode (17) 720x576p @ 50 Hz with pixel clock 27 MHz has a score of 2045736
HDMI:EDID CEA mode (18) 720x576p @ 50 Hz with pixel clock 27 MHz has a score of 45736
HDMI:EDID CEA mode (19) 1280x720p @ 50 Hz with pixel clock 74 MHz has a score of 2571080
HDMI:EDID CEA mode (20) 1920x1080i @ 50 Hz with pixel clock 74 MHz has a score of 3128680
HDMI:EDID CEA mode (21) 1440x576i @ 50 Hz with pixel clock 27 MHz has a score of 35368
HDMI:EDID CEA mode (22) 1440x576i @ 50 Hz with pixel clock 27 MHz has a score of 35368
HDMI:EDID best score mode is now DMT (23) 1280x768p @ 60 Hz with pixel clock 79 MHz (score 4617964)
HDMI:EDID best score mode is now DMT (27) 1280x800p @ 60 Hz with pixel clock 71 MHz (score 5184320)
HDMI:EDID CEA mode (31) 1920x1080p @ 50 Hz with pixel clock 148 MHz has a score of 128680
HDMI:EDID CEA mode (32) 1920x1080p @ 24 Hz with pixel clock 74 MHz has a score of 74766
HDMI:EDID DMT mode (85) 1280x720p @ 60 Hz with pixel clock 74 MHz has a score of 135592
HDMI0:EDID preferred mode remained as DMT (27) 1280x800p @ 60 Hz with pixel clock 71 MHz
HDMI:EDID has HDMI support and audio support
edidparser exited with code 0
To be hones, I dont know much of what is going on here or how to set the correct hdmi settings in config.txt according to above settings.
Maybe you can give me some help on how I could get a better resolution than 640x480 (used in hdmi_safe) or maybe the best resolution 1280x800?

Re: Where to find the source handling hdmi_safe in config.txt?

Posted: Sat Sep 21, 2019 11:59 am
by thinking
If I change the settings in /boot/config.txt to this
hdmi_group=2
hdmi_mode=1
hdmi_mode=87
hdmi_cvt 800 400 60 6 0 0 0
dtparam=spi=on
dtparam=i2c_arm=on

dtoverlay=ads7846,cs=1,penirq=25,penirq_pull=2,speed=50000,keep_vref_on=0,swapxy=0,pmax=255,xohms=150,xmin=200,xmax=3900,ymin=200,ymax=3900

#dtoverlay=w1-gpio-pullup,gpiopin=4,extpullup=1
the monitor boots in 1280x800, such that I see the boot messages from linux (and the resolution shown by the display)
but at some point ("Starting udev kernel device manager" or such) nearly at the end of the boot (shortly before one could login via command line) the display turns off and shows again "no display".

I got this behaviour very often during testing the settings. Also easier settings without dtoverlay have the same problem where I get the correct resolution but during the boot the display is turned off.

Edit: I just got the monitor turned on after the boot, by ssh into the box and then run "tvservice -p" to power on hdmi!

So, it seems the display is working correctly, but some settings turn the display off during the boot!?
I tried also "hdmi_force_hotplug=1" but this doesn't change anything. I assume some service is tuning off the display. But which one and how can I force hdmi after boot (without using /etc/rc.local)?

Re: Where to find the source handling hdmi_safe in config.txt?

Posted: Sat Sep 21, 2019 1:33 pm
by jamesh
If you disable the FKMS line in the config.txt, does that boot up the desktop OK?