Display

AIoT Yocto supports display hardware functionalities by providing drivers integrating into the Linux Direct Render Manager(DRM) framework and kernel mode setting (KMS).

Weston, a Wayland compositor, is packaged into rity-demo-image to provide a minimal desktop environment for demonstration purposes. This also provides a demonstration environment for the GStreamer video framework through the wayland-sink plugin.

The following diagram shows the packages related to display in AIoT Yocto:

Display related software components in |AIOT-YOCTO|

Display related software components in AIoT Yocto

The following sections shows how to evaluate and examine the display functionalities through console tools and commands.

For board-specific instructions on setting up the display hardware and device trees, please refer to:

Weston

The Weston compositor is initialized during startup by default to provide a demonstration on the display capabilities. It also provides a basic XDG shell and a set of examples and demonstration programs. This integration is entirely for demonstration and evaluation purposes as it does not provide a full-function desktop environment for applications. Therefore developers may need to extend it, or even adopt a different framework.

Weston Examples

You can find various weston example programs and utilities under /usr/bin/weston-* in AIoT Yocto. For example weston-info provides information on configurations and versions.

Stopping and Restarting Weston

As a system compositor, Weston occupies the display hardware interfaces upon startup.

If you need to control the DRM device nodes directly, for example using the modetest utility, then you will have to stop Weston service first. Otherwise you might see an error like failed to set mode: Permission denied.

The commands to stop Weston is different between different versions of Yocto:

  • AIoT Yocto Kirkstone:
    systemctl stop weston
    
  • AIoT Yocto Dunfell
    killall weston
    
  • AIoT Yocto v21.3 and before
    systemctl stop weston@root.service
    

To restart weston, use these commands:

  • AIoT Yocto Kirkstone:
    systemctl start weston
    
  • AIoT Yocto Dunfell
    weston-start
    
  • AIoT Yocto v21.3 and before
    systemctl start weston@root.service
    

Configure Weston Default Resolution

If you want to enforce or change the default resolution used by Weston compositor, follow these steps:

  1. Locate the following configuration file:

    /etc/xdg/weston/weston.ini

  2. Find the following section in the configuration file. If it does not exist, create a new section:

    [output]
    name=HDMI-A-1
    mode=720x576
    
    • The name should be identical to the name reported by modetest, such as HDMI-A-1.

    • The mode string could be:

      • <WIDTH>x<HEIGHT> in pixels, for example mode=1280x720.

      • preferred uses the preferred mode reported by the monitor.

DRM

The DRM driver exposes several sysfs device nodes for display device inspection and control. You can also use utilities such as modetest and modeprint to inspect and test the DRM device.

List Display Interfaces

To enumerate detected display interfaces, use the following command:

ls /sys/class/drm/

Each interface is identified a card object, such as:

card1-HDMI-A-1

Note

Depending on the device tree configuration, the HDMI interface can be card0 instead of card1. These connector nodes are available even if there are no external monitor devices connected.

Port Status

To check if a HDMI monitor is properly detected, use:

cat /sys/class/drm/card<id>/card<id>-<port>/status

If the external monitor is properly detected, the result would be connected; If it is unplugged or undetected, the status string becomes disconnected.

List Enumerated Display Resolutions

You can use modetest utility to check the detected resolutions and available connectors.

To do so, stop weston service first, and use:

modetest -M mediatek -c

To dump all the connector information and also detected resolutions, if any.

root@i1200-demo:~# modetest -M mediatek -c
Connectors:
id      encoder status          name            size (mm)       modes   encoders
32      31      connected       DP-1            520x290         22      31
modes:
        index name refresh (Hz) hdisp hss hse htot vdisp vss vse vtot
#0 1920x1080 60.00 1920 2008 2052 2200 1080 1084 1089 1125 148500 flags: phsync, pvsync; type: preferred, driver
#1 1920x1080 59.94 1920 2008 2052 2200 1080 1084 1089 1125 148352 flags: phsync, pvsync; type: driver
#2 1920x1080 50.00 1920 2448 2492 2640 1080 1084 1089 1125 148500 flags: phsync, pvsync; type: driver
#3 1600x1200 60.00 1600 1664 1856 2160 1200 1201 1204 1250 162000 flags: phsync, pvsync; type: driver
#4 1680x1050 59.88 1680 1728 1760 1840 1050 1053 1059 1080 119000 flags: phsync, nvsync; type: driver
#5 1400x1050 59.95 1400 1448 1480 1560 1050 1053 1057 1080 101000 flags: phsync, nvsync; type: driver
#6 1600x900 60.00 1600 1624 1704 1800 900 901 904 1000 108000 flags: phsync, pvsync; type: driver
#7 1280x1024 60.02 1280 1328 1440 1688 1024 1025 1028 1066 108000 flags: phsync, pvsync; type: driver
#8 1440x900 59.90 1440 1488 1520 1600 900 903 909 926 88750 flags: phsync, nvsync; type: driver
#9 1280x960 60.00 1280 1376 1488 1800 960 961 964 1000 108000 flags: phsync, pvsync; type: driver
#10 1280x800 59.91 1280 1328 1360 1440 800 803 809 823 71000 flags: phsync, nvsync; type: driver
#11 1280x720 60.00 1280 1390 1430 1650 720 725 730 750 74250 flags: phsync, pvsync; type: driver
#12 1280x720 59.94 1280 1390 1430 1650 720 725 730 750 74176 flags: phsync, pvsync; type: driver
#13 1280x720 50.00 1280 1720 1760 1980 720 725 730 750 74250 flags: phsync, pvsync; type: driver
#14 1024x768 60.00 1024 1048 1184 1344 768 771 777 806 65000 flags: nhsync, nvsync; type: driver
#15 800x600 60.32 800 840 968 1056 600 601 605 628 40000 flags: phsync, pvsync; type: driver
#16 800x600 56.25 800 824 896 1024 600 601 603 625 36000 flags: phsync, pvsync; type: driver
#17 720x576 50.00 720 732 796 864 576 581 586 625 27000 flags: nhsync, nvsync; type: driver
#18 720x480 60.00 720 736 798 858 480 489 495 525 27027 flags: nhsync, nvsync; type: driver
#19 720x480 59.94 720 736 798 858 480 489 495 525 27000 flags: nhsync, nvsync; type: driver
#20 640x480 60.00 640 656 752 800 480 490 492 525 25200 flags: nhsync, nvsync; type: driver
#21 640x480 59.94 640 656 752 800 480 490 492 525 25175 flags: nhsync, nvsync; type: driver
props:
        1 EDID:
                flags: immutable blob
                blobs:

                value:
                        00ffffffffffff005a632f4f01010101
                        0018010380341d782e0d15a5574aa226
                        0f5054bfef80b300a940a9c095009040
                        818081408100023a801871382d40582c
                        450009252100001e000000ff00545a31
                        3133303130303030310a000000fd0032
                        4b0f5211000a202020202020000000fc
                        0056583234353620534552494553019b
                        020322f14d900504030207061f141312
                        110123097f078301000067030c001000
                        102d023a801871382d40582c45000925
                        2100001e011d8018711c1620582c2500
                        09252100009e011d007251d01e206e28
                        550009252100001e8c0ad08a20e02d10
                        103e9600092521000018023a80d07238
                        2d40102c458009252100001e0000008e
        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
        6 non-desktop:
                flags: immutable range
                values: 0 1
                value: 0
        4 TILE:
                flags: immutable blob
                blobs:

                value:

You can also use the modeprint utility:

modeprint mediatek

It should list all the available display interfaces:

root@i1200-demo:~# modeprint mediatek
Starting test
Resources

count_connectors : 1
count_encoders   : 1
count_crtcs      : 2
count_fbs        : 0

Connector: DP-1
        id             : 32
        encoder id     : 31
        conn           : connected
        size           : 520x290 (mm)
        count_modes    : 22
        count_props    : 5
        props          : 1 2 5 6 4
        count_encoders : 1
        encoders       : 31
Mode: "1920x1080" 1920x1080 60
Mode: "1920x1080" 1920x1080 60
Mode: "1920x1080" 1920x1080 50
Mode: "1600x1200" 1600x1200 60
Mode: "1680x1050" 1680x1050 60
Mode: "1400x1050" 1400x1050 60
Mode: "1600x900" 1600x900 60
Mode: "1280x1024" 1280x1024 60
Mode: "1440x900" 1440x900 60
Mode: "1280x960" 1280x960 60
Mode: "1280x800" 1280x800 60
Mode: "1280x720" 1280x720 60
Mode: "1280x720" 1280x720 60
Mode: "1280x720" 1280x720 50
Mode: "1024x768" 1024x768 60
Mode: "800x600" 800x600 60
Mode: "800x600" 800x600 56
Mode: "720x576" 720x576 50
Mode: "720x480" 720x480 60
Mode: "720x480" 720x480 60
Mode: "640x480" 640x480 60
Mode: "640x480" 640x480 60

Encoder: TMDS
        id     :31
        crtc_id   :46
        type   :2
        possible_crtcs  :0x2
        possible_clones :0x1

Crtc
        id             : 41
        x              : 0
        y              : 0
        width          : 0
        height         : 0
        mode           : 0xaaaada680bfc
        gamma size     : 512
Crtc
        id             : 46
        x              : 0
        y              : 0
        width          : 1920
        height         : 1080
        mode           : 0xaaaada680c6c
        gamma size     : 0

Ok

Run Test Patterns with modetest

To test if a certain resolution works correctly, you can generate test patterns with modetest.

To do so, stop weston service first, and use:

modetest -M mediatek -s <connector-id>:<mode-id>

This would generate a test pattern on <connector-id>.

You can retrieve the <connector-id> and mode-id using the modetest -c command, for example:

Connectors:
    id      encoder status          name            size (mm)       modes   encoders
    32      31      connected       DP-1            520x290         22      31
    modes:
            index name refresh (Hz) hdisp hss hse htot vdisp vss vse vtot
    #0 1920x1080 60.00 1920 2008 2052 2200 1080 1084 1089 1125 148500 flags: phsync, pvsync; type: preferred, driver
    #1 1920x1080 59.94 1920 2008 2052 2200 1080 1084 1089 1125 148352 flags: phsync, pvsync; type: driver
    #2 1920x1080 50.00 1920 2448 2492 2640 1080 1084 1089 1125 148500 flags: phsync, pvsync; type: driver

In the example above, the <connector-id> for the DP-1 (DisplayPort) connector is 32. Assigning mode-id to 0 effectively selects the 1920x1080@60 resolution and timing mode.

For details, please refer to the help string with modetest -h.

Limitations

No X11 Support

AIoT Yocto does not provide support for X11 framework.

No HDCP Support

AIoT Yocto does not provide support for HDCP(High-bandwidth Digital Content Protection) functionalities on the HDMI and DisplayPort interfaces, and does not provide secure-world display drivers in the OP-TEE environment.