Display
IoT 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 IoT 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 IoT 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:
- IoT Yocto Kirkstone:
systemctl stop weston
- IoT Yocto Dunfell
killall weston
- IoT Yocto v21.3 and before
systemctl stop weston@root.service
To restart weston, use these commands:
- IoT Yocto Kirkstone:
systemctl start weston
- IoT Yocto Dunfell
weston-start
- IoT 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:
Locate the following configuration file:
/etc/xdg/weston/weston.ini
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 bymodetest
, such asHDMI-A-1
.The
mode
string could be:<WIDTH>x<HEIGHT>
in pixels, for examplemode=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@genio-1200-evk:~# 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@genio-1200-evk:~# 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
.
DSI Boot Logo
Starting from the v23.1 release, the DSI panel of both Genio 700-EVK and Genio 1200-EVK now support boot logo. The boot logo will be displayed during the u-boot stage and will disappear at the end of u-boot. It’s worth noting that the DSI boot logo will be always displayed regardless of the selected display dtbo.
Download the u-boot source code with devtool modify u-boot
command to customize the boot logo.
Once you have finished customizing, you need to rebuild and reflash the image to test if the customization has been successful.
Replace Logo Bitmap File
Currently, only one 24-bit bitmap image is supported to be displayed as a boot logo. The Mediatek Genio logo.bmp file is located at aiot-yocto/src/meta-rity/meta/recipes-core/board-assets/files. You can replace the logo.bmp with a file of the same name.
Set Logo Coordinates
You can set the (x,y) coordinates in the following file to determine the location of the logo on the DSI panel.
u-boot/include/configs/mt8188.h (Genio 700-EVK)
u-boot/include/configs/mt8195.h (Genio 1200-EVK)
"splashpos=m,m\0" \
(m,m) indicates that the logo is centered on the DSI panel. To specify, use numbered (x,y) coordinates instead of (m,m).
Set Background Color
When the logo’s resolution is smaller than the panel’s resolution, the remaining space is filled with a background color. You can configure the background color in the following u-boot config file. Only white and black colors are available.
u-boot/configs/genio_700_evk_defconfig (Genio 700-EVK)
u-boot/configs/genio_1200_evk_defconfig (Genio 1200-EVK)
By default, CONFIG_SYS_WHITE_ON_BLACK is not set to use a white background. To use a black background, set CONFIG_SYS_WHITE_ON_BLACK = y.
Customize DSI Panel Driver
The DSI panel driver is at u-boot/
u-boot/board/mt8188/mt8390_evk_panel.c (Genio 700-EVK)
u-boot/board/mt8195/mt8195_evk_panel.c (Genio 1200-EVK)
You can port panel_serializable_data, power on and power off sequence, and backlight_enable according to your DSI panel specification. Take mt8195_evk_panel.c as an example.
panel_serializable_data
Fill in panel parameters in the .vm section and the init command in the .init_cmd section.
struct panel_serializable_data STARTEK_KD070FHFID078 = {
.vm = {
.pixelclock = 157126,/* pixelclock in KHz */
.pll_clk = 502,
.hactive = 1200,
.hfront_porch = 50,
.hback_porch = 70,
.hsync_len = 10,
.vactive = 1920,
.vfront_porch = 25,
.vback_porch = 20,
.vsync_len = 4,
.vrefresh = 60,
},
.init_cmd = {
INIT_GENERIC_CMD(0xB0, 0x05),
INIT_GENERIC_CMD(0xB3, 0x52),
INIT_GENERIC_CMD(0xB8, 0x7F),
...
}
}
power on and power off sequence
Fill in power on and power off sequence into the the relative functions.
static void startek_kd070fhfid078_power_on(void)
{
...
if (dm_gpio_is_valid(&panel_desc->reset_gpio) &&
dm_gpio_is_valid(&panel_desc->dcdc_en_gpio) &&
dm_gpio_is_valid(&panel_desc->enable_gpio)) {
...
dm_gpio_set_value(&panel_desc->enable_gpio, 1);
mdelay(10);
dm_gpio_set_value(&panel_desc->dcdc_en_gpio, 1);
mdelay(20);
dm_gpio_set_value(&panel_desc->reset_gpio, 1);
mdelay(5);
...
}
}
static void startek_kd070fhfid078_power_off(void)
{
...
if (dm_gpio_is_valid(&panel_desc->enable_gpio))
dm_gpio_set_value(&panel_desc->enable_gpio, 0);
if (dm_gpio_is_valid(&panel_desc->reset_gpio)) {
dm_gpio_set_value(&panel_desc->reset_gpio, 0);
mdelay(15);
}
if (dm_gpio_is_valid(&panel_desc->dcdc_en_gpio)) {
dm_gpio_set_value(&panel_desc->dcdc_en_gpio, 0);
mdelay(3);
}
backlight_enable
If you need backlight for your DSI panel provided by platform PWM, assign the backlight_enable function to the .backlight_enable function pointer in the panel_description structure.
struct panel_description startek_kd070fhfid078_desc = {
.name = "startek_kd070fhfid078",
.compatible = "startek,kd070fhfid078",
.s = &STARTEK_KD070FHFID078,
.power_on = startek_kd070fhfid078_power_on,
.power_off = startek_kd070fhfid078_power_off,
.backlight_enable = enable_backlight,
};
Disable DSI Boot Logo
It is possible to disable the DSI boot logo by disabling the dsi0 node in the dts file. You can also modify the GPIO numbers int the dsi0 node to match your layout.
u-boot/arch/arm/dts/genio-700-evk.dts (Genio 700-EVK)
u-boot/arch/arm/dts/genio-1200-evk.dts (Genio 1200-EVK)
dsi0: dsi0{
compatible = "mediatek,mt8195-dsi";
reg = <0 0x60000000 0 0x02000000>;
pinctrl-names = "default";
pinctrl-0 = <&panel_pins_default>;
reset-gpios = <&gpio 108 GPIO_ACTIVE_HIGH>;
dcdc-gpios = <&gpio 48 GPIO_ACTIVE_HIGH>;
enable-gpios = <&gpio 47 GPIO_ACTIVE_HIGH>;
clocks = <&topckgen CLK_TOP_DISP_PWM0>,
<&infracfg_ao CLK_INFRA_AO_DISP_PWM>;
clock-names = "main", "mm";
status = "okay"; // set to "disabled" to disable the boot logo
};
Limitations
No X11 Support
IoT Yocto does not provide support for X11 framework.
No HDCP Support
IoT 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.