Skip to content

Initial support for framebuffer backend

Simon Ser requested to merge github/fork/ollieparanoid/fbdev into master

Created by: ollieparanoid

Allow running modern wlroots based compositors on downstream kernels of old Android phones/tablets. In theory, this makes over a billion devices with hopelessly outdated Android stacks useful again: after swapping out the userspace with postmarketOS + wlroots, they can at least be used for raspberry-pi-with-touchscreen like projects.

It would be best to run mainline Linux on those devices, then run wlroots on DRM instead of framebuffer. We are following this approach in postmarketOS too, but it's too time consuming to be done for more than a small percentage out of the countless Android devices in existence.

Since modern setups won't need this, I've made it opt-in (-Dfbdev-backend=enabled). If somebody is worried about who would maintain this upstream in wlroots: the postmarketOS community and I would be happy to make sure that this keeps on working and gets improved.

Demo

I've tested this on both the Samsung Galaxy SII and Google Nexus 4 and made a video of the latter running Sway and Phosh, with gnome-chess and the kgx terminal app: https://postmarketos.org/static/video/2020-09/wlroots-fbdev-lg-mako.webm

If somebody wants to try it on their phone, see these notes: https://wiki.postmarketos.org/wiki/User:Ollieparanoid/Run_wlroots_with_fbdev

Beyond this PR

Improvements for future patches, that seem to be out of scope for this initial version:

  • Use renderer v6 (#2240, #2374) after related patches are merged and the pixman software renderer (#2399 (closed)) is implemented. This should improve performance, as GL+swrast would not be needed anymore. Furthermore, this will make more framebuffer formats possible. (Right now it's hardcoded to RGBA4, see the related comment in the patch.)
  • wlr_backend_autocreate(): if no DRM devices were found, fall back to fbdev (I've tried this, but after failing to create the DRM backend, the session/wlr_backend can't be reused. So this probably needs further refactoring?)
  • Implement dmabuf extension to make casa work

Questions

  • Should the fbdev backend be decoupled from the logind session? Logind will answer with "No such device" when requesting /dev/fb0 etc. With the current version, logind_take_device just calls open instead of asking logind, if it is a framebuffer device.
  • Anything I'm missing, regarding performance optimizations or otherwise?

Merge request reports

Loading