WhitewaterFoundry / Fedora-Remix-for-WSL

Fedora Remix for Windows Subsystem for Linux.
Other
693 stars 51 forks source link

Add Vulkan hardware acceleration for WSL #188

Open shoffmeister opened 1 year ago

shoffmeister commented 1 year ago

Mesa offers Vulkan support, and Microsoft map this, apparently, to "dzn" - experimentally.

Please add "dzn" support to the custom Fedora Remix Mesa packaging, such that vulkaninfo --summary does no longer show only llvmpipe, but exposes the underlying hardware.

See https://forums.developer.nvidia.com/t/enabling-nvidia-support-for-vulkan-on-ubuntu-22-04-through-wsl2/244176/5 for expected output, specifically,e.g.,

GPU id : 0 (Microsoft Direct3D12 (NVIDIA GeForce RTX 4090)):

See https://gitlab.freedesktop.org/mesa/mesa/-/issues/6318#note_1459269 for build and smoketest instructions.

shoffmeister commented 1 year ago

For Fedora's rpmbuild that could be as simple as

- %global platform_vulkan ,intel,intel_hasvk
+ %global platform_vulkan ,intel,intel_hasvk,microsoft-experimental
  %{_libdir}/libvulkan_intel_hasvk.so
  %{_datadir}/vulkan/icd.d/intel_hasvk_icd.*.json
+ # hacky packaging problem - bundle executable together with drivers
+ # avoid touching mesa meson
+ %{_bindir}/spirv2dxil
+ %{_libdir}/libvulkan_dzn.so
+ %{_libdir}/libspirv_to_dxil.so
+ # hacky deployment problem - we don't actually want to deploy the static library
+ # avoid touching mesa meson
+ %{_libdir}/libspirv_to_dxil.a
+ %{_datadir}/vulkan/icd.d/dzn_icd.*.json

Looking at libvulkan_dzn I see plenty of dependencies,

 0x0000000000000001 (NEEDED)             Shared library: [libz.so.1]
 0x0000000000000001 (NEEDED)             Shared library: [libxcb.so.1]
 0x0000000000000001 (NEEDED)             Shared library: [libX11-xcb.so.1]
 0x0000000000000001 (NEEDED)             Shared library: [libxcb-dri3.so.0]
 0x0000000000000001 (NEEDED)             Shared library: [libxcb-present.so.0]
 0x0000000000000001 (NEEDED)             Shared library: [libxcb-xfixes.so.0]
 0x0000000000000001 (NEEDED)             Shared library: [libxcb-sync.so.1]
 0x0000000000000001 (NEEDED)             Shared library: [libxcb-randr.so.0]
 0x0000000000000001 (NEEDED)             Shared library: [libxcb-shm.so.0]
 0x0000000000000001 (NEEDED)             Shared library: [libxshmfence.so.1]
 0x0000000000000001 (NEEDED)             Shared library: [libwayland-client.so.0]
 0x0000000000000001 (NEEDED)             Shared library: [libdrm.so.2]
 0x0000000000000001 (NEEDED)             Shared library: [libexpat.so.1]
 0x0000000000000001 (NEEDED)             Shared library: [libstdc++.so.6]
 0x0000000000000001 (NEEDED)             Shared library: [libm.so.6]
 0x0000000000000001 (NEEDED)             Shared library: [libgcc_s.so.1]
 0x0000000000000001 (NEEDED)             Shared library: [libc.so.6]
 0x000000000000000e (SONAME)             Library soname: [libvulkan_dzn.so]

presenting a (not so lovely) mix between wayland and X11. Not sure whether that will be changed. The build option probably is called microsoft-experimental for a reason ...

crramirez commented 1 year ago

I'll put it in the roadmap. Thanks for the suggestion