Last edited 3 years ago

How to display on HDMI

Template:ArticleMainWriter Template:ReviewersList Template:ArticleApprovedVersion


1. Article purpose[edit source]

This article aims to specify what is displayed on an HDMI®[1] monitor (or TV) connected, through an HDMI cable, to a STMicroelectronics board, in different use cases explained below.

This article also explains how to get the video modes (resolutions and refresh frequencies) of the HDMI monitor (or TV) that are supported by the device, how to test them, and finally how to select one.

2. Prerequisites[edit source]

Obviously, it is mandatory that your STMicroelectronics board has an HDMI connector, which is the case for: Template:UpdateNeededForNewBoard

File:STM32MP157X-DKX HDMI.png
HDMI cable connected on Discovery kit
Board name: STM32MP157X-DKX (note that the MB1407 daughterboard DSI display, for the STM32MP157X-DK2 Discovery kit, is not shown here)

An HDMI cable and an HDMI monitor (or TV) are also needed.

3. Use cases[edit source]

The table below shows the different use cases that involve both the DSI display and the HDMI monitor.

Original situation Action Final situation
DSI display HDMI monitor
HDMI unplugged
- Board Template:Highlight started
- DSI display connected
- HDMI monitor Template:Highlight connected
Start the board DSI U-Boot splash screen.png then briefly DSI user splash screen.png and finally DSI Wayland background.png HDMI black screen.png
HDMI cold-plug
- Board Template:Highlight started
- DSI display connected
- HDMI monitor Template:Highlight
Start the board DSI U-Boot splash screen.png HDMI user splash screen.png then HDMI Wayland background.png
HDMI hot-plug
- Board Template:Highlight
- DSI display connected
- HDMI monitor Template:Highlight connected
Plug the HDMI monitor DSI Wayland background.png HDMI black screen.png
Restart Weston[2] DSI black screen.png HDMI Wayland background.png
HDMI hot-unplug
- Board Template:Highlight
- DSI display connected
- HDMI monitor Template:Highlight
Unplug the HDMI monitor DSI black screen.png HDMI black screen.png
Restart Weston[2] DSI Wayland background.png HDMI black screen.png


The following statements explain the use cases summarized above:

  • The U-Boot graphical console (U-Boot logs similar to the ones displayed on the host PC Terminal program) is never displayed on the HDMI monitor. This console is displayed on the DSI display (if any on the board)
  • If the board has both a DSI display and an HDMI monitor, the Wayland background layer is only displayed on one of these displays (see the "rules" below)
  • HDMI unplugged: if no HDMI monitor is connected to the board before the board starts, and if a DSI display is connected to the board, the Wayland background layer is displayed on the DSI display
  • HDMI cold-plug: if an HDMI monitor is connected to the board before the board starts, the Wayland background layer is displayed on this HDMI monitor
  • HDMI hot-plug: if an HDMI monitor is connected to the board after the board starts, this plug is not automatically detected by Wayland / Weston. To force the display on the HDMI monitor, restart Weston[2]
  • HDMI hot-unplug: similarly, if an HDMI monitor is disconnected from the board while the Wayland background layer is displayed on the HDMI monitor, this unplug is not automatically detected by Wayland / Weston. To force the display on the DSI display, restart Weston[2]

4. Video modes[edit source]

Generally, the HDMI monitor (or TV) provides several video modes (resolutions and refresh frequencies), that might not be all supported by the platform. In case of HDMI cold-plug or HDMI hot-plug, the first video mode provided by the HDMI monitor that is supported by the platform, is selected. To change this video mode selected per default, all the video modes both provided by the HDMI monitor and supported by the platform shall be retrieved, optionally tested, and finally set in the weston.ini configuration file[3].

Let us assume that the DSI display and the HDMI monitor are connected to the board, and that the Wayland background is displayed on the HDMI monitor.

  • Retrieve the video modes provided by the HDMI monitor and supported by the platform (see below how to get all the video modes supported by the HDMI monitor, whether they are supported or not by the platform)
Template:Board$ modetest -M stm
Encoders:
id      crtc    type    possible crtcs  possible clones
27      32      DPI     0x00000001      0x00000000
29      0       DSI     0x00000001      0x00000000

Connectors:
id      encoder status          name            size (mm)       modes   encoders
28      27      connected       HDMI-A-1        710x400         3       27
  modes:
        name refresh (Hz) hdisp hss hse htot vdisp vss vse vtot)
  800x600 75 800 816 896 1056 600 601 604 625 49500 flags: phsync, pvsync; type: driver
  720x576 50 720 732 796 864 576 581 586 625 27000 flags: nhsync, nvsync; type: driver
  720x480 60 720 736 798 858 480 489 495 525 27000 flags: nhsync, nvsync; type: driver
  props:
        1 EDID:
                flags: immutable blob
                blobs:

                value:
                        00ffffffffffff005262100101010101
                        ff170103804728780a0dc9a057479827
                        12484c2fcf0081800101010101010101
                        010101010101023a80d072382d40102c
                        4580c48e2100001e662150b051001b30
                        40703600c18e2100001e000000fc0054
                        4f53484942412d54560a2020000000fd
                        00174c0f510f000a202020202020019f
                        02032c70521f10202122130414051211
                        03021615070601260907071507506d03
                        0c002000382dc026262929008c0ad090
                        204031200c405500138e210000180e1f
                        008051001e3040803700978e2100001c
                        f12700a05100253050803700978e2100
                        001ca91a00a05000163030203700978e
                        2100001a000000000000000000000074
        2 DPMS:
                flags: enum
                enums: On=0 Standby=1 Suspend=2 Off=3
                value: 0
        5 link-status:
                flags: enum
                enums: Good=0 Bad=1
                value: 0
30      0       connected       DSI-1           52x86           1       29
  modes:
        name refresh (Hz) hdisp hss hse htot vdisp vss vse vtot)
  480x800 50 480 600 663 783 800 812 824 836 32729 flags: ; type: preferred, driver
  props:
        1 EDID:
                flags: immutable blob
                blobs:

                value:
        2 DPMS:
                flags: enum
                enums: On=0 Standby=1 Suspend=2 Off=3
                value: 3
        5 link-status:
                flags: enum
                enums: Good=0 Bad=1
                value: 0

CRTCs:
id      fb      pos     size
32      35      (0,0)   (800x600)
  800x600 75 800 816 896 1056 600 601 604 625 49500 flags: phsync, pvsync; type: driver
  props:

Planes:
id      crtc    fb      CRTC x,y        x,y     gamma size      possible crtcs
31      32      35      0,0             0,0     0               0x00000001
  formats: AR24 XR24 RG24 RG16 AR15 XR15 AR12 XR12 C8  
  props:
        6 type:
                flags: immutable enum
                enums: Overlay=0 Primary=1 Cursor=2
                value: 1
33      0       0       0,0             0,0     0               0x00000001
  formats: AR24 RG24 RG16 AR15 AR12 C8  
  props:
        6 type:
                flags: immutable enum
                enums: Overlay=0 Primary=1 Cursor=2
                value: 0

Frame buffers:
id      size    pitch


Connectors:
id      encoder status          name            size (mm)       modes   encoders
Template:Highlight      27      Template:Highlight       Template:Highlight        710x400         3       27
  modes:
        name refresh (Hz) hdisp hss hse htot vdisp vss vse vtot)
  Template:Highlight 800 816 896 1056 600 601 604 625 49500 flags: phsync, pvsync; type: driver
  Template:Highlight 720 732 796 864 576 581 586 625 27000 flags: nhsync, nvsync; type: driver
  Template:Highlight 720 736 798 858 480 489 495 525 27000 flags: nhsync, nvsync; type: driver
Connectors:
id      encoder status          name            size (mm)       modes   encoders
[...]
Template:Highlight2      0       Template:Highlight2       Template:Highlight2           52x86           1       29
  modes:
        name refresh (Hz) hdisp hss hse htot vdisp vss vse vtot)
  Template:Highlight2 480 600 663 783 800 812 824 836 32729 flags: ; type: preferred, driver


Connectors:
id      encoder status          name            size (mm)       modes   encoders
Template:Highlight      Template:Highlight      connected       HDMI-A-1        710x400         3       27

Encoders:
id      crtc    type    possible crtcs  possible clones
Template:Highlight      Template:Highlight      DPI     0x00000001      0x00000000

CRTCs:
id      fb      pos     size
Template:Highlight      35      (0,0)   (800x600)
  Template:Highlight 75 800 816 896 1056 600 601 604 625 49500 flags: phsync, pvsync; type: driver


  • Stop Weston, use the modetest command to test the different modes, and restart Weston

Syntax:

Template:Board$ modetest -M stm -s Template:Highlight:Template:Highlight@XR24 -v

Example with the 3 modes identified above:

Template:Board$ systemctl stop weston
Template:Board$ modetest -M stm -s Template:Highlight:Template:Highlight@XR24 -v
Template:Board$ modetest -M stm -s Template:Highlight:Template:Highlight@XR24 -v
Template:Board$ modetest -M stm -s Template:Highlight:Template:Highlight@XR24 -v
Template:Board$ systemctl start weston


  • Set the selected video mode in the /etc/xdg/weston/weston.ini configuration file, and restart Weston

Syntax:

[output]
name=HDMI-A-1
mode=Template:Highlight

Example (720x480 resolution selected):

mode=Template:Highlight
Template:Board$ systemctl restart weston


Template:Board$ modetest -M stm
Encoders:
id      crtc    type    possible crtcs  possible clones
Template:Highlight      Template:Highlight      DPI     0x00000001      0x00000000

Connectors:
id      encoder status          name            size (mm)       modes   encoders
Template:Highlight      Template:Highlight      connected       HDMI-A-1        710x400         3       27

CRTCs:
id      fb      pos     size
Template:Highlight      38      (0,0)   (720x480)
  Template:Highlight 60 720 736 798 858 480 489 495 525 27000 flags: nhsync, nvsync; type: driver

5. FAQ[edit source]

5.1. How to get all the video modes supported by the HDMI monitor[edit source]

This chapter gives a method to retrieve all the video modes supported by the HDMI monitor, whether they are supported or not by the platform.

  • Retrieve all the video modes supported by the HDMI monitor
Template:Board$ dmesg -c
Template:Board$ echo 4 > /sys/module/drm/parameters/debug
Template:Board$ dmesg
[20292.095467] [drm:drm_helper_probe_single_connector_modes] [CONNECTOR:28:HDMI-A-1]
[20292.227634] [drm:drm_add_edid_modes.part.15] HDMI: DVI dual 0, max TMDS clock 225000 kHz
[20292.230310] [drm:drm_mode_debug_printmodeline] Modeline 36:"1920x1080" 50 148500 1920 2448 2492 2640 1080 1084 1089 1125
[20292.230329] [drm:drm_mode_prune_invalid] Not using 1920x1080 mode: CLOCK_HIGH
[20292.230353] [drm:drm_mode_debug_printmodeline] Modeline 40:"1360x768" 60 85500 1360 1424 1536 1792 768 771 777 795 0x405
[20292.230365] [drm:drm_mode_prune_invalid] Not using 1360x768 mode: CLOCK_HIGH
[20292.230387] [drm:drm_mode_debug_printmodeline] Modeline 43:"1280x768" 60 79500 1280 1344 1472 1664 768 771 778 798 0x406
[20292.230399] [drm:drm_mode_prune_invalid] Not using 1280x768 mode: CLOCK_HIGH
[20292.230421] [drm:drm_mode_debug_printmodeline] Modeline 44:"1280x768" 75 102250 1280 1360 1488 1696 768 771 778 805 0x46
[20292.230433] [drm:drm_mode_prune_invalid] Not using 1280x768 mode: CLOCK_HIGH
[20292.230454] [drm:drm_mode_debug_printmodeline] Modeline 45:"1280x768" 60 68250 1280 1328 1360 1440 768 771 778 790 0x409
[20292.230467] [drm:drm_mode_prune_invalid] Not using 1280x768 mode: CLOCK_HIGH
[20292.230488] [drm:drm_mode_debug_printmodeline] Modeline 46:"1280x1024" 0 108000 1280 1328 1440 1688 1024 1025 1028 10665
[20292.230500] [drm:drm_mode_prune_invalid] Not using 1280x1024 mode: CLOCK_HIGH
[20292.230521] [drm:drm_mode_debug_printmodeline] Modeline 47:"800x600" 0 40000 800 840 968 1056 600 601 605 628 0x40 0x5
[20292.230533] [drm:drm_mode_prune_invalid] Not using 800x600 mode: CLOCK_RANGE
[20292.230555] [drm:drm_mode_debug_printmodeline] Modeline 48:"800x600" 0 36000 800 824 896 1024 600 601 603 625 0x40 0x5
[20292.230567] [drm:drm_mode_prune_invalid] Not using 800x600 mode: CLOCK_RANGE
[20292.230588] [drm:drm_mode_debug_printmodeline] Modeline 49:"640x480" 0 31500 640 656 720 840 480 481 484 500 0x40 0xa
[20292.230600] [drm:drm_mode_prune_invalid] Not using 640x480 mode: CLOCK_RANGE
[20292.230621] [drm:drm_mode_debug_printmodeline] Modeline 50:"640x480" 0 31500 640 664 704 832 480 489 492 520 0x40 0xa
[20292.230633] [drm:drm_mode_prune_invalid] Not using 640x480 mode: CLOCK_RANGE
[20292.230654] [drm:drm_mode_debug_printmodeline] Modeline 51:"640x480" 0 25175 640 656 752 800 480 490 492 525 0x40 0xa
[20292.230667] [drm:drm_mode_prune_invalid] Not using 640x480 mode: CLOCK_RANGE
[20292.230688] [drm:drm_mode_debug_printmodeline] Modeline 52:"1280x1024" 0 135000 1280 1296 1440 1688 1024 1025 1028 10665
[20292.230700] [drm:drm_mode_prune_invalid] Not using 1280x1024 mode: CLOCK_HIGH
[20292.230722] [drm:drm_mode_debug_printmodeline] Modeline 53:"1024x768" 0 78750 1024 1040 1136 1312 768 769 772 800 0x40 5
[20292.230734] [drm:drm_mode_prune_invalid] Not using 1024x768 mode: CLOCK_HIGH
[20292.230756] [drm:drm_mode_debug_printmodeline] Modeline 54:"1024x768" 0 75000 1024 1048 1184 1328 768 771 777 806 0x40 a
[20292.230768] [drm:drm_mode_prune_invalid] Not using 1024x768 mode: CLOCK_HIGH
[20292.230790] [drm:drm_mode_debug_printmodeline] Modeline 56:"1024x768" 0 65000 1024 1048 1184 1344 768 771 777 806 0x40 a
[20292.230802] [drm:drm_mode_prune_invalid] Not using 1024x768 mode: CLOCK_RANGE
[20292.230824] [drm:drm_mode_debug_printmodeline] Modeline 58:"800x600" 0 50000 800 856 976 1040 600 637 643 666 0x40 0x5
[20292.230836] [drm:drm_mode_prune_invalid] Not using 800x600 mode: CLOCK_RANGE
[20292.230857] [drm:drm_mode_debug_printmodeline] Modeline 60:"1920x1080" 0 148500 1920 2008 2052 2200 1080 1084 1089 11255
[20292.230870] [drm:drm_mode_prune_invalid] Not using 1920x1080 mode: CLOCK_HIGH
[20292.230891] [drm:drm_mode_debug_printmodeline] Modeline 61:"1920x1080" 0 74250 1920 2558 2602 2750 1080 1084 1089 1125 5
[20292.230903] [drm:drm_mode_prune_invalid] Not using 1920x1080 mode: CLOCK_HIGH
[20292.230924] [drm:drm_mode_debug_printmodeline] Modeline 62:"1920x1080" 0 74250 1920 2448 2492 2640 1080 1084 1089 1125 5
[20292.230936] [drm:drm_mode_prune_invalid] Not using 1920x1080 mode: CLOCK_HIGH
[20292.230957] [drm:drm_mode_debug_printmodeline] Modeline 63:"1920x1080" 0 74250 1920 2008 2052 2200 1080 1084 1089 1125 5
[20292.230970] [drm:drm_mode_prune_invalid] Not using 1920x1080 mode: CLOCK_HIGH
[20292.230991] [drm:drm_mode_debug_printmodeline] Modeline 64:"1280x720" 0 74250 1280 1720 1760 1980 720 725 730 750 0x40 5
[20292.231003] [drm:drm_mode_prune_invalid] Not using 1280x720 mode: CLOCK_HIGH
[20292.231024] [drm:drm_mode_debug_printmodeline] Modeline 65:"1280x720" 0 74250 1280 1390 1430 1650 720 725 730 750 0x40 5
[20292.231037] [drm:drm_mode_prune_invalid] Not using 1280x720 mode: CLOCK_HIGH
[20292.231058] [drm:drm_mode_debug_printmodeline] Modeline 66:"1920x1080i" 0 74250 1920 2448 2492 2640 1080 1084 1094 11255
[20292.231071] [drm:drm_mode_prune_invalid] Not using 1920x1080i mode: NO_INTERLACE
[20292.231092] [drm:drm_mode_debug_printmodeline] Modeline 67:"1920x1080i" 0 74250 1920 2008 2052 2200 1080 1084 1094 11255
[20292.231104] [drm:drm_mode_prune_invalid] Not using 1920x1080i mode: NO_INTERLACE
[20292.231125] [drm:drm_mode_debug_printmodeline] Modeline 73:"720x576i" 0 13500 720 732 795 864 576 580 586 625 0x40 0x10a
[20292.231137] [drm:drm_mode_prune_invalid] Not using 720x576i mode: NO_INTERLACE
[20292.231159] [drm:drm_mode_debug_printmodeline] Modeline 75:"720x480i" 0 13500 720 739 801 858 480 488 494 525 0x40 0x10a
[20292.231171] [drm:drm_mode_prune_invalid] Not using 720x480i mode: NO_INTERLACE
[20292.231192] [drm:drm_mode_debug_printmodeline] Modeline 78:"640x480" 60 25200 640 656 752 800 480 490 492 525 0x40 0xa
[20292.231204] [drm:drm_mode_prune_invalid] Not using 640x480 mode: CLOCK_RANGE
[20292.231226] [drm:drm_mode_debug_printmodeline] Modeline 79:"1920x1080" 60 148352 1920 2008 2052 2200 1080 1084 1089 1125
[20292.231238] [drm:drm_mode_prune_invalid] Not using 1920x1080 mode: CLOCK_HIGH
[20292.231259] [drm:drm_mode_debug_printmodeline] Modeline 80:"1920x1080" 24 74176 1920 2558 2602 2750 1080 1084 1089 11255
[20292.231271] [drm:drm_mode_prune_invalid] Not using 1920x1080 mode: CLOCK_HIGH
[20292.231292] [drm:drm_mode_debug_printmodeline] Modeline 81:"1920x1080" 30 74176 1920 2008 2052 2200 1080 1084 1089 11255
[20292.231304] [drm:drm_mode_prune_invalid] Not using 1920x1080 mode: CLOCK_HIGH
[20292.231325] [drm:drm_mode_debug_printmodeline] Modeline 82:"1280x720" 60 74176 1280 1390 1430 1650 720 725 730 750 0x405
[20292.231337] [drm:drm_mode_prune_invalid] Not using 1280x720 mode: CLOCK_HIGH
[20292.231358] [drm:drm_mode_debug_printmodeline] Modeline 83:"1920x1080i" 60 74176 1920 2008 2052 2200 1080 1084 1094 1125
[20292.231370] [drm:drm_mode_prune_invalid] Not using 1920x1080i mode: NO_INTERLACE
[20292.231390] [drm:drm_mode_debug_printmodeline] Modeline 84:"720x480" 60 27027 720 736 798 858 480 489 495 525 0x40 0xa
[20292.231402] [drm:drm_mode_prune_invalid] Not using 720x480 mode: CLOCK_RANGE
[20292.231423] [drm:drm_mode_debug_printmodeline] Modeline 86:"720x480i" 60 13514 720 739 801 858 480 488 494 525 0x40 0x1a
[20292.231436] [drm:drm_mode_prune_invalid] Not using 720x480i mode: NO_INTERLACE
[20292.231460] [drm:drm_helper_probe_single_connector_modes] [CONNECTOR:28:HDMI-A-1] probed modes :
[20292.231482] [drm:drm_mode_debug_printmodeline] Modeline 55:"800x600" 75 49500 800 816 896 1056 600 601 604 625 0x40 0x5
[20292.231501] [drm:drm_mode_debug_printmodeline] Modeline 41:"720x576" 50 27000 720 732 796 864 576 581 586 625 0x40 0xa
[20292.231521] [drm:drm_mode_debug_printmodeline] Modeline 68:"720x480" 60 27000 720 736 798 858 480 489 495 525 0x40 0xa
[20292.231614] [drm:drm_helper_probe_single_connector_modes] [CONNECTOR:30:DSI-1]
[20292.231699] [drm:drm_helper_probe_single_connector_modes] [CONNECTOR:30:DSI-1] probed modes :
[20292.231722] [drm:drm_mode_debug_printmodeline] Modeline 34:"480x800" 50 32729 480 600 663 783 800 812 824 836 0x48 0x0


[20292.095467] [drm:drm_helper_probe_single_connector_modes] [CONNECTOR:Template:Highlight:Template:Highlight]
[20292.227634] [drm:drm_add_edid_modes.part.15] HDMI: DVI dual 0, max TMDS clock 225000 kHz
[20292.230310] [drm:drm_mode_debug_printmodeline] Modeline 36:"1920x1080" 50 148500 1920 2448 2492 2640 1080 1084 1089 1125
[20292.230329] [drm:drm_mode_prune_invalid] Not using 1920x1080 mode: Template:Highlight
[...]
[20292.230521] [drm:drm_mode_debug_printmodeline] Modeline 47:"800x600" 0 40000 800 840 968 1056 600 601 605 628 0x40 0x5
[20292.230533] [drm:drm_mode_prune_invalid] Not using 800x600 mode: Template:Highlight
[...]
[20292.231058] [drm:drm_mode_debug_printmodeline] Modeline 66:"1920x1080i" 0 74250 1920 2448 2492 2640 1080 1084 1094 11255
[20292.231071] [drm:drm_mode_prune_invalid] Not using 1920x1080i mode: Template:Highlight
[20292.231460] [drm:drm_helper_probe_single_connector_modes] [CONNECTOR:Template:Highlight:Template:Highlight] probed modes :
[20292.231482] [drm:drm_mode_debug_printmodeline] Modeline 55:Template:Highlight 49500 800 816 896 1056 600 601 604 625 0x40 0x5
[20292.231501] [drm:drm_mode_debug_printmodeline] Modeline 41:Template:Highlight 27000 720 732 796 864 576 581 586 625 0x40 0xa
[20292.231521] [drm:drm_mode_debug_printmodeline] Modeline 68:Template:Highlight 27000 720 736 798 858 480 489 495 525 0x40 0xa
[20292.231699] [drm:drm_helper_probe_single_connector_modes] [CONNECTOR:Template:Highlight2:Template:Highlight2] probed modes :
[20292.231722] [drm:drm_mode_debug_printmodeline] Modeline 34:Template:Highlight2 32729 480 600 663 783 800 812 824 836 0x48 0x0

6. References[edit source]