Skip to content

asahi: add broken bits of unstable Linux UAPI

Alyssa Rosenzweig requested to merge alyssa/mesa:asahi-uapi-partial-up into main

Rebasing around this patch has been a significant burden for development. Staging patches to asahi/mesa helps somewhat but 1. it's still really frustrating to have this much divergence with upstream, and 2. ideally we wouldn't have to do that.

Sadly, Rust support in the kernel is stalled so our kernel driver isn't getting merged any time soon. This patch adds compile-only code to speak the unstable Linux UAPI for the SOLE purpose of reducing my rebase pain... NOT to actually work.

It is NOT for users OR distro maintainers. asahi will refuse to probe on upstream Mesa to protect against regressions. The uapi is NOT STABLE and upstream Mesa CANNOT be used with it. Attempting to bypass this WILL give you a broken system. DO NOT TRY.

This patch employs several layers of deterrents against system-breaking enablement. Actually getting Mesa to probe on an asahi kernel would require adding definitions to gallium in multiple places and also removing code in several parts of asahi (one part in src/asahi and one part in src/gallium/drivers/asahi). With a lot of warning text at the relevant sites. Hopefully that is good enough to prevent people from breaking systems. And if people brazenly ignore all of the above ... they get to pick up the pieces.

You have been warned.


There is significant prior art for Mesa including downstream kernel uapi supports in-tree:

  • powervr (downstream android driver)
  • turnip (downstream kgsl android driver)
  • asahi ... ironically (prop macOS kernel driver)

Linux is only special because of distros shipping tagged Mesa releases. The several layers of guards here guarantee that no tagged Mesa release would possibly probe even on an asahi downstream kernel. A distro would need a significant scary patch to make it probe. If/when it breaks, that's on them and they pick up the pieces.

I make a stability guarantee ONLY for Fedora Asahi Remix -- where we push packages for both a downstream kernel and Mesa in tandem, while we patiently wait for upstreaming -- and that is it. It will be a nice future when this all works upstream, but unfortunately we're not there yet.

I intend to merge this MR after 1 week (on June 14).

Cc @asahilina @gfxstrand

Edited by Alyssa Rosenzweig

Merge request reports