AsahiLinux / docs

Hardware and software docs / wiki
Other
1.76k stars 49 forks source link

Setting up OpenGL within Flatpaks #121

Open Calinou opened 4 months ago

Calinou commented 4 months ago

On a M1 Mac mini, I have OpenGL working as confirmed by glxinfo and glxgears (8000 FPS in default window size):

OpenGL vendor string: Mesa
OpenGL renderer string: Apple M1 (G13G B1)
OpenGL core profile version string: 4.6 (Core Profile) Mesa 24.1.0-asahi20240228
OpenGL core profile shading language version string: 4.60
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile

However, I've run flatpak install org.sauerbraten.Sauerbraten and despite the game booting up successfully, it's running through llvmpipe (vendor string is printed in the in-game console on startup).

flatpak list outputs:

Name                           Application ID                                Version             Branch               Installation
Freedesktop Platform           org.freedesktop.Platform                      23.08.19            23.08                system
Mesa                           org.freedesktop.Platform.GL.default           24.0.7              23.08                system
Mesa (Extra)                   org.freedesktop.Platform.GL.default           24.0.7              23.08-extra          system
openh264                       org.freedesktop.Platform.openh264             2.1.0               2.2.0                system
Breeze GTK theme               org.gtk.Gtk3theme.Breeze                      6.0.5               3.22                 system
Sauerbraten                    org.sauerbraten.Sauerbraten                   2020_12_29          stable               system

When run from a terminal (flatpak run org.sauerbraten.Sauerbraten), I can see this in stdout:

glx: failed to create dri3 screen
failed to load driver: asahi

Do I need to do something specific to have working OpenGL within Flatpaks? I thought the Mesa Flatpak would take care of everything (like it does on my other Linux machines).

marcan commented 4 months ago

There is no Flatpak support yet as nobody has packaged our Mesa fork as a Flatpak extension yet. Upstream Mesa does not have support for our GPU (and won't until the kernel driver is merged, which is blocked on Rust kernel upstreaming bikeshedding, so we can't do anything to speed that up) so the Mesa that Flatpak ships does not work. There was some work in this direction but it was never completed. Volunteers welcome :)

jannau commented 4 months ago

The main difficulty is to get flatpak-builder to work inside mock which we will need to build the driver in copr. My attempt is in https://github.com/jannau/mesa-asahi-flatpak/tree/fedora-spec which does not build inside mock.