Index | MI024 |
---|---|
Title | MI024 - Migrating GNOME and KDE Snapcraft extensions to gpu-2404 userspace interface |
Status | Pending Review |
Authors | Michał Sawicz |
Type | Implementation |
Created | 2023-03-09 |
Abstract
To improve the graphical snap story and work towards a streamlined graphics support in snaps, migrate the GNOME and KDE Snapcraft extensions to using the gpu-XX04
(previously graphics-coreXX
) content interface.
Rationale
The GNOME and KDE extensions, along with their respective content snaps include userspace drivers (Mesa) to support GPU acceleration (both GL and video) on the standard open source graphics stacks (GBM / KMS). They rely on SnapD support to supply the Nvidia userspace to support the proprietary stack. There are a handful of problems with that approach:
- multiplication of the userspace for each of the content snaps (
gnome-*
,kf6-*
,gpu-XX04
) - lack of support for Nvidia on Ubuntu Core systems
- lack of, or difficult support for other, custom graphics stacks (ARM, Asahi / Apple Silicon)
- maintenance/responsibility of the graphics stack is diluted between all the snaps
The Mir team has solved this problem by way of the graphics-core
, now gpu-XX04
, interfaces, where a separate content snap provides the, possibly platform-specific, content. This specification will define how to move the GNOME and KDE snap stacks onto that approach. The move to base: core24
makes for an ideal pivoting point, avoiding regressions in the existing stack.
This would allow for common handling of the following scenarios:
- new hardware enablement (through
hwe
,asahi
, … tracks formesa-2404
following the kernel track convention, where applicable) - inclusion of non-free userspace (through a
non-free
/hwe-non-free
tracks) - custom graphics stacks (through custom
gpu-2404
provider snaps) - collaborative development of the GPU stack.
Specification
Desktop launchers
https://github.com/snapcore/snapcraft-desktop-integration/
https://github.com/snapcore/snapcraft-desktop-integration/tree/3944bad4ba065a2b6c005760918c226a82ed703b at the time of writing
- remove the
LD_LIBRARY_PATH
additions formesa
andmesa-egl
(these doesn’t exist anywhere) - conditionally, when building for the
gpu-2404
stack:- skip the following exports and their additions to
LD_LIBRARY_PATH
:LIBGL_DRIVERS_PATH
LIBVA_DRIVERS_PATH
VDPAU_DRIVER_PATH
__EGL_VENDOR_LIBRARY_DIRS
- move
$__NV_PRIME_RENDER_OFFLOAD
handling togpu-2404-wrapper
- skip the following exports and their additions to
GNOME
The GNOME snap stack comprises of the components listed below, along with the changes necessary:
- The Snapcraft extension
https://github.com/canonical/snapcraft/blob/686b4e308108422326db5ab176b40b2c9e4f3e66/snapcraft/extensions/gnome.py- key off the
base
value to include gpu-snap integration- add the
gpu-2404
plug - move the
libdrm
layout to the graphics mountpoint - add the
drirc.d
layout (ref. documentation) - prepend
gpu-2404-wrapper
to the command chain - (1) add a cleanup step (ref. canonical/snapcraft#4288)
- add the
- key off the
- The GNOME SDK snap
https://github.com/ubuntu/gnome-sdk/tree/gnome-46-2404-sdk/
https://github.com/ubuntu/gnome-sdk/tree/1093d96e5008d7e7e86a226568613c936f5a009f at the time of writing- remove parts overlapping with
gpu-2404
:wayland
libva
intel-gmm
intel-media-driver
- add
libwayland-dev
andlibva-dev
asstage-packages:
- (3) work out a plan for hardware enablement through
mesa-2404
- remove parts overlapping with
- The GNOME runtime snap
https://github.com/ubuntu/gnome-sdk/tree/gnome-46-2404/
https://github.com/ubuntu/gnome-sdk/tree/01467172ac12b2352faf4c6cfecef46139cbd8b0 at the time of writing- use the gpu-snap provided cleanup snippet
- use the cleaned up
gpu-2404
desktop launcher - remove libraries overlapping with
gpu-2404
:libgl1
libgl-mesa-dri
libwayland-client0
libwayland-egl1
libwayland-egl-wayland1
libxcb-shm0
libxcb1
mesa-va-drivers
i965-va-driver
intel-media-va-driver
- move additional libraries to the
mesa-2404
snap:libgles1
libva-glx2
KDE
- The Snapcraft extension
https://github.com/canonical/snapcraft/pull/4698- same as above for the GNOME extension
- migrate to the “lightweight” command-chain
- The KDE Frameworks 6 SDK snap
https://invent.kde.org/neon/snap-packaging/kf6-snap- remove the
mesa-no-patchelf
part - remove
libwayland-client0
stage fromkguiaddons
,kwayland
parts
- remove the
- The KDE Qt6 SDK snap
https://invent.kde.org/neon/snap-packaging/kde-qt6-snap/- remove content overlapping with
gpu-2404
:libxcb-glx0
libdrm-common
libgl1-mesa-glx
libxcb-dri2-0
libgl1
libgles2-mesa
libxcb1
libxcb-randr0
libgbm1
libxcb-shm0
libxcb-sync1
libglx0
libx11-xcb1
libvulkan1
libxcb-render0
libxcb-xfixes0
libwayland-server0
libgles1
libxext6
- remove content overlapping with
- https://invent.kde.org/neon/snap-packaging/kf6-snap-runtime
- use the gpu-snap provided cleanup snippet
- use the cleaned up
gpu-2404
desktop launcher - remove the
mesa
part - remove libraries overlapping with
gpu-2404
:libdrm-dev
mesa-va-drivers
i965-va-driver
intel-media-va-driver
Open questions
(1): Should a cleanup step be added to the extension, pruning the consumer snap of content expected to be found in the provider snap? There’s some precedent in Snapcraft, but is there an established approach?
(2): Should the command-chain vendored into Snapcraft be modified - or is it legacy only?
(3): What tracks for the mesa-2404
snap (some options mentioned in Rationale above) should be maintained?
Testing
Applications built using these stacks need to be selected for each of the extensions to exercise whenever either the runtime or the mesa-2404
snap receive an update. There’s existing tooling for this in the checkbox-mir
snap and the certification team’s infrastructure that can be extended. Any existing testing should be amended to take this change into account.
Further Information
The graphical userspace handling is likely to move towards SnapD and / or the kernel snap (because the userspace is often tied to the kernel), but the above approach could continue to work, with the kernel snap slotting the gpu-2404
interface, exposing the userspace appropriate for the system - or SnapD supplying it to snaps implicitly. The userspace would likely follow the path of the Nvidia driver, getting installed as a kernel snap component. Details are out of scope for this specification.
Spec History and Changelog
Date | Status | Author(s) | Comment |
---|---|---|---|
2024-04-18 | Pending Review | Michał Sawicz | Resolved (2) |
2024-04-19 | Pending Review | Michał Sawicz | Introduced gpu-2404 documentation |
2024-04-19 | Pending Review | Michał Sawicz | Dropped wrapper mentions from runtime snaps |