Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vulkan support? #244

Closed
johnbchron opened this issue Oct 21, 2024 · 19 comments
Closed

Vulkan support? #244

johnbchron opened this issue Oct 21, 2024 · 19 comments

Comments

@johnbchron
Copy link

HoneyKrisp is released, so I was wondering what steps need to be taken to port this over here, and what I can do to help.

My knowledge of this is pretty much "we need to update our mesa branch and update some kernel flags or smth, right?" so I don't know much, but I am very willing to help.

@waltmck
Copy link

waltmck commented Oct 22, 2024

I've been using this fork from @zzywysm, which has had Vulkan support for a couple of weeks. It also includes several noticeable performance improvements which could not be upstreamed, notably:

  • compile-time architecture optimizations since we are already building from source
  • disabling several unnecessary modules to decrease boot time
  • Using the recommended IO scheduler for NVME drives
  • Building the Asahi kernel modules into the kernel rather than loading them as modules.

It has been pretty much plug and play after I updated my CPU features list to the M2's. Boot times are decreased and I've noticed longer battery life, so until @tpwrules adds Vulkan support I recommend trying it! It should be clear how to add Honeykrisp to the kernel from looking at that repo.

There is also the separate, and more difficult, issue of how to package Fedora's userspace microvm/FEX/WINE/DXVK stack--I have been struggling to get this to work. Right now only running (a specific version of) Steam is supported and my impression is that it still fairly buggy, so it might make sense to wait until it is in a less-alpha state to consider packaging.

@matteocavestri
Copy link

@waltmck How did you packaged MicroVM/FEX/WINE/DXVK? I've looked to the fork you mentioned, but I've not found it. I've also looked at your fork and your config.
We can package that stack in this repo using something like ...wineSupport.enable to enable that microVM

@rowanG077
Copy link
Contributor

@matteocavestri Nothing you listed is packaged. Those have nothing to do with vulkan support.

@matteocavestri
Copy link

@rowanG077 I know it, but @waltmck spoke about that stack and It could be interesting to adopt here since fedora asahi remix have packaged that.

@waltmck
Copy link

waltmck commented Oct 24, 2024

@matteocavestri I haven't tried packaging "the right way" with Nix, but should be possible to get working in a Fedora distrobox with their packaging (and I managed to run Steam with FEX and the microvm this way). However, I haven't had time to figure out why mesa drivers are not visible inside of the container (I tried symlinking in several different files from the Nix store but glxinfo -B still fails to load Honeykrisp and falls back to llvmpipe).

@foldfree

This comment was marked as resolved.

@oliverbestmann
Copy link
Contributor

oliverbestmann commented Oct 26, 2024

You can also try my fork, vulkan works perfectly (e.g zeditor now runs). Contrary to zzywysm, I have not changed anything from tpwrules repository, except mesa & kernel.

@foldfree

This comment was marked as resolved.

@oliverbestmann
Copy link
Contributor

What problem do you have? This looks fine. If you want to try vulkan you can run vkgears -info

@foldfree

This comment was marked as resolved.

@oliverbestmann
Copy link
Contributor

I can compare once I am home. My efi stub is from a similar time. I assume you're on Wayland, not in xorg? I am using gnome as compositor.

@foldfree

This comment was marked as resolved.

@oliverbestmann
Copy link
Contributor

The vkgears output is exactly the same, except mine is a m1 pro, not a m2. I will push an update to nixpkgs & kernel soonish, maybe that helps.

@oliverbestmann
Copy link
Contributor

Updated the fork to use nixpkgs 41dea55321e5a999b17033296ac05fe8a8b5a257 as well as the most recent kernel.

@foldfree
Copy link

thank you i successfully updated, in the meantime I found the issue!
hyprwm/Hyprland#8158 (comment)
this is needed for honeykrisp to load in hyprland:

render {
    explicit_sync = 0
}

Thanks for helping, without you i assumed there was something wrong with my nix config and didn’t thought i had to tweak some obscure option in hyprland.

@matteocavestri
Copy link

matteocavestri commented Oct 29, 2024

@matteocavestri I haven't tried packaging "the right way" with Nix, but should be possible to get working in a Fedora distrobox with their packaging (and I managed to run Steam with FEX and the microvm this way). However, I haven't had time to figure out why mesa drivers are not visible inside of the container (I tried symlinking in several different files from the Nix store but glxinfo -B still fails to load Honeykrisp and falls back to llvmpipe).

@waltmck To use Vulkan, you need to use the Asahi Mesa drivers within the Fedora container. I've tested this with fedora:40 and fedora:rawhide, and it works without issues. I wrote a bash script because some parameters need to be modified from the default Copr repo to install the multilib x86_64 and i386 drivers:

#!/bin/bash
sudo dnf upgrade --refresh
sudo dnf install 'dnf-command(copr)'

# Asahi Mesa (Optional: Change the filename according to your release)
cat <<EOF | sudo tee /etc/yum.repos.d/group_asahi-mesa-fedora-rawhide.repo > /dev/null
[copr:copr.fedorainfracloud.org:group_asahi:mesa]
name=Copr repo for mesa owned by @asahi
baseurl=https://download.copr.fedorainfracloud.org/results/@asahi/mesa/fedora-\$releasever-\$basearch/
type=rpm-md
skip_if_unavailable=True
gpgcheck=1
gpgkey=https://download.copr.fedorainfracloud.org/results/@asahi/mesa/pubkey.gpg
repo_gpgcheck=0
enabled=1
enabled_metadata=1
EOF

# Asahi Mesa x86_64 & i386 (Optional: Change the filename according to your release)
cat <<EOF | sudo tee /etc/yum.repos.d/group_asahi-mesa-fedora-rawhide-x86.repo > /dev/null

[copr:copr.fedorainfracloud.org:group_asahi:mesa:x86_64]
name=Copr repo for mesa owned by @asahi (x86_64)
baseurl=https://download.copr.fedorainfracloud.org/results/@asahi/mesa/fedora-\$releasever-x86_64/
type=rpm-md
skip_if_unavailable=True
gpgcheck=1
gpgkey=https://download.copr.fedorainfracloud.org/results/@asahi/mesa/pubkey.gpg
repo_gpgcheck=0
enabled=1
enabled_metadata=1

[copr:copr.fedorainfracloud.org:group_asahi:mesa:ml]
name=Copr repo for mesa owned by @asahi (i386)
baseurl=https://download.copr.fedorainfracloud.org/results/@asahi/mesa/fedora-\$releasever-i386/
type=rpm-md
skip_if_unavailable=True
gpgcheck=1
gpgkey=https://download.copr.fedorainfracloud.org/results/@asahi/mesa/pubkey.gpg
repo_gpgcheck=0
cost=1100
enabled=1
enabled_metadata=1
EOF

# Enable Asahi Steam Repository
sudo dnf copr enable @asahi/steam
sudo dnf upgrade --refresh

# Install Steam
sudo dnf install steam

This setup provides working Mesa drivers and the Asahi-packaged version of Steam. If it helps, I also have benchmark comparisons between vkmark and glmark2 on the host and within Distrobox (macmini 2020 M1 8GB):

Host Distrobox
glmark2 4597 3895
vkmark 5773 5429

The only remaining issue is linking libc.so.6 within the microVM and FEX to launch Steam. Maybe you've already managed to address this, as you've previously mentioned. Log for reference:

bin_steam.sh[276]: Setting up Steam content in /home/matteocavestri/Container/distrobox/fedora-steam-test/.local/share/Steam
steam.sh[276]: Running Steam on fedora 40 64-bit
steam.sh[276]: STEAM_RUNTIME is enabled automatically
setup.sh[360]: Updating Steam runtime environment...
 100%   
/home/matteocavestri/Container/distrobox/fedora-steam-test/.local/share/Steam/ubuntu12_32/steam-runtime/run.sh: line 85: steam-runtime-identify-library-abi: command not found
run.sh[3185]: steam-runtime-identify-library-abi --ldconfig-paths failed, falling back to ldconfig
steam.sh[276]: Couldn't find /home/matteocavestri/Container/distrobox/fedora-steam-test/.local/share/Steam/ubuntu12_32/steam-runtime/amd64/usr/bin/srt-logger, logging to console-linux.txt
steam.sh[276]: Error: You are missing the following 32-bit libraries, and Steam may not run:
libc.so.6
Error:
You are missing the following 32-bit libraries, and Steam may not run:
libc.so.6

P.S. I know this discussion focuses on Vulkan, but since it’s somewhat resolved, this thread seems quite relevant to Vulkan support, especially as it’s been promoted by the Asahi community.

@Lederstrumpf
Copy link

@matteocavestri I haven't tried packaging "the right way" with Nix, but should be possible to get working in a Fedora distrobox with their packaging (and I managed to run Steam with FEX and the microvm this way). However, I haven't had time to figure out why mesa drivers are not visible inside of the container (I tried symlinking in several different files from the Nix store but glxinfo -B still fails to load Honeykrisp and falls back to llvmpipe).

@waltmck To use Vulkan, you need to use the Asahi Mesa drivers within the Fedora container. I've tested this with fedora:40 and fedora:rawhide, and it works without issues. I wrote a bash script because some parameters need to be modified from the default Copr repo to install the multilib x86_64 and i386 drivers:

#!/bin/bash
sudo dnf upgrade --refresh
sudo dnf install 'dnf-command(copr)'

# Asahi Mesa (Optional: Change the filename according to your release)
cat <<EOF | sudo tee /etc/yum.repos.d/group_asahi-mesa-fedora-rawhide.repo > /dev/null
[copr:copr.fedorainfracloud.org:group_asahi:mesa]
name=Copr repo for mesa owned by @asahi
baseurl=https://download.copr.fedorainfracloud.org/results/@asahi/mesa/fedora-\$releasever-\$basearch/
type=rpm-md
skip_if_unavailable=True
gpgcheck=1
gpgkey=https://download.copr.fedorainfracloud.org/results/@asahi/mesa/pubkey.gpg
repo_gpgcheck=0
enabled=1
enabled_metadata=1
EOF

# Asahi Mesa x86_64 & i386 (Optional: Change the filename according to your release)
cat <<EOF | sudo tee /etc/yum.repos.d/group_asahi-mesa-fedora-rawhide-x86.repo > /dev/null

[copr:copr.fedorainfracloud.org:group_asahi:mesa:x86_64]
name=Copr repo for mesa owned by @asahi (x86_64)
baseurl=https://download.copr.fedorainfracloud.org/results/@asahi/mesa/fedora-\$releasever-x86_64/
type=rpm-md
skip_if_unavailable=True
gpgcheck=1
gpgkey=https://download.copr.fedorainfracloud.org/results/@asahi/mesa/pubkey.gpg
repo_gpgcheck=0
enabled=1
enabled_metadata=1

[copr:copr.fedorainfracloud.org:group_asahi:mesa:ml]
name=Copr repo for mesa owned by @asahi (i386)
baseurl=https://download.copr.fedorainfracloud.org/results/@asahi/mesa/fedora-\$releasever-i386/
type=rpm-md
skip_if_unavailable=True
gpgcheck=1
gpgkey=https://download.copr.fedorainfracloud.org/results/@asahi/mesa/pubkey.gpg
repo_gpgcheck=0
cost=1100
enabled=1
enabled_metadata=1
EOF

# Enable Asahi Steam Repository
sudo dnf copr enable @asahi/steam
sudo dnf upgrade --refresh

# Install Steam
sudo dnf install steam

This setup provides working Mesa drivers and the Asahi-packaged version of Steam. If it helps, I also have benchmark comparisons between vkmark and glmark2 on the host and within Distrobox (macmini 2020 M1 8GB):
Host Distrobox
glmark2 4597 3895
vkmark 5773 5429

The only remaining issue is linking libc.so.6 within the microVM and FEX to launch Steam. Maybe you've already managed to address this, as you've previously mentioned. Log for reference:

bin_steam.sh[276]: Setting up Steam content in /home/matteocavestri/Container/distrobox/fedora-steam-test/.local/share/Steam
steam.sh[276]: Running Steam on fedora 40 64-bit
steam.sh[276]: STEAM_RUNTIME is enabled automatically
setup.sh[360]: Updating Steam runtime environment...
 100%   
/home/matteocavestri/Container/distrobox/fedora-steam-test/.local/share/Steam/ubuntu12_32/steam-runtime/run.sh: line 85: steam-runtime-identify-library-abi: command not found
run.sh[3185]: steam-runtime-identify-library-abi --ldconfig-paths failed, falling back to ldconfig
steam.sh[276]: Couldn't find /home/matteocavestri/Container/distrobox/fedora-steam-test/.local/share/Steam/ubuntu12_32/steam-runtime/amd64/usr/bin/srt-logger, logging to console-linux.txt
steam.sh[276]: Error: You are missing the following 32-bit libraries, and Steam may not run:
libc.so.6
Error:
You are missing the following 32-bit libraries, and Steam may not run:
libc.so.6

P.S. I know this discussion focuses on Vulkan, but since it’s somewhat resolved, this thread seems quite relevant to Vulkan support, especially as it’s been promoted by the Asahi community.

Hi @matteocavestri, thanks for sharing this setup - I get comparable benchmarks with glmark2 & vkmark running in distrobox. I can also get steam running with it & launch games, but it's failing to load the asahi driver due to UABI mismatches on nixos-unstable. Tried with fedora-{40,41,rawhide} & with/without --init.

Is this something anyone's run into recently too?
Log below:

> steam
Using default interface naming scheme 'v257'.
steam.sh[315]: Running Steam on fedora 40 64-bit
steam.sh[315]: STEAM_RUNTIME is enabled automatically
setup.sh[364]: Steam runtime environment up-to-date!
steam.sh[315]: Steam client's requirements are satisfied
CProcessEnvironmentManager is ready, 6 preallocated environment variables.
[2024-12-21 14:08:23] Startup - updater built Dec  2 2024 21:26:10
[2024-12-21 14:08:23] Startup - Steam Client launched with: '[...]/.local/share/Steam/ubuntu12_32/steam' '-srt-logger-opened'
12/21 14:08:23 minidumps folder is set to /tmp/dumps
12/21 14:08:23 Init: Installing breakpad exception handler for appid(steam)/version(1733265492)/tid(423)
UABI mismatch: Kernel 1, Mesa 10011
glx: failed to create dri3 screen
failed to load driver: asahi
UABI mismatch: Kernel 1, Mesa 10011
glx: failed to create dri3 screen
failed to load driver: asahi
Looks like steam didn't shutdown cleanly, scheduling immediate update check
[2024-12-21 14:08:24] Loading cached metrics from disk ([...]/.local/share/Steam/package/steam_client_metrics.bin)
[2024-12-21 14:08:24] Using the following download hosts for Public, Realm steamglobal
[2024-12-21 14:08:24] 1. https://client-update.fastly.steamstatic.com, /, Realm 'steamglobal', weight was 900, source = 'update_hosts_cached.vdf'
[2024-12-21 14:08:24] 2. https://client-update.akamai.steamstatic.com, /, Realm 'steamglobal', weight was 100, source = 'update_hosts_cached.vdf'
[2024-12-21 14:08:24] 3. https://client-update.steamstatic.com, /, Realm 'steamglobal', weight was 1, source = 'baked in'
[2024-12-21 14:08:24] Checking for update on startup
[2024-12-21 14:08:24] Checking for available updates...
[2024-12-21 14:08:24] Downloading manifest: https://client-update.fastly.steamstatic.com/steam_client_ubuntu12
[2024-12-21 14:08:24] Manifest download: send request
[2024-12-21 14:08:24] Manifest download: waiting for download to finish
[2024-12-21 14:08:24] Manifest download: finished
[2024-12-21 14:08:24] Download skipped: /steam_client_ubuntu12 version 1733265492, installed version 1733265492, existing pending version 0
[2024-12-21 14:08:24] Nothing to do
[2024-12-21 14:08:24] Verifying installation...
[2024-12-21 14:08:24] Performing checksum verification of executable files
[2024-12-21 14:08:26] Verification complete
UpdateUI: skip show logo
Steam logging initialized: directory:[...]/.local/share/Steam/logs

pcilib: Cannot open /proc/bus/pci
lspci: Cannot find any working access method.
XRRGetOutputInfo Workaround: initialized with override: 0 real: 0xf5bb1e90
XRRGetCrtcInfo Workaround: initialized with override: 0 real: 0xf5bb05f0

@EdvardSire
Copy link

Thank you all for the great information in this thread. I'm trying to run matteocavestri's script, but have not had success.

I've run:

distrobox create --init --image fedora:40 --additional-packages "systemd"

(I've also tested with rawhide)
then run the script above in the container. Afterward i run steam and get

> steam 
Using default interface naming scheme 'v257'.
steam.sh[289]: Running Steam on fedora 42 64-bit
steam.sh[289]: STEAM_RUNTIME is enabled automatically
setup.sh[367]: Steam runtime environment up-to-date!
/home/user/.local/share/Steam/ubuntu12_32/steam-runtime/run.sh: line 85: steam-runtime-identify-library-abi: command not found
run.sh[379]: steam-runtime-identify-library-abi --ldconfig-paths failed, falling back to ldconfig
steam.sh[289]: Couldn't find /home/user/.local/share/Steam/ubuntu12_32/steam-runtime/amd64/usr/bin/srt-logger, logging to console-linux.txt
steam.sh[289]: Can't find 'steam-runtime-check-requirements', continuing anyway
[2025-01-02 20:21:43] Startup - updater built Jul 16 2024 23:21:18
[2025-01-02 20:21:43] Startup - Steam Client launched with: '/home/user/.local/share/Steam/ubuntu12_32/steam'
ILocalize::AddFile() failed to load file "public/steambootstrapper_english.txt".
src/steamexe/updateui_xwin.cpp (1466) : BFileExists( m_FontFileRegular )
src/steamexe/updateui_xwin.cpp (1466) : BFileExists( m_FontFileRegular )
01/02 20:21:43 minidumps folder is set to /tmp/dumps
01/02 20:21:43 Init: Installing breakpad exception handler for appid(steam)/version(1.0)/tid(420)
01/02 20:21:43 Failed writing minidump, nothing to upload.
src/steamexe/updateui_xwin.cpp (1467) : BFileExists( m_FontFileLight )
src/steamexe/updateui_xwin.cpp (1467) : BFileExists( m_FontFileLight )
01/02 20:21:43 minidumps folder is set to /tmp/dumps
01/02 20:21:43 Init: Installing breakpad exception handler for appid(steam)/version(1.0)/tid(420)
01/02 20:21:43 Failed writing minidump, nothing to upload.
01/02 20:21:43 minidumps folder is set to /tmp/dumps
01/02 20:21:43 Init: Installing breakpad exception handler for appid(steam)/version(0)/tid(420)
[2025-01-02 20:21:43] Loading cached metrics from disk (/home/user/.local/share/Steam/package/steam_client_metrics.bin)
[2025-01-02 20:21:43] Failed to load cached hosts file (File 'update_hosts_cached.vdf' not found), using defaults
[2025-01-02 20:21:43] Using the following download hosts for Public, Realm steamglobal
[2025-01-02 20:21:43] 1. https://cdn.steamstatic.com, /client/, Realm 'steamglobal', weight was 1, source = 'baked in'
[2025-01-02 20:21:43] Verifying installation...
[2025-01-02 20:21:43] Unable to read and verify install manifest /home/user/.local/share/Steam/package/steam_client_ubuntu12.installed
[2025-01-02 20:21:43] Verification complete
[2025-01-02 20:21:43] Downloading Update...
[2025-01-02 20:21:43] Checking for available update...
[2025-01-02 20:21:43] Downloading manifest: https://cdn.steamstatic.com/client/steam_client_ubuntu12
[2025-01-02 20:21:43] Manifest download: send request
[2025-01-02 20:21:44] Manifest download: waiting for download to finish
[2025-01-02 20:21:54] Manifest download: finished
[2025-01-02 20:21:54] Download failed: http error 0 (cdn.steamstatic.com/client/steam_client_ubuntu12)
[2025-01-02 20:21:54] DownloadManifest - exhausted list of download hosts
[2025-01-02 20:21:54] failed to load manifest from buffer.
[2025-01-02 20:21:54] Failed to load manifest
[2025-01-02 20:21:54] Error: Download failed: http error 0
[2025-01-02 20:21:54] Saving metrics to disk (/home/user/.local/share/Steam/package/steam_client_metrics.bin)
[2025-01-02 20:21:54] Error: Steam needs to be online to update.	 Please confirm your network connection and try again.
UpdateUI: skip show logo[2025-01-02 20:21:55] Shutdown
src/tier0/threadtools.cpp (3465) : Assertion Failed: Illegal termination of worker thread 'Thread(0x0xab223110/0x0xed41eb'
src/tier0/threadtools.cpp (3465) : Assertion Failed: Illegal termination of worker thread 'Thread(0x0xab223110/0x0xed41eb'
01/02 20:21:56 minidumps folder is set to /tmp/dumps
01/02 20:21:56 Init: Installing breakpad exception handler for appid(steam)/version(1.0)/tid(420)
01/02 20:21:56 Failed writing minidump, nothing to upload.
Steam quit
Aborting
Qt says we're gone, aborting=True

I guess there are multiple problems here, but the most annoying is

[2025-01-02 20:21:54] Error: Steam needs to be online to update.	 Please confirm your network connection and try again.

that the steam updater doesn't get internet.

This problem have been discussed multiple times over on reddit (supposed dhcp-client problem).

It seems like the same problem as AsahiLinux/muvm#77 (which waits for AsahiLinux/muvm#111).

Did you face any of these problems @Lederstrumpf ?

@tpwrules
Copy link
Owner

Vulkan support should be working for a bit now. Please open a new issue if you encounter problems. The emulation stack is not officially supported by this repo yet, but there's not any intrinsic reason it wouldn't work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants