How to configure Weston screen resolution

Revision as of 12:09, 29 January 2019 by imported>Frq08988
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Template:ArticleMigratedFromOSDKUG Template:ArticleMainWriter Template:ReviewersList Template:ArticleFirstDraftVersion




You can configure the video output mode and resolution from weston.ini configuration file located in:

/etc/xdg/weston/weston.ini

For more details refer to the ubuntu weston.ini manpage[1]

1. Standard video mode[edit source]

If you want to set a standard video mode (1080, 720, VGA, ...), you have to provide the video mode in “resolution” format.

Example with a 1280x720 resolution In weston.ini file, modify the connector section with the resolution (here #HDMI connector):

[output]
name=HDMI-A-1
#mode=preferred
mode=1280x720

Then restart Weston or reboot the board.

2. Specific video mode[edit source]

If you want to set a particular video mode (for example specifying a refresh frequency), you have to provide the video mode in “modeline” format.

2.1. With cvt tool[edit source]

If cvt is present in your system, you can enter for instance:

 cvt 1280 720 60
# 1280x720 59.86 Hz (CVT 0.92M9) hsync: 44.77 kHz; pclk: 74.50 MHz
Modeline "1280x720_60.00"   74.50  1280 1344 1472 1664  720 723 728 748 -hsync +vsync

then add this modeline result in weston.ini

[output]
name=HDMI-A-1
#mode=preferred
mode=74.50  1280 1344 1472 1664  720 723 728 748 -hsync +vsync

Then restart Weston or reboot the board.

For more details about cvt, refer to the ubuntu cvt manpage[2]

2.2. Without cvt tool[edit source]

Example using 1920x1080@30Hz

First, you have to retrieve the modeline parameters for the mode you need:

$ echo 7 > /sys/module/drm/parameters/debug
$ systemctl stop weston
$ systemctl start weston
$ dmesg | grep modeline
# ...
# [  386.662671] [drm:drm_mode_debug_printmodeline], Modeline 43:"1920x1080" 25 74250 1920 2448 2492 2640 1080 1084 1089 1125 0x40 0x5
# [  386.662699] [drm:drm_mode_debug_printmodeline], Modeline 40:"1920x1080" 24 74250 1920 2558 2602 2750 1080 1084 1089 1125 0x40 0x5
# [  386.662726] [drm:drm_mode_debug_printmodeline], Modeline 41:"1920x1080" 24 74176 1920 2558 2602 2750 1080 1084 1089 1125 0x40 0x5
# [  386.662753] [drm:drm_mode_debug_printmodeline], Modeline 39:"1920x1080" 30 74176 1920 2008 2052 2200 1080 1084 1089 1125 0x40 0x5

As listed on the last line, the parameters for 1920x1080@30 are:

74176 1920 2008 2052 2200 1080 1084 1089 1125 0x40 0x5

Remove the two last parameters (0x40 0x5) and divide the first parameter by 1000 (MHz->kHz), which gives:

74.176 1920 2008 2052 2200 1080 1084 1089 1125

Retrieve the hsync & vsync polarity of this mode from modetest:

$ modetest
# Connectors:
# id	encoder	status		type	size (mm)	modes	encoders
# 9	8	connected	HDMI-A	710x400		31	8
#   modes:
# 	name refresh (Hz) hdisp hss hse htot vdisp vss vse vtot)
#  1920x1080 50 1920 2448 2492 2640 1080 1084 1089 1125 flags: phsync, pvsync; type: preferred, driver
#  1920x1080 60 1920 2008 2052 2200 1080 1084 1089 1125 flags: phsync, pvsync; type: driver
#  1920x1080 60 1920 2008 2052 2200 1080 1084 1089 1125 flags: phsync, pvsync; type: driver
#  1920x1080 30 1920 2008 2052 2200 1080 1084 1089 1125 flags: phsync, pvsync; type: driver
#  ...

The polarity for 1920x1080@30 is "phsync, pvsync" (p stands for positive, n for negative). Append the polarity with the (+)(-)hsync (+)(-)vsync format. Here:

+hsync +vsync

The complete mode is:

74.176 1920 2008 2052 2200 1080 1084 1089 1125 +hsync +vsync


Then, in weston.ini, modify the connector section with the provided parameters:

[output]
name=HDMI-A-1
#mode=preferred
mode=74.176 1920 2008 2052 2200 1080 1084 1089 1125 +hsync +vsync

Then restart Weston or reboot the board.

3. References[edit source]