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
.
Boot Logo
The DSI panels of Genio 700-EVK, Genio 1200-EVK and Genio 510-EVK support boot logo by default.
Starting from the v23.2 release, the eDP panels of Genio 700-EVK, Genio 1200-EVK and Genio 510-EVK support boot logo. The DSI and eDP boot logos cannot be used simultaneously. Only one of them can be used at a time. Currently it is not possible to switch between DSI and eDP boot logos at runtime. To enable the eDP boot logo, you will need to modify the configuration and rebuild the image. You can submit a eservice request to MTK to inquire about the process for enabling the eDP 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 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
};
HDMI CEC
The HDMITX port of Genio 700-EVK, Genio 1200-EVK and Genio 510-EVK support CEC function by default.
Starting from the v24.0 release, the HDMITX port of Genio 700-EVK, Genio 1200-EVK and Genio 510-EVK support CEC function.
You can use the cec-ctl
and cec-compliance
utilities to control the CEC function in user space on any HDMI-enabled display combination. Here are some usage steps.
Connect the EVK to a CEC-supported TV with an HDMI cable
Note
CEC might be disabled by default on some TVs. Please make sure to enable the CEC function on your TV.
On the console of the EVK, to register a CEC device on CEC bus, set its type and physical address with command
cec-ctl --tuner -p 1.0.0.0
root@genio-1200-evk:~# cec-ctl --tuner -p 1.0.0.0
Driver Info:
Driver Name : mediatek-cec2
Adapter Name : mtk-hdmi-cec
Capabilities : 0x0000000f
Physical Address
Logical Addresses
Transmit
Passthrough
Driver version : 5.15.42
Available Logical Addresses: 1
Connector Info : None
Physical Address : 1.0.0.0
Logical Address Mask : 0x0008
CEC Version : 2.0
Vendor ID : 0x000c03 (HDMI)
OSD Name : 'Tuner'
Logical Addresses : 1 (Allow RC Passthrough)
Logical Address : 3 (Tuner 1)
Primary Device Type : Tuner
Logical Address Type : Tuner
All Device Types : Tuner
RC TV Profile : None
Device Features :
None
To test the compliance between the EVK and your TV, use command
cec-compliance -A
.
root@genio-1200-evk:~# cec-compliance -A
...
Compliance test for mediatek-cec2 device /dev/cec0:
The test results mean the following:
OK Supported correctly by the device.
OK (Not Supported) Not supported and not mandatory for the device.
OK (Presumed) Presumably supported. Manually check to confirm.
OK (Unexpected) Supported correctly but is not expected to be supported for this device.
OK (Refused) Supported by the device, but was refused.
OK (Expected Failure) Failed but this was expected (see -e option).
FAIL Failed and was expected to be supported by this device.
Find remote devices:
Polling: OK
CEC API:
CEC_ADAP_G_CAPS: OK
Invalid ioctls: OK
CEC_DQEVENT: OK
CEC_ADAP_G/S_PHYS_ADDR: OK
CEC_ADAP_G/S_LOG_ADDRS: OK
warn: ../../../v4l-utils-1.22.1/utils/cec-compliance/cec-test-adapter.cpp(494): Could only do 7 pings per second to an invalid LA, expected at least 12
CEC_TRANSMIT: OK
CEC_RECEIVE: OK
CEC_TRANSMIT/RECEIVE (non-blocking): OK (Presumed)
CEC_G/S_MODE: OK
Successful transmits: 73
Received messages: 70 of which 70 were CEC_MSG_CEC_VERSION
Received 54 messages immediately, and 89 over 13 seconds
SFTs for repeating messages (>= 7): 4: 72
SFTs for repeating remote messages (>= 7): 7: 6, 8: 55, 10: 1
warn: ../../../v4l-utils-1.22.1/utils/cec-compliance/cec-test-adapter.cpp(1291): There were 74 CEC_GET_VERSION transmits but only 70 CEC_VERSION receives
CEC_EVENT_LOST_MSGS: OK
Network topology:
System Information for device 0 (TV) from device 3 (Tuner 1):
CEC Version : 1.4
Physical Address : 0.0.0.0
Primary Device Type : TV
Vendor ID : Tx, OK, Rx, Timeout
OSD Name : Tx, OK, Rx, OK, Feature Abort
Menu Language : chi
Power Status : On
Total for mediatek-cec2 device /dev/cec0: 11, Succeeded: 11, Failed: 0, Warnings: 2
4. To debug and monitor CEC activities, use command cec-ctl -M
. You may use cec-ctl -M&
with other cec-ctl commands to see more detailed CEC message activites,
such as message type, message transmitter and receiver, and transmittion results.
root@genio-1200-evk:~# cec-ctl -M&
...
root@genio-1200-evk:~# cec-ctl --test-power-cycle
...
209.756s: Transmit Active Source to TV: OK
Transmitted by Tuner 1 to all (3 to 15): ACTIVE_SOURCE (0x82):
209.858s: Transmit Standby to TV: phys-addr: 1.0.0.0
Transmitted by Tuner 1 to TV (3 to 0): STANDBY (0x36)
Transmitted by Tuner 1 to TV (3 to 0): GIVE_DEVICE_POWER_STATUS (0x8f)
+Received from TV to Tuner 1 (0 to 3): REPORT_POWER_STATUS (0x90):
pwr-state: on (0x00)
Received from TV to all (0 to 15): STANDBY (0x36)
Transmitted by Tuner 1 to TV (3 to 0): STANDBY (0x36)
Transmitted by Tuner 1 to TV (3 to 0): GIVE_DEVICE_POWER_STATUS (0x8f)
\Received from TV to Tuner 1 (0 to 3): REPORT_POWER_STATUS (0x90):
pwr-state: to-standby (0x03)
...
Here is a list of some frequently used cec-ctl commands.
Command |
Description |
---|---|
cec-ctl –help |
Obtain a comprehensive manual for using cec-ctl. |
cec-ctl –standby -t0 |
Put the TV into standby mode. |
cec-ctl –user-control-pressed ui-cmd=power-on-function -t0 |
Wake up the TV. |
cec-ctl –test-power-cycle |
The TV is repeatedly woken up and put into standby mode. The TV status is checked with each wakeup/standby command. |
Note
The behavior of TVs handling CEC messages is NOT guaranteed. We can only guarantee that the EVK transmits and receives CEC messages correctly. For example, some TVs may not go into standby mode after receiving a standby message.
HDMI HDCP
The HDMITX port of Genio 700-EVK, Genio 1200-EVK and Genio 510-EVK support HDCP function.
Starting from the v24.0 release, the HDMITX port of Genio 700-EVK, Genio 1200-EVK and Genio 510-EVK support HDCP 1.x and 2.x function. It is disabled by default. The HDCP driver is implemented in two parts:
DRM HDMITX HDCP CA (client application), which is in the kernel space.
HDMITX HDCP TA (trusted application), which is in OPTEE.
The source code of CA is released along with v24.0 and can be enabled by kernel config DRM_MEDIATEK_HDMI_HDCP. However the TA is NOT provided along with v24.0. Due to the HDCP release restriction, you must be HDCP-licensed and provide your license info to MTK, then issue an e-service ticket to apply for the TA. If DRM_MEDIATEK_HDMI_HDCP is enabled without TA, it would work as normal HDMI.
Note
You have to maintain the HDCP keys by yourselves, which are under OPTEE, and make them available to the TA. The TA would use your keys to enable HDCP. More detailed usage will be provided when applying for the TA.
Limitations
No X11 Support
IoT Yocto does not provide support for X11 framework.