balena-io-experimental / browser

A drop-in web browser block
96 stars 70 forks source link

Poor WebGL performance on RPi5 #172

Open deregtd opened 4 weeks ago

deregtd commented 4 weeks ago

I'm using the browser module out of the box (v2.7.0) on my 8GB Raspberry Pi 5, with ENABLE_GPU=1 and other such niceties, on a 1080p touchscreen on HDMI, all deployed via balena:

  browser:
    image: bh.cr/balenalabs/browser-aarch64:v2.7.0
    network_mode: host
    privileged: true
    environment:
      LAUNCH_URL: "http://localhost"
      KIOSK: 0
      PERSISTENT: 1
      ENABLE_GPU: 1
      WINDOW_SIZE: 1920,1080
    labels:
      io.balena.features.dbus: "1"
    volumes:
      - browser-data:/data

My application is a webgl-based application that does map rendering, and poor performance (1fps even though the render function takes ~15ms to run) is pointing to something very wrong with the hardware pipeline on the balena block. I then tried doing the basic WebGL Aquarium sample and the browser gets 7-8fps on there with 500 fish (default mode). Even when I disable all the maps so my application is rendering a blank screen with an arrow in the center, it's still only getting 7-8fps (with a render function well below 1ms now).

I've checked chrome://gpu and all the usual stuff is enabled. Other benchmarks on a Pi5 suggest that I should be getting 30-40fps.

Any idea what's up here? It's looking like I'm going to have to bail on having a pi5 power my kiosk and just get a cheap android tablet to hit the website served by the pi remotely.

deregtd commented 2 weeks ago

For any others that come here, I ended up forking the repo to my internal docker build, and just having it kick a build. All I changed was moving the base image to %plat%-debian-node:20-bookworm-run, since the node 16 images haven't been updated as recently as the node 20 ones. From there, it just apt-get installs chromium/mesa, so the rebuild gets latest version of those packages. Boom -- my simple mapping app went from 2-3fps up to 20fps, and the browser is way snappier to use. So, I think just doing a re-release of the package (ideally, updating to node 20) and calling it 2.7.1 would be a big benefit to the community, if anyone's still watching this... (balena feels kinda dead right now, so not sure if anyone is)