Screen rotation in Wayland/Weston Desktop

Difficulty Levels: Beginner
Date added: November 27, 2019
Affected Products:

Wayland/Weston is the de facto GUI desktop provided by Yocto/Openembedded Distribution

Since there are numerous Display Panels available in the market, it is sometimes necessary to rotate the GUI desktop to either Landscape or Portrait setting to ensure a better representation of your UI contents.

The following article describes a simple and quick way to set the rotation of your Wayland/Weston GUI desktop without messing around with kernel display parameters.

 

Screen Rotation in Wayland/Weston Desktop

Wayland/Weston Desktop configuration file:

The weston configuration file resides at the following location in your yocto/openembedded root filesystem.

/etc/xdg/weston/weston.ini

 

The content of the weston.ini looks like the following

[core]
# i.MX: Disable idle timeout
idle-time=0
#use-g2d=1

[libinput]

touchscreen_calibrator=true

#[output]
#name=HDMI-A-1
#mode=1920x@1280
#transform=90

#[output]
#name=HDMI-A-2
#mode=off
# WIDTHxHEIGHT Resolution size width and height in pixels
# off Disables the output
# preferred Uses the preferred mode
# current Uses the current crt controller mode
#transform=90

[screen-share]
command=/usr/bin/weston --backend=rdp-backend.so --shell=fullscreen-shell.so --no-clients-resize

 

Determine your display card name for the output section

You will need to either uncomment an output section from the weston configuration file, or add additional output section to enable screen rotation of the wayland/weston desktop.

You will also need to set the correct name for your display card in order for the output to take effect.

To look for the correct device name, please examine your /var/log/weston.log file.

For example: PICO-IMX6 NYMPH board with HDMI output

[11:30:15.320] Creating fbdev output.
[11:30:15.320] Chosen EGL config details:
RGBA bits: 8 8 8 0
swap interval range: 0 – 10
[11:30:15.321] fbdev output 1280×720 px
guessing 61 Hz and 96 dpi
[11:30:15.322] Output ‘/dev/fb0‘ enabled with head(s) /dev/fb0
[11:30:15.322] Compositor capabilities:
arbitrary surface rotation: yes
screen capture uses y-flip: yes
presentation clock: CLOCK_MONOTONIC_RAW, id 4
presentation clock resolution: 0.000000001 s

Since there are no specific device name given, and “fbdev” is created. We could then add an output section below to enable the Wayland/Weston desktop rotation to 90 degree clockwise

Additional Output Section to add into /etc/xdg/weston/weston.ini

[output]
name=fbdev
mode=1280x@720
transform=90               # rotate 90 degrees clockwise

 

For example: PICO-IMX6 NYMPH board with LVDS 7 inch display

...
[11:30:15.302] Creating fbdev output.
[11:30:15.303] Chosen EGL config details:
RGBA bits: 8 8 8 0
swap interval range: 0 - 10
[11:30:15.304] fbdev output 1024×600 px
guessing 68 Hz and 96 dpi
[11:30:15.304] Output '/dev/fb0' enabled with head(s) /dev/fb0
[11:30:15.304] Compositor capabilities:
arbitrary surface rotation: yes
screen capture uses y-flip: yes
presentation clock: CLOCK_MONOTONIC_RAW, id 4
presentation clock resolution: 0.000000001 s
...

 

Again there are no specific name given, but “fbdev” is created, we can set the following output section.

Additional Output Section to add into /etc/xdg/weston/weston.ini

[output]
name=fbdev
mode=1024x@600
transform=90               # rotate 90 degrees clockwise

 

NOTE: Once your save the weston.ini configuration file with the modification, you will need to reboot the device or restart wayland/weston for the settings to take effect.

 

 

 

 

Stay up to date with all the latest TechNexion news...

Sign-up for our Newsletter