GLFW / Vulkan applications crash on imx8mp with wlroots based WM (like sway and cage)

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

GLFW / Vulkan applications crash on imx8mp with wlroots based WM (like sway and cage)

1,821 Views
KailoKyra
Contributor II

I'm trying to use another WM than Weston with the Imx8mp as I'm trying to use an implementation of xdg-desktop-portal for screencasting using pipewire and the hardware encoder, for an application that has to run in "kiosk mode".

"Cage" (or "Sway") are window managers that are build on top of wlroots, and thus would allow me to use the xdg-desktop-portal-wlr implementation.

It works fine on PC during my tests, either with simple example programs or my own application, but fails on the imx8mp board. Even the test programs provided by NXP in /opt/imx-gpu-viv/GLES2 GLES3 or Vulkan are unfortunately failing to run and end up segfaulting when creating the window. Notable exception, something like weston-terminal works fine (not sure 

On my own program, I traced the crash, and it happens during the creation of the window (glfwCreateWindow), and more specifically down the line, in wl_proxy_set_queue due to an invalid structure pointer passed by something in the libEGL.so (which is in a closed source blob provided by imx-gpu-viv if I'm not mistaken ?). I can't debug it blindly further. I've spent quite some time trying different things, and searching the web for leads on similar issues or potentials workarounds without success.

It's the same issue than this user talked about a few months ago : https://community.nxp.com/t5/i-MX-Processors/glfw-apps-crash-when-used-with-wlroots-based-compositor... . I'm also using the NXP BSP / yocto kirkstone, and tried both on the official evaluation kit (EVK) and our a board of our own design.

Someone had the same issue at Toradex a month ago : https://community.toradex.com/t/opengl-not-working-on-wlroots-based-compositor/18238/3

Have anyone managed to run an application on a wlroots based WM on the imx8mp ? The program starts and works fine on weston, but I need to use a wlroots-based compositor.

Thanks,

0 Kudos
7 Replies

1,806 Views
Zhiming_Liu
NXP TechSupport
NXP TechSupport

Hi @KailoKyra 

Can you share the details build steps for me to reproduce this issue on EVK and BSP? 

0 Kudos

1,802 Views
KailoKyra
Contributor II

Hi,

Sure, basically, add sway / cage / whatever other packet is needed.

IMAGE_INSTALL:append = " sway cage xdg-desktop-portal-wlr "

Then (I know it's not clean, it's just for testing purposes / simplicity for this example) :

Remove the weston.service service and what depends on it so that it doesn't start automatically.

useradd -m -p test -d /home/test test

chmod 0777 /dev/tty*

usermod -a -G video,tty,input test

su test

cd /home/test

export XDG_RUNTIME_DIR=/home/test/

 

You can now run your program with cage or sway. 

With cage :

cage your_program_here (eg: "cage /opt/imx-gpu-sdk/Vulkan/Triangle/Vulkan.Triangle_Wayland" result in a crash, but "cage weston-terminal" works fine)

With sway :

sway&

export WAYLAND_DISPLAY=wayland-1

your_program_here (eg: "/opt/imx-gpu-sdk/Vulkan/Triangle/Vulkan.Triangle_Wayland" result in a crash, but "weston-terminal" works fine)

 

Thanks,

 

EDIT: I tested with another wlroots based WM called "wayfire", this time a stacked WM like weston, not tiled or fullscreen. And it exhibit the exact same issue.

0 Kudos

1,753 Views
Zhiming_Liu
NXP TechSupport
NXP TechSupport

Hi @KailoKyra 

Do you miss some steps for creating user?

I got below issue:

test@imx8mp-lpddr4-evk:~$ cage weston-terminal
00:00:00.001 [libseat] [common/terminal.c:195] Could not set VT mode to enable process switching: Operation not permitted
00:00:00.002 [libseat] [common/terminal.c:235] Could not set KD keyboard mode to disabled: Operation not permitted
00:00:00.002 [libseat] [common/terminal.c:262] Could not set KD graphics mode to graphics: Operation not permitted
00:00:00.005 [libseat] [seatd/seat.c:271] Could not open file: Permission denied
00:00:00.005 [libseat] [seatd/client.c:210] Could not open device: Permission denied
00:00:00.005 [backend/session/session.c:322] Failed to open device: '/dev/dri/card0': Permission denied
00:00:00.007 [libseat] [seatd/seat.c:271] Could not open file: Permission denied
00:00:00.007 [libseat] [seatd/client.c:210] Could not open device: Permission denied
00:00:00.007 [backend/session/session.c:322] Failed to open device: '/dev/dri/card1': Permission denied
00:00:00.008 [backend/backend.c:217] Found 0 GPUs, cannot create backend
00:00:00.008 [backend/backend.c:386] Failed to open any DRM device
00:00:00.008 [libseat] [common/terminal.c:195] Could not set VT mode to enable process switching: Operation not permitted
00:00:00.008 [libseat] [common/terminal.c:235] Could not set KD keyboard mode to enabled: Operation not permitted
00:00:00.008 [libseat] [common/terminal.c:262] Could not set KD graphics mode to text: Operation not permitted
00:00:00.008 [../git/cage.c:302] Unable to create the wlroots backend

 

0 Kudos

1,747 Views
KailoKyra
Contributor II

Right, little command format error on usermod, as it lacked the video and tty group, should be

usermod -a -G video,tty,input test

I've edited the post to reflect the change.

0 Kudos

1,695 Views
Zhiming_Liu
NXP TechSupport
NXP TechSupport

Hi @KailoKyra 

Indeed, the Vulkan and OpenGLES applications will crash with wlroots. This may be caused by the incompatibility of the gpu-viv driver and the mesa driver protocol. Since we do not support the wlroots,you can try Gnome desktop:

https://www.nxp.com/webapp/Download?colCode=L5.15.32_2.0.0_Desktop_POC_Docs

0 Kudos

1,664 Views
KailoKyra
Contributor II

Thanks for your reply and your confirmation of the issue with the driver.

NXP may not support wlroots, but that's still a big issue that will need to be addressed as it's impacting quite a lot of stuff (and still a bug on gpu-viv side that only NXP can fix as it's closed source).

Do you know if that's something that might be addressed in a later update ? Is there a public bugtracker on which we could report the issue ?

Using gnome-desktop is problematic for several reasons. First because it has X11 dependencies, it needs polkit and with a lot of other stuff in dependencies, and also because its implementation of xdg-desktop-portal(-gtk) requires user interaction when starting a screencast session, which is not the case with xdg-desktop-portal-wlr. (It will need to be manually patched).

As the goal is to have the application running in "kiosk mode". I temporarily bypassed the issue by having a RDP session activated with weston at startup but that's ugly and unacceptable performance-wise.

0 Kudos

1,659 Views
Zhiming_Liu
NXP TechSupport
NXP TechSupport

Hi @KailoKyra 

I can report this issue and the RD team will evaluate and decide whether to fix the problem.

Best Regards

Zhiming