If you have information of your monitor's modeline information, hdmi driver builds up the hdmi-related parameters based on the parameter described in boot.ini.
The required items are as following.
1. Resolutions and Clock - horizontal pixels / vertical pixels - pixel clock - horizontal frequency / vertical frequency 2. HTimings - hdisp / hsyncstart / hsyncend / htotal 3. VTimings - vdisp / vsyncstart / vsyncend / vtotal 4. Sync Polarity and Scanning Method - hsync_polarity / vsync_polarity - progress_mode or interlaced mode
Let's talk about the detailed descriptions and examples of modeline information here.
* Resolutions and Clock
name | description | example : 1080p60hz | example : 1792x1344p60hz |
hor_pixels | display width | 1920 | 1792 |
ver_pixels | display height | 1080 | 1344 |
pixel_clock | pixel clock | 148.50 MHz | 204.8 MHz |
hor_freq | horizontal frequency | 67.5 kHz | 83.66 kHz |
ver_freq | vertical frequency | 60 Hz | 60 Hz |
* HTimings
name | example : 1080p60hz | example : 1792x1344p60hz |
hdisp | 1920 | 1792 |
hsyncstart | 2008 | 1920 |
hsyncend | 2052 | 2120 |
htotal | 2200 | 2448 |
* VTimings
name | example : 1080p60hz | example : 1792x1344p60hz |
vdisp | 1080 | 1344 |
vsyncstart | 1084 | 1345 |
vsyncend | 1089 | 1348 |
vtotal | 1125 | 1394 |
* Sync Polarity and Scanning Method
name | descriptioin | example : 1080p60hz | example : 1792x1344p60hz |
hsync_polarity | +HSync or -HSync | +HSync, '1' | -HSync, '0' |
vsync_polarity | +VSync or -VSync | -VSync, '0' | +VSync, '1' |
progress_mode | 'P' or 'I' | progress mode, '1' | progress mode, '1' |
The formats of modeline can be as following.
1. Modeline Syntax (1)
Modeline "width x height" pclk hdisp hsyncstart hsyncend htotal vdisp vsyncstart vsyncend vtotal [flags]
For example, in case of 1920x1080p60Hz,
1920 1080 60 Hz 67.5 kHz ModeLine "1920x1080" 148.50 1920 2008 2052 2200 1080 1084 1088 1125 -HSync -VSync
2. Modeline Syntax (2)
[width x height] [pixel clock in MHz] [hsync_polarity] [vsync_polarity] h: width [width] start [hsyncstart] end [hsyncend] total [htotal] skew 0 clock [hor_freq in KHz] v: height [height] start [vsyncstart] end [vsyncend] total [vtotal] clock [ver_freq in Hz]
* Example - 1920x1080p60Hz case
1920x1080 148.5MHz +HSync +VSync h: width 1920 start 2008 end 2052 total 2200 skew 0 clock 67.5KHz v: height 1080 start 1084 end 1089 total 1125 clock 60.0Hz
* Example - 1792x1344p60Hz case
1792x1344 204.80MHz -HSync +VSync h: width 1792 start 1920 end 2120 total 2448 skew 0 clock 83.66KHz v: height 1344 start 1345 end 1348 total 1394 clock 60.0Hz
If you have a linux pc, you can get the modeline information using the command, 'xrandr'.
$ xrandr Screen 0: minimum 320 x 200, current 5120 x 1600, maximum 16384 x 16384 DFP1 disconnected (normal left inverted right x axis y axis) ..... DFP6 connected primary 2560x1440+2560+160 (normal left inverted right x axis y axis) 596mm x 335mm 2560x1440 60.0*+ 1856x1392 60.0 1792x1344 60.0 1920x1200 60.0 ..... 640x480 66.6 59.9 DFP7 connected 2560x1600+0+0 (normal left inverted right x axis y axis) 641mm x 401mm 2560x1600 60.0*+ 2048x1536 60.0 ..... 640x480 59.9 CRT1 disconnected (normal left inverted right x axis y axis)
$ xrandr --verbose Screen 0: minimum 320 x 200, current 5120 x 1600, maximum 16384 x 16384 DFP1 disconnected (normal left inverted right x axis y axis) Identifier: 0x75 Timestamp: 24992 Subpixel: unknown Clones: CRTCs: 0 1 2 3 4 5 Transform: 1.000000 0.000000 0.000000 0.000000 1.000000 0.000000 0.000000 0.000000 1.000000 filter: SignalFormat: DisplayPort ConnectorType: DisplayPort ..... ..... 2560x1440 (0x7d) 241.5MHz +HSync +VSync *current +preferred h: width 2560 start 2608 end 2640 total 2720 skew 0 clock 88.8KHz v: height 1440 start 1442 end 1447 total 1481 clock 60.0Hz 1800x1440 (0x7e) 241.5MHz +HSync +VSync h: width 1800 start 2608 end 2640 total 2720 skew 0 clock 88.8KHz v: height 1440 start 1442 end 1447 total 1481 clock 60.0Hz 1856x1392 (0x7f) 241.5MHz +HSync +VSync h: width 1856 start 2608 end 2640 total 2720 skew 0 clock 88.8KHz v: height 1392 start 1442 end 1447 total 1481 clock 60.0Hz 1792x1344 (0x80) 241.5MHz +HSync +VSync h: width 1792 start 2608 end 2640 total 2720 skew 0 clock 88.8KHz v: height 1344 start 1442 end 1447 total 1481 clock 60.0Hz ..... 640x480 (0x97) 25.2MHz -HSync -VSync h: width 640 start 656 end 752 total 800 skew 0 clock 31.5KHz v: height 480 start 490 end 492 total 525 clock 59.9Hz .....
TODO
# setenv hdmimode "1080p60hz" setenv hdmimode "custombuilt"
The basic form of related env parameter in boot.ini is as following.
setenv modeline horpixels,verpixels,pixel_clock,hor_freq,ver_freq,hdisp,hsyncstart,hsyncend,htotal,vdisp,vsyncstart,vsyncend,vtotal,hsync_polarity,vsync_polarity,progress_mode
For Android, “customwidth” and “customheight” parameters are needed.
setenv customwidth horpixels setenv customheight verpixels
Please be sure of units for pixel_clock, hor_freq and ver_freq.
For example, let's suppose we're building 1920x1080p60Hz mode.
setenv modeline "1920,1080,148500,67500,60,1920,2008,2052,2200,1080,1084,1088,1125,0,1,1" # Only for Android setenv customwidth "1920" setenv customheight "1080"
For another example of 1792x1344p60Hz mode, the env configuration should be as following.
setenv modeline "1792,1344,204800,83660,60,1792,1920,2120,2448,1344,1345,1348,1394,0,1,1" # Only for Android setenv customwidth "1792" setenv customheight "1344"
For Android, here is a example in case of 1792x1344p60Hz.
ODROIDC2-UBOOT-CONFIG setenv dtbaddr 0x1000000 setenv loadaddr 0x20000000 # Resolution Configuration # 'hdmimode' must be one of below to configure display resolution within # supported by your TV or monitor. # Symbol | Resolution # ----------------------+------------- # "480p60hz" | 720x480 Progressive 60Hz # ..... # "3440x1440p60hz" | 3440x1440 Progressive 60Hz setenv hdmimode "custombuilt" # modeline for 1792x1344p60Hz setenv modeline "1792,1344,204800,83660,60,1792,1920,2120,2448,1344,1345,1348,1394,0,1,1" setenv customwidth "1792" setenv customheight "1344" setenv rootopt "root=/dev/mmcblk0p2 rw init=/init rootwait" setenv consoleopt "console=ttyS0,115200" setenv androidopt "androidboot.hardware=odroidc2 androidboot.serialno=${fbt_id#}" setenv logoopt "osd1,loaded,${fb_addr},${hdmimode}" setenv selinuxopt "androidboot.selinux=disabled" # HDMI/DVI Mode Configuration # This will enforce the signal type of display # "hdmi" - For HDMI interface # "dvi" - For DVI interface setenv vout_mode "hdmi" # HPD enable/disable option setenv disablehpd "false" # Overscan offset configuration # All offsets are zero and can be tuned by manual or ODROID Utility setenv overscan_top "0" setenv overscan_left "0" setenv overscan_bottom "0" setenv overscan_right "0" suspend_hdmiphy=0 led_blink=1 setenv bootargs "${rootopt} ${consoleopt} modeline=${modeline} hdmimode=${hdmimode} hdmitx=${cecconfig} vout=${vout_mode} disablehpd=${disablehpd} logo=${logoopt} ${androidopt} ${selinuxopt} suspend_hdmiphy=${suspend_hdmiphy} led_blink=${led_blink}" save showlogo ${hdmimode} #usb pwren movi read dtb 0 ${dtbaddr} movi read boot 0 ${loadaddr} booti ${loadaddr} - ${dtbaddr}