canonical / flutter-snap

GNU General Public License v3.0
18 stars 8 forks source link

Snap on Ubuntu RPi3 fails to render on Wayland #39

Open AlanGriffiths opened 3 years ago

AlanGriffiths commented 3 years ago

This can be reproduced on Ubuntu Core 20 and Ubuntu Server 20.04

Steps to Reproduce

On desktop

With the demo app and the snapcraft YAML below:

snapcraft remote-build --launchpad-accept-public-upload
scp super-cool-app_0.1.0_arm64.snap <the RPi>:~

on the RPi

If you are reproducing on Ubuntu Server, you need to add kms support. E.g.

sudo echo "dtoverlay=vc4-kms-v3d" >> /boot/firmware/usercfg.txt
sudo reboot
sudo snap install mir-kiosk
sudo snap set mir-kiosk daemon=true # not needed on Core
unsquashfs -d super-cool-app_0.1.0_arm64 super-cool-app_0.1.0_arm64.snap
sudo snap try super-cool-app_0.1.0_arm64
sudo snap set super-cool-app daemon=true # not needed on Core

Expected results: The demo displays correctly Actual results: Only the decorations display

Additional details:

Something goes wrong using the vc4_dri.so driver on ARM64/RPi3

There's a relevant log line:

2021-03-17T17:00:41Z -[16793]: Failed to start Flutter renderer: Unable to create a GL context

Logs can be accessed with:

sudo snap logs super-cool-app

Additional logging can be obtained by editing super-cool-app_0.1.0_arm64/bin/wayland-launch and adding export EGL_LOG_LEVEL=debug before the final exec command.

The problem can be hidden by adding export LIBGL_ALWAYS_SOFTWARE=true in the same place.

snapcraft.yaml ``` name: super-cool-app version: 0.1.0 summary: Super Cool App description: Super Cool App that does everything! architectures: - build-on: amd64 - build-on: arm64 confinement: strict base: core18 grade: stable apps: daemon: daemon: simple restart-condition: always command-chain: - bin/run-daemon - bin/wayland-launch command: bin/flutterdemo extensions: [flutter-master] # Where "master" defines which Flutter channel to use for the build super-cool-app: command-chain: - bin/wayland-launch command: flutterdemo extensions: [flutter-master] # Where "master" defines which Flutter channel to use for the build parts: super-cool-app: plugin: flutter source: flutterdemo flutter-target: lib/main.dart # The main entry-point file of the application mir-kiosk-snap-launch: plugin: dump source: https://github.com/MirServer/mir-kiosk-snap-launch.git override-build: $SNAPCRAFT_PART_BUILD/build-with-plugs.sh opengl pulseaudio wayland stage-packages: - inotify-tools assets: plugin: nil stage-packages: - dmz-cursor-theme - fonts-dejavu - fonts-freefont-ttf - fonts-ubuntu layout: /usr/share/fonts: bind: $SNAP/usr/share/fonts /etc/fonts: bind: $SNAP/etc/fonts /usr/share/icons: bind: $SNAP/usr/share/icons ```
christiancfifi commented 3 years ago

https://github.com/flutter/flutter/issues/76178#issuecomment-818334549 I had this problem also, and I think it is caused by a small issue that we were looking into on the flutter engine github ^

In env.sh LIBGL_DRIVERS_PATH is set to /usr/... instead of $SNAP/usr/...

MarcusTomlinson commented 3 years ago

flutter/flutter#76178 (comment) I had this problem also, and I think it is caused by a small issue that we were looking into on the flutter engine github ^

In env.sh LIBGL_DRIVERS_PATH is set to /usr/... instead of $SNAP/usr/...

This issue is Wayland-specific. I've commented on the linked bug though.