Skip to content

Showing Wayland Compositor Fullscreen in Portrait Orientation

Application on monitor in portait orientation powered by Verdin i.MX8M Mini.

Our Qt embedded system is displayed on a monitor mounted in portrait orientation. The system runs the Wayland compositor Weston as a window manager. HMI applications are shown rotated by 90 degrees – in landscape orientation. The system toolbar of Weston is visible. How can we configure Weston so that the applications are shown in portrait orientation and so that the system toolbar is removed?

In 2018, I had to solve this problem for the secondary terminal of the ROPA Tiger 6S sugar-beet harvester: the left terminal in this photo. The system runs on a terminal from Christ Electronics with a quad-core i.MX6. It uses eglfs as a trivial window manager. Eglfs allows a single application to render its contents on a single window. Eglfs doesn’t support rotating the screen on the i.MX6.

We developed the application in landscape orientation. While developing the application, we had to tilt our heads to the right to see the application in portrait orientation. When mounting the terminal, we rotated it 90 degrees counter-clockwise so that the users could see the application in portrait orientation. The QML code rotated the application 90 degrees clockwise. The solution was quite literally pain in the neck.

Writing the software in landscape orientation and rotating the monitor to show it in portrait orientation

In 2021, I had to solve the same problem for another product. As I am not allowed to talk about this product, I’ll stick to my faithful harvester application. My system runs on a Toradex Verdin i.MX8M Mini computer-on-module. I built the Linux image tdx-reference-multimedia-image and its SDK for Yocto 3.1 Dunfell. The image contains Weston (the default Wayland compositor) and Qt 5.14.

By default, Weston expects the monitor in landscape orientation. Hence, the result from running the harvester application doesn’t come as a surprise.

Portrait application shown on landscape monitor with default Weston configuration

Weston shows the application rotated by 90 degrees counter-clockwise and shows the system toolbar with the terminal application, date and time. We need to modify the Weston configuration file /etc/xdg/weston/weston.ini on the Verdin system.

We add the following output section to weston.ini and remove or comment out already existing output sections.

[output]
name=HDMI-A-1
mode=1280x800@59.0
transform=90

We find the name and mode in the system log file /var/log/weston.log.

[18:16:42.897] Output HDMI-A-1 (crtc 33) video modes:
               1280x800@59.0, preferred, current, 70.0 MHz
               1280x800@59.8, 83.5 MHz

The Output Section of the weston.ini documentation shows us how to rotate the screen. The line transform=90 rotates the screen 90 degrees clockwise. We could also show the screen upside down (180 degrees rotation), flip the screen horizontally and apply some other transformations.

After rebooting the Verdin system, Weston shows the application in portrait orientation.

Weston shows the application in portrait mode with the system toolbar at the top.

Weston still shows the system toolbar at the top. We remove the toolbar by setting the panel position to none in the shell section of the weston.ini file.

[shell]
panel-position=none

The other value top is the default panel position, as revealed by the Shell Section of the weston.ini documentation. After rebooting the Verdin system, Weston shows the application in portrait orientation without the system toolbar.

Weston shows the application in portrait orientation without the system toolbar at the top.

3 thoughts on “Showing Wayland Compositor Fullscreen in Portrait Orientation”

  1. Faced with another related issue with Weston I wonder if/how you got your application to auto-start with Weston in a robust way? I.e. no “sleep 2” or similar in the startup scrips when waiting for Weston to start.

    1. I had a look how the systemd services of the Toradex Verdin image start my Qt application.

      Systemd starts the wayland-app-launch service after it has started the weston@root service. The wayland-app-launch service calls the script /usr/bin/wayland-app-launch.sh, which looks as follows:


      #!/bin/sh
      if test -z "$XDG_RUNTIME_DIR"; then
      export XDG_RUNTIME_DIR=/run/user/`id -u`
      if ! test -d "$XDG_RUNTIME_DIR"; then
      mkdir --parents $XDG_RUNTIME_DIR
      chmod 0700 $XDG_RUNTIME_DIR
      fi
      fi

      # wait for weston
      while [ ! -e $XDG_RUNTIME_DIR/wayland-0 ] ; do sleep 0.1; done
      sleep 1

      cd /path/to/working/dir
      /usr/local/bin/my-qt-app --fullscreen &

      The script performs a busy wait for the existence of $XDG_RUNTIME_DIR/wayland-0. It performs the check every 0.1 second until the check becomes true.

      This avoids hard-coding a fixed number of seconds (e.g., sleep 2). It seems that Weston does not notify other applications when it’s up and running. So, the busy wait seems to be the best solution.

  2. Hi and great post!
    The comment by Fredrik targets the same issue I am currently facing.
    I have to re-build my image (core-image-weston) and include systemd as init manager. However, currently, the /usr/bin/wayland-app-launch.sh is not present. Can I just create it?
    And, is it necessary to build core-image-weston, or can I just use core-image-minimal and install weston wayland in my local.conf file?
    Thanks for all your great blogs and support.
    Bjørn

Leave a Reply

Your email address will not be published. Required fields are marked *