Hello Toradex Community,
I’m developing an application on a Toradex iMX7D SoM running TorizonCore with Weston as the compositor in a Wayland based environment. My application uses GTK for the GUI, and I’m trying to implement screen capture functionality. My application is running inside a Docker container, and I’ve tried multiple approaches to capture the screen without success.
Here’s what I’ve attempted so far:
- Using Grim and Fgrab: I installed and tried using both
grim
andfgrab
tools for screen capturing. While the tools execute without errors, the captures result in blank screens. - Framebuffer Approach (/dev/fb): I also tried capturing the framebuffer directly by accessing
/dev/fb0
, but that didn’t give the expected results either, still leading to blank captures. - Ensuring the Right Display is Targeted: In my
docker-compose.yml
, I’ve ensured the Wayland display socket is correctly mapped:
volumes:
- /run/user/1000/wayland-0:/run/user/1000/wayland-0
environment:
- WAYLAND_DISPLAY=wayland-0
Generally, in board WAYLAND_DISPLAY is showing blank. So, I’ve also set WAYLAND_DISPLAY
to wayland-0
and tried for screen capture, but not use it is setting back to blank again.
To confirm which compositor is running I checked with ps aux | grep weston
torizon@colibri-imx7-emmc-15022057:~$ ps aux | grep weston
root 1194 0.0 0.0 3324 372 ? S 12:08 0:00 setsid -w -f openvt -w -f -s -c 7 -e -- bash -c /usr/bin/weston-launch --tty=/dev/tty7 --user=torizon -- --current-mode --use-pixman > >(tee /proc/1/fd/1) 2> >(tee /proc/1/fd/2)
root 1195 0.0 0.1 4532 1884 tty7 Ss+ 12:08 0:00 bash -c /usr/bin/weston-launch --tty=/dev/tty7 --user=torizon -- --current-mode --use-pixman > >(tee /proc/1/fd/1) 2> >(tee /proc/1/fd/2)
root 1196 0.0 0.2 8696 2640 tty7 S+ 12:08 0:00 /usr/bin/weston-launch --tty=/dev/tty7 --user=torizon -- --current-mode --use-pixman
root 1197 0.0 0.0 4532 896 tty7 S+ 12:08 0:00 bash -c /usr/bin/weston-launch --tty=/dev/tty7 --user=torizon -- --current-mode --use-pixman > >(tee /proc/1/fd/1) 2> >(tee /proc/1/fd/2)
root 1198 0.0 0.0 4532 896 tty7 S+ 12:08 0:00 bash -c /usr/bin/weston-launch --tty=/dev/tty7 --user=torizon -- --current-mode --use-pixman > >(tee /proc/1/fd/1) 2> >(tee /proc/1/fd/2)
torizon 1208 2.5 3.2 67332 33268 tty7 S+ 12:08 2:21 /usr/bin/weston --current-mode --use-pixman
torizon 1228 0.0 0.7 16524 7896 tty7 S+ 12:08 0:00 /usr/lib/arm-linux-gnueabihf/weston-keyboard
torizon 1239 0.0 1.4 23004 14340 tty7 S+ 12:08 0:00 /usr/lib/arm-linux-gnueabihf/weston-desktop-shell
torizon 1538 0.0 0.1 2156 1060 pts/0 S+ 13:40 0:00 grep weston
When running Weston, I observed that launching Weston with the --current-mode
option fails with a “Broken pipe” error, and there’s also a warning regarding XDG_RUNTIME_DIR
not being configured correctly, log mentioned below for your reference.
root@colibri-imx7-emmc-14952875:/home/torizon# weston --current-mode --use-pixman
Date: 2024-09-28 UTC
[11:05:11.042] weston 9.0.0
https://wayland.freedesktop.org
Bug reports to: https://gitlab.freedesktop.org/wayland/weston/issues/
Build: 9.0.0
[11:05:11.044] Command line: weston --current-mode --use-pixman
[11:05:11.046] OS: Linux, 6.1.71-6.5.0+git.38fb82ecd144, #1-TorizonCore SMP Tue Dec 19 14:52:07 UTC 2023, armv7l
[11:05:11.048] warning: XDG_RUNTIME_DIR "/tmp/1000-runtime-dir" is not configured
correctly. Unix access mode must be 0700 (current mode is 700),
and must be owned by the user (current owner is UID 1000).
Refer to your distribution on how to get it, or
http://www.freedesktop.org/wiki/Specifications/basedir-spec
on how to implement it.
[11:05:11.056] Using config file '/etc/xdg/weston/weston.ini'
[11:05:11.059] Output repaint window is 7 ms maximum.
[11:05:11.062] Loading module '/usr/lib/arm-linux-gnueabihf/libweston-9/wayland-backend.so'
[11:05:11.132] Registered plugin API 'weston_windowed_output_api_v1' of size 8
[11:05:11.133] Creating 1024x640 wayland output at (0, 0)
[11:05:11.138] wayland-backend: Using xdg_wm_base
[11:05:11.196] Output 'wayland0' enabled with head(s) wayland0
[11:05:11.197] Compositor capabilities:
arbitrary surface rotation: yes
screen capture uses y-flip: no
presentation clock: CLOCK_MONOTONIC_RAW, id 4
presentation clock resolution: 0.000000001 s
[11:05:11.202] libwayland: unable to lock lockfile /tmp/1000-runtime-dir/wayland-0.lock, maybe another compositor is running
[11:05:11.205] Loading module '/usr/lib/arm-linux-gnueabihf/weston/desktop-shell.so'
[11:05:11.212] launching '/usr/lib/arm-linux-gnueabihf/weston-keyboard'
[11:05:11.219] Loading module '/usr/lib/arm-linux-gnueabihf/weston/screen-share.so'
[11:05:11.241] Screen share failed: No wl_shm found
[11:05:11.243] Loading module '/usr/lib/arm-linux-gnueabihf/libweston-9/xwayland.so'
[11:05:11.254] Registered plugin API 'weston_xwayland_v1' of size 16
[11:05:11.255] Registered plugin API 'weston_xwayland_surface_v1' of size 8
[11:05:11.257] xserver listening on display :1
[11:05:11.258] fatal: unhandled option: --current-mode
root@colibri-imx7-emmc-14952875:/home/torizon# Failed to process Wayland connection: Broken pipe
failed to create display: Broken pipe
Despite these attempts, I’m still getting blank captures. Could anyone provide guidance on further troubleshooting or share alternative methods that might work for capturing the screen in a Wayland + Weston setup?
Thanks in advance for any help!