Configuring weston/wayland for two displays

Dear ladies and gentlemen.
We have successfully build and started your dunfell-5.x.y weston-wayland tdx-reference-multimedia-image.
We have connected one LVDS, have prepared an overlay and have set the vidargs to the following:

vidargs 'video=mxcfb0:dev=ldb video=mxcfb1:off video=mxcfb2:off video=mxcfb3:off fbmem=512M'

explained in Display Output, Resolution and Timings (Linux) | Toradex Developer Center .

Starting the CinematicExperience works perfectly with the service called wayland-app-launch.service.

Now, we try now use the second display. We have successfully prepared the correspronding overlay.
Of course, now, the vidargs have been set to the following:

vidargs 'video=mxcfb0:dev=ldb video=mxcfb1:off video=mxcfb2:dev=ldb video=mxcfb3:off fbmem=512M'

We have succeeded to start the same weston@root.service, which results in the white, graphical interface on both displays.

At the logs, we see a problem. Weston only uses the first /dev/fb0 framebuffer. We have tried a lot, but we don’t know how to set the framebuffer to the /dev/fb2 for the second display…

How can we set the service weston@root.service to open both framebuffers and create so a wayland-0 and a wayland-1?

Here, you can see the weston logs:

cat /var/log/weston.log
Date: 2020-10-23 UTC
[13:55:42.927] weston 8.0.0
               https://wayland.freedesktop.org
               Bug reports to: https://gitlab.freedesktop.org/wayland/weston/issues/
               Build: 8.0.0-34-g27cde525+
[13:55:42.927] Command line: /usr/bin/weston --modules=xwayland.so --log=/var/log/weston.log
[13:55:42.928] OS: Linux, 5.4.47-26809-gc1f580adc114-dirty, #35 SMP Fri Oct 23 12:38:47 CEST 2020, armv7l
[13:55:42.928] Starting with no config file.
[13:55:42.928] Output repaint window is 16 ms maximum.
[13:55:42.928] Loading module '/usr/lib/libweston-8/fbdev-backend.so'
[13:55:42.937] initializing fbdev backend
[13:55:42.944] logind: failed to get session seat
[13:55:42.944] logind: cannot setup systemd-logind helper (-61), using legacy fallback
[13:55:42.944] Loading module '/usr/lib/libweston-8/gl-renderer.so'
[13:55:42.951] warning: either no EGL_EXT_platform_base support or specific platform support; falling back to eglGetDisplay.
[13:55:42.961] EGL version: 1.5
[13:55:42.961] EGL vendor: Vivante Corporation
[13:55:42.961] EGL client APIs: OpenGL_ES OpenVG
[13:55:42.961] EGL extensions: EGL_KHR_fence_sync EGL_KHR_reusable_sync
               EGL_KHR_wait_sync EGL_KHR_image EGL_KHR_image_base
               EGL_KHR_image_pixmap EGL_KHR_gl_texture_2D_image
               EGL_KHR_gl_texture_cubemap_image EGL_KHR_gl_renderbuffer_image
               EGL_EXT_image_dma_buf_import
               EGL_EXT_image_dma_buf_import_modifiers EGL_KHR_lock_surface
               EGL_KHR_create_context EGL_KHR_no_config_context
               EGL_KHR_surfaceless_context EGL_KHR_get_all_proc_addresses
               EGL_EXT_buffer_age EGL_ANDROID_native_fence_sync
               EGL_WL_bind_wayland_display
               EGL_WL_create_wayland_buffer_from_image EGL_KHR_partial_update
               EGL_EXT_swap_buffers_with_damage
               EGL_KHR_swap_buffers_with_damage
[13:55:42.961] EGL_KHR_surfaceless_context available
[13:55:42.967] GL version: OpenGL ES 3.0 V6.4.0.p2.234062
[13:55:42.967] GLSL version: OpenGL ES GLSL ES 3.00
[13:55:42.967] GL vendor: Vivante Corporation
[13:55:42.967] GL renderer: Vivante GC2000
[13:55:42.967] GL extensions: GL_OES_vertex_type_10_10_10_2
               GL_OES_vertex_half_float GL_OES_element_index_uint
               GL_OES_mapbuffer GL_OES_vertex_array_object
               GL_OES_compressed_ETC1_RGB8_texture
               GL_OES_compressed_paletted_texture GL_OES_texture_npot
               GL_OES_rgb8_rgba8 GL_OES_depth_texture
               GL_OES_depth_texture_cube_map GL_OES_depth24 GL_OES_depth32
               GL_OES_packed_depth_stencil GL_OES_fbo_render_mipmap
               GL_OES_get_program_binary GL_OES_fragment_precision_high
               GL_OES_standard_derivatives GL_OES_EGL_image GL_OES_EGL_sync
               GL_OES_required_internalformat GL_OES_surfaceless_context
               GL_OES_texture_half_float GL_OES_texture_float
               GL_EXT_texture_type_2_10_10_10_REV
               GL_EXT_texture_filter_anisotropic
               GL_EXT_texture_compression_dxt1 GL_EXT_texture_format_BGRA8888
               GL_EXT_texture_compression_s3tc GL_EXT_read_format_bgra
               GL_EXT_multi_draw_arrays GL_EXT_frag_depth
               GL_EXT_discard_framebuffer GL_EXT_blend_minmax
               GL_EXT_multisampled_render_to_texture GL_EXT_robustness
               GL_EXT_texture_sRGB_decode GL_EXT_texture_rg GL_EXT_sRGB
               GL_VIV_direct_texture
[13:55:42.968] GL ES 2 renderer features:
               read-back format: BGRA
               wl_shm sub-image to texture: yes
               EGL Wayland extension: yes
[13:55:42.968] Opening fbdev frame buffer.
[13:55:42.968] Calculating pixman format from:
                - type: 0 (aux: 0)
                - visual: 2
                - bpp: 32 (grayscale: 0)
                - red: offset: 16, length: 8, MSB: 0
                - green: offset: 8, length: 8, MSB: 0
                - blue: offset: 0, length: 8, MSB: 0
                - transp: offset: 24, length: 8, MSB: 0
[13:55:43.335] Created head '/dev/fb0' for device /dev/fb0 (DISP4 BG)
[13:55:43.358] event0  - stmpe-ts: is tagged by udev as: Touchscreen
[13:55:43.360] event0  - stmpe-ts: device is a touch device
[13:55:43.362] Touchscreen - stmpe-ts - /sys/devices/soc0/soc/2100000.aips-bus/21a4000.i2c/i2c-2/2-0041/stmpe-ts/input/input0/event0
[13:55:43.362] libinput: configuring device "stmpe-ts".
[13:55:43.362] input device event0 has no enabled output associated (none named), skipping calibration for now.
[13:55:43.362] Creating fbdev output.
[13:55:43.362] Chosen EGL config details: id:  41 rgba: 8 8 8 0 buf: 24 dep:  0 stcl: 0 int: 0-10 type: win|pix|pbf|swap_preserved vis_id: 0
[13:55:43.363] fbdev output 256×1920 px
               guessing 82 Hz and 96 dpi
[13:55:43.363] associating input device event0 with output /dev/fb0 (none by udev)
[13:55:43.364] Output '/dev/fb0' enabled with head(s) /dev/fb0
[13:55:43.364] 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
[13:55:43.365] Loading module '/usr/lib/weston/desktop-shell.so'
[13:55:43.367] launching '/usr/libexec/weston-keyboard'
[13:55:43.372] Old Xwayland module loading detected: Please use --xwayland command line option or set xwayland=true in the [core] section in weston.ini
[13:55:43.373] Loading module '/usr/lib/libweston-8/xwayland.so'
[13:55:43.401] Registered plugin API 'weston_xwayland_v1' of size 16
[13:55:43.402] Registered plugin API 'weston_xwayland_surface_v1' of size 8
[13:55:43.402] xserver listening on display :0
[13:55:43.402] launching '/usr/libexec/weston-desktop-shell'

Here, you can see that wayland only creates one display socket…

ls -la /run/user/0/
total 0
drwx------ 3 root root 120 Oct 23 13:55 .
drwxr-xr-x 3 root root  60 Oct 23 13:55 ..
srw-rw-rw- 1 root root   0 Oct 23 13:55 bus
drwxr-xr-x 2 root root  80 Oct 23 13:55 systemd
srwxr-xr-x 1 root root   0 Oct 23 13:55 wayland-0
-rw-r----- 1 root root   0 Oct 23 13:55 wayland-0.lock

Here, you can see the corresponding framebuffers:

root@apalis-imx6:~# ls -la /dev/fb*
lrwxrwxrwx 1 root root      3 Oct 23 13:50 /dev/fb -> fb0
crw-rw---- 1 root video 29, 0 Oct 23 13:50 /dev/fb0
crw-rw---- 1 root video 29, 1 Oct 23 13:50 /dev/fb1
crw-rw---- 1 root video 29, 2 Oct 23 13:50 /dev/fb2
crw-rw---- 1 root video 29, 3 Oct 23 13:50 /dev/fb3

Here, you can see the printenv:

printenv
SHELL=/bin/sh
SYSTEMD_COLORS=0
EDITOR=vi
PWD=/home/root
LOGNAME=root
HOME=/home/root
SSH_CONNECTION=::ffff:XXX.XXX.XXX.XXX XXX ::ffff:XXX.XXX.XXX.XXX XXX
QT_QPA_PLATFORM=wayland-egl
TERM=xterm-256color
USER=root
DISPLAY=:0.0
SHLVL=1
PS1=\u@\h:\w\$ 
SSH_CLIENT=::ffff:XXX.XXX.XXX.XXX XXX XXX
PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin
SSH_TTY=/dev/pts/0
_=/bin/printenv

Hi @Alias_Alias

I think you need to start weston with the “–device” argument. If I see it correctly the following could do the trick:

echo "OPTARGS=\"--device /dev/fb0 --device /dev/fb1\"" >> /etc/default/weston

One thing which is a bit unfortunate is that you can’t define on which display an application should start on weston. This should be possible with weston 9 and kiosk mode but with weston 8 it doesn’t really work. Another idea is to use the ivi shell from GENIVI:
https://github.com/GENIVI/wayland-ivi-extension

Regards,
Stefan

Hi Stefan,

we will try this today, to manipulate the “/etc/default/weston”.

Is there a way/plan to upgrade to “weston 9” with the “dunfell-5.x.y” yocto ?

Can you exmplane whtat “wayland-ivi-extension” is / how to use it?

A second way is maybe to start two weston instance.
One for every Display. We have tried that yesterday but it was not succesful.
Whould that be a option?

Best Regards,
Alias_Alias

Hi @Alias_Alias

Unfortunately we have no plans to update weston in dunfell because we rely on the weston version of NXP for dunfell. However, it should be possible to backport the kiosk mode to weston 8, maybe you could try that?

Unfortunately, there is also no real documentation for the ivi extension available. The best thing I could find was this:
https://at.projects.genivi.org/wiki/display/WIE/Quick+start

I guess back-porting kiosk mode would be the easiest solution.

Starting weston twice is unfortunately not an option because then only one screen can benefit from the GPU. If this would be okay you could start one weton normally and one with the option --use-pixman. The one with --use-pixman would not be GPU accelerated.

Regards,
Stefan

Hi @stefan.tx ,

we have tried a lot, but with the normal “dunfell-5” image weston does not work. We can’t set the OPTARGS. Here, you can see the logs:

X@X:~$ ssh root@192.168.178.39
root@apalis-imx6:~#
root@apalis-imx6:~#
root@apalis-imx6:~# ls -la  /var/log/
total 28
drwxr-xr-x 3 root root  160 Oct 28 16:20 .
drwxrwxrwt 4 root root   80 Oct 28 16:19 ..
-rw-rw---- 1 root utmp    0 Oct 28 16:19 btmp
-rw-rw-r-- 1 root utmp  292 Oct 28 16:20 lastlog
-rw-r--r-- 1 root root 8566 Oct 28 16:20 messages
drwx------ 2 root root   40 Oct 28 16:19 private
-rw-r--r-- 1 root root 5829 Oct 28 16:20 weston.log
-rw-rw-r-- 1 root utmp 3072 Oct 28 16:20 wtmp
root@apalis-imx6:~#
root@apalis-imx6:~#
root@apalis-imx6:~# cat /etc/default/weston
XDG_CONFIG_HOME=/etc/xdg/weston/weston.ini
OPTARGS="--device /dev/fb0 --device /dev/fb1"
root@apalis-imx6:~#
root@apalis-imx6:~#
root@apalis-imx6:~# cat /var/log/weston.log
Date: 2020-10-28 UTC
[16:20:00.568] weston 8.0.0
               https://wayland.freedesktop.org
               Bug reports to: https://gitlab.freedesktop.org/wayland/weston/issues/
               Build: 8.0.0-34-g27cde525+
[16:20:00.568] Command line: /usr/bin/weston --modules=xwayland.so --log=/var/log/weston.log
[16:20:00.568] OS: Linux, 5.4.47-26809-gc1f580adc114-dirty, #35 SMP Fri Oct 23 12:38:47 CEST 2020, armv7l
[16:20:00.590] Starting with no config file.
[16:20:00.591] Output repaint window is 16 ms maximum.
[16:20:00.592] Loading module '/usr/lib/libweston-8/fbdev-backend.so'
[16:20:00.624] initializing fbdev backend
[16:20:00.640] logind: failed to get session seat
[16:20:00.640] logind: cannot setup systemd-logind helper (-61), using legacy fallback
[16:20:00.641] Loading module '/usr/lib/libweston-8/gl-renderer.so'
[16:20:00.675] warning: either no EGL_EXT_platform_base support or specific platform support; falling back to eglGetDisplay.
[16:20:00.709] EGL version: 1.5
[16:20:00.710] EGL vendor: Vivante Corporation
[16:20:00.710] EGL client APIs: OpenGL_ES OpenVG
[16:20:00.710] EGL extensions: EGL_KHR_fence_sync EGL_KHR_reusable_sync
               EGL_KHR_wait_sync EGL_KHR_image EGL_KHR_image_base
               EGL_KHR_image_pixmap EGL_KHR_gl_texture_2D_image
               EGL_KHR_gl_texture_cubemap_image EGL_KHR_gl_renderbuffer_image
               EGL_EXT_image_dma_buf_import
               EGL_EXT_image_dma_buf_import_modifiers EGL_KHR_lock_surface
               EGL_KHR_create_context EGL_KHR_no_config_context
               EGL_KHR_surfaceless_context EGL_KHR_get_all_proc_addresses
               EGL_EXT_buffer_age EGL_ANDROID_native_fence_sync
               EGL_WL_bind_wayland_display
               EGL_WL_create_wayland_buffer_from_image EGL_KHR_partial_update
               EGL_EXT_swap_buffers_with_damage
               EGL_KHR_swap_buffers_with_damage
[16:20:00.710] EGL_KHR_surfaceless_context available
[16:20:00.727] GL version: OpenGL ES 3.0 V6.4.0.p2.234062
[16:20:00.727] GLSL version: OpenGL ES GLSL ES 3.00
[16:20:00.728] GL vendor: Vivante Corporation
[16:20:00.728] GL renderer: Vivante GC2000
[16:20:00.728] GL extensions: GL_OES_vertex_type_10_10_10_2
               GL_OES_vertex_half_float GL_OES_element_index_uint
               GL_OES_mapbuffer GL_OES_vertex_array_object
               GL_OES_compressed_ETC1_RGB8_texture
               GL_OES_compressed_paletted_texture GL_OES_texture_npot
               GL_OES_rgb8_rgba8 GL_OES_depth_texture
               GL_OES_depth_texture_cube_map GL_OES_depth24 GL_OES_depth32
               GL_OES_packed_depth_stencil GL_OES_fbo_render_mipmap
               GL_OES_get_program_binary GL_OES_fragment_precision_high
               GL_OES_standard_derivatives GL_OES_EGL_image GL_OES_EGL_sync
               GL_OES_required_internalformat GL_OES_surfaceless_context
               GL_OES_texture_half_float GL_OES_texture_float
               GL_EXT_texture_type_2_10_10_10_REV
               GL_EXT_texture_filter_anisotropic
               GL_EXT_texture_compression_dxt1 GL_EXT_texture_format_BGRA8888
               GL_EXT_texture_compression_s3tc GL_EXT_read_format_bgra
               GL_EXT_multi_draw_arrays GL_EXT_frag_depth
               GL_EXT_discard_framebuffer GL_EXT_blend_minmax
               GL_EXT_multisampled_render_to_texture GL_EXT_robustness
               GL_EXT_texture_sRGB_decode GL_EXT_texture_rg GL_EXT_sRGB
               GL_VIV_direct_texture
[16:20:00.728] GL ES 2 renderer features:
               read-back format: BGRA
               wl_shm sub-image to texture: yes
               EGL Wayland extension: yes
[16:20:00.728] Opening fbdev frame buffer.
[16:20:00.728] Calculating pixman format from:
                - type: 0 (aux: 0)
                - visual: 2
                - bpp: 32 (grayscale: 0)
                - red: offset: 16, length: 8, MSB: 0
                - green: offset: 8, length: 8, MSB: 0
                - blue: offset: 0, length: 8, MSB: 0
                - transp: offset: 24, length: 8, MSB: 0
[16:20:01.419] Created head '/dev/fb0' for device /dev/fb0 (DISP4 BG)
[16:20:01.454] event0  - stmpe-ts: is tagged by udev as: Touchscreen
[16:20:01.456] event0  - stmpe-ts: device is a touch device
[16:20:01.457] Touchscreen - stmpe-ts - /sys/devices/soc0/soc/2100000.aips-bus/21a4000.i2c/i2c-2/2-0041/stmpe-ts/input/input0/event0
[16:20:01.457] libinput: configuring device "stmpe-ts".
[16:20:01.457] input device event0 has no enabled output associated (none named), skipping calibration for now.
[16:20:01.457] Creating fbdev output.
[16:20:01.457] Chosen EGL config details: id:  41 rgba: 8 8 8 0 buf: 24 dep:  0 stcl: 0 int: 0-10 type: win|pix|pbf|swap_preserved vis_id: 0
[16:20:01.458] fbdev output 256×1920 px
               guessing 82 Hz and 96 dpi
[16:20:01.458] associating input device event0 with output /dev/fb0 (none by udev)
[16:20:01.459] Output '/dev/fb0' enabled with head(s) /dev/fb0
[16:20:01.459] 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
[16:20:01.471] Loading module '/usr/lib/weston/desktop-shell.so'
[16:20:01.475] launching '/usr/libexec/weston-keyboard'
[16:20:01.479] Old Xwayland module loading detected: Please use --xwayland command line option or set xwayland=true in the [core] section in weston.ini
[16:20:01.489] Loading module '/usr/lib/libweston-8/xwayland.so'
[16:20:01.607] Registered plugin API 'weston_xwayland_v1' of size 16
[16:20:01.607] Registered plugin API 'weston_xwayland_surface_v1' of size 8
[16:20:01.607] xserver listening on display :0
[16:20:01.607] launching '/usr/libexec/weston-desktop-shell'

The Command line is every Time:

Command line: /usr/bin/weston --modules=xwayland.so --log=/var/log/weston.log

Maybe we have to change the systemctl weston service ?

Best Regards,

Alias

Hi @Alias_Alias
Can you try to start it manually:

weston -B fbdev-backend.so --xwayland --device /dev/fb0 --device /dev/fb1  --tty 6

Regards,
Stefan