Dozen support for WSL
Hi,
few days tried compiling Dozen based on Mesa master on Windows native and on WSL..
Dozen target compiled OK on Windows but Dozen compilation fails under WSL(Linux)..
hope there is plan to enable support for that so we have an early GPU accelerated Vulkan driver supported under WSL..
thanks.
- Show closed items
Activity
-
Newest first Oldest first
-
Show all activity Show comments only Show history only
- Oscar Barenys changed the description
changed the description
- Contributor
It'd probably be helpful if you included your build info, log and the failure
==> Please provide instructions on how to compile Dozen in WSL2 Ubuntu 20.04 and test it e.g. vkcube.
My goal is to get Godot4 vulkan working.
Other relevant info:
=========================================================================
Vulkan
VK_ICD_FILENAMES="$MESA_INSTALLDIR/share/vulkan/icd/my_icd.json" vulkaninfo
where my_icd.json is replaced with the actual ICD json file name. This will depend on your driver. For instance, the 64-bit lavapipe driver ICD file is named lvp_icd.x86_64.json.
https://github.com/pal1000/mesa-dist-win/blob/master/buildinfo/msvc.txt
Dozen support for WSL
Build mesa for WSL Ubuntu 18.04 or 20.04
Open WSL with Ubuntu 18.04 or 20.04.
-
Update and install needed packages for development.
sudo apt update sudo apt install build-essential git python3-pip pkg-config llvm \ valgrind vainfo bison flex llvm libdrm-dev libxdamage-dev libx11-dev \ libx11-xcb-dev libxext-dev libxcb-glx0-dev libxcb-dri2-0-dev \ libxcb-dri3-dev libxcb-present-dev libxcb-shm0-dev libxshmfence-dev \ libxxf86vm-dev x11-xserver-utils libxrandr-dev
-
Setup python
-
Environment vars
alias python=python3 && alias pip=pip3 && export PATH=~/.local/bin:$PATH
-
Install python3 packages.
pip install meson ninja cmake mako
-
-
Get this repo and prepare for build env
- Get this repo
git clone https://github.com/gnsmrky/wsl-vulkan-mesa
- Change directory to the repo and create & change to
build
folder.cd wsl-vulkan-mesa mkdir build cd build
- Get this repo
-
In
build
folder, config & build mesa.-
This sets the target folder at
/usr
.meson -Dprefix=/usr -Ddri-drivers= -Dglx=dri -Dllvm=enabled \ -Ddri-drivers-path=/usr/local/lib/x86_64-linux-gnu/dri \ -Dgallium-drivers="swrast" -Dplatforms=x11 -Dosmesa=gallium \ -Dvulkan-drivers=swrast ..
-
Build mesa
ninja
-
Install mesa to target folder
~/mesa-local
.
DESTDIR=~/mesa-local ninja install
-
Update
``` meson -Dprefix=/usr -Ddri-drivers= -Dglx=dri -Dllvm=enabled \ -Ddri-drivers-path=/usr/local/lib/x86_64-linux-gnu/dri \ -Dgallium-drivers="swrast" -Dplatforms=x11 -Dosmesa=gallium \ -Dvulcan-drivers=microsoft-experimental .. ```
Edited by GeorgeS2019-
- Contributor
Again, that doesn't tell me what your build failure was, the output of the meson command and the ninja command will hopefully help
The above meson command doesn't look like dozen was enabled
- Contributor
It looks like -Dvulcan-drivers=microsoft-experimental would be required
@FireBurn => keep getting
fatal error: windows.h: No such file or directory 35 | #include "windows.h"
In file included from ../subprojects/DirectX-Headers-1.0/include/directx/d3d12.h:473, from ../src/microsoft/vulkan/dzn_nir.h:28, from ../src/microsoft/vulkan/dzn_private.h:49, from ../src/microsoft/vulkan/dzn_descriptor_set.cpp:24: ../subprojects/DirectX-Headers-1.0/include/directx/d3dcommon.h:35:10: fatal error: windows.h: No such file or directory 35 | #include "windows.h"
For people trying, please read this
Use on WSL
Note: WSL support is not intended for general purpose application development. At this time, the only recommended usage is for frameworks wishing to provide hardware acceleration for a Linux graphics/compute API in a WSL2 virtualization environment.
Note: WSL support is only available for 64-bit binaries.
The headers in the
/include/wsl
directory provide alternative definitions to macros and typedefs normally found in the Windows SDK. For the most part, they should be straightforward, but there are a couple to call attention to:Type Reason LONG
/ULONG
On 64-bit Windows, a long
is 4 bytes, but on Linux it is typically 8 bytes. The D3D12 ABI for WSL useslong
and therefore these should be 8 bytes.WCHAR
/WCSTR
On Windows, a wchar_t
is 2 bytes, but on Linux it is typically 4 bytes. The D3D12 ABI for WSL uses the native 4-bytewchar_t
, to enable applications and the runtime to use the system C library to perform string manipulation.Additionally, APIs taking
HANDLE
(void*
) for Win32 types should instead usereinterpret_cast<HANDLE>(fd)
for an appropriate type of file descriptor. ForID3D12Fence::SetEventOnCompletion
this should be aneventfd
, and for shared resources will be an opaque fd.- Contributor
Please can you post your entire build log
@FireBurn The truth, I am kind of struggling without sufficient knowledge on Mesa. Do you have the simplest meson statement to build using
-Dvulkan-drivers=microsoft-experimental
for WSL2?Edited by GeorgeS2019- Contributor
So I built DirectX-Headers
git clone https://github.com/microsoft/DirectX-Headers cd DirectX-Headers mkdir build32 build64 cd build32 CXX="c++ -m32" meson --libdir lib -Dbuild-test=false -Dprefix=/usr .. ninja sudo ninja install cd ../build64 meson -Dbuild-test=false -Dprefix=/usr .. ninja sudo ninja install
I then tried adding -I options to the pkg includes pointing at mingw (which failed as this wasn't a mingw build) and then wine which also failed...
Does WSL2 contain a valid windows.h? I don't have access to a windows machine just now
Not sure if this is relevant.
// These #defines prevent the idl-generated headers from trying to include Windows.h from the SDK rather than this one.
#define RPC_NO_WINDOWS_H #define COM_NO_WINDOWS_H
From @FireBurn below
-DCOM_NO_WINDOWS_H -DD3DX12_USE_ATL
Edited by GeorgeS2019@FireBurn I do not have the necessary experience, however, I understand how important for WSL2 to have a working Vulkan on top of DirectX12. SO I give it a try.
- Contributor
So passing
-DCOM_NO_WINDOWS_H -DD3DX12_USE_ATL
as CFLAGS / CXXFLAGS gets me a bit further, but it then complains about a missing dxgi1_4.hFAILED: src/microsoft/vulkan/libvulkan_dzn.so.p/dzn_query.cpp.o x86_64-pc-linux-gnu-g++ -m32 -Isrc/microsoft/vulkan/libvulkan_dzn.so.p -Isrc/microsoft/vulkan -I../mesa-9999/src/microsoft/vulkan -Iinclude -I../mesa-9999/include -Isrc -I../mesa-9999/src -Isrc/mapi -I../mesa-9999/src/mapi -Isrc/mesa -I../mesa-9999/src/mesa -I../mesa-9999/src/gallium/include -Isrc/gallium/auxiliary -I../mesa-9999/src/gallium/auxiliary -Isrc/compiler -I../mesa-9999/src/compiler -Isrc/util -I../mesa-9999/src/util -Isrc/microsoft/compiler -I../mesa-9999/src/microsoft/compiler -Isrc/microsoft/spirv_to_dxil -I../mesa-9999/src/microsoft/spirv_to_dxil -Isrc/compiler/nir -I../mesa-9999/src/compiler/nir -Isrc/vulkan/util -I../mesa-9999/src/vulkan/util -Isrc/vulkan/runtime -I../mesa-9999/src/vulkan/runtime -Isrc/vulkan/wsi -I../mesa-9999/src/vulkan/wsi -I/usr/include/wsl/stubs -I/usr/include/directx -fvisibility=hidden -fdiagnostics-color=always -DNDEBUG -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wnon-virtual-dtor -std=c++20 -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS '-DPACKAGE_VERSION="22.2.0-devel"' '-DPACKAGE_BUGREPORT="https://gitlab.freedesktop.org/mesa/mesa/-/issues"' -DHAVE_RADEONSI -DHAVE_SWRAST -DHAVE_ZINK -DHAVE_X11_PLATFORM -DHAVE_WAYLAND_PLATFORM -DHAVE_SURFACELESS_PLATFORM -DHAVE_DRM_PLATFORM -DHAVE_XCB_PLATFORM -DUSE_ELF_TLS -DENABLE_ST_OMX_BELLAGIO=0 -DENABLE_ST_OMX_TIZONIA=0 -DHAVE_VA_SURFACE_ATTRIB_DRM_FORMAT_MODIFIERS -DGLX_INDIRECT_RENDERING -DGLX_DIRECT_RENDERING -DGLX_USE_DRM -DENABLE_SHADER_CACHE -DHAVE___BUILTIN_BSWAP32 -DHAVE___BUILTIN_BSWAP64 -DHAVE___BUILTIN_CLZ -DHAVE___BUILTIN_CLZLL -DHAVE___BUILTIN_CTZ -DHAVE___BUILTIN_EXPECT -DHAVE___BUILTIN_FFS -DHAVE___BUILTIN_FFSLL -DHAVE___BUILTIN_POPCOUNT -DHAVE___BUILTIN_POPCOUNTLL -DHAVE___BUILTIN_UNREACHABLE -DHAVE___BUILTIN_TYPES_COMPATIBLE_P -DHAVE_FUNC_ATTRIBUTE_CONST -DHAVE_FUNC_ATTRIBUTE_FLATTEN -DHAVE_FUNC_ATTRIBUTE_MALLOC -DHAVE_FUNC_ATTRIBUTE_PURE -DHAVE_FUNC_ATTRIBUTE_UNUSED -DHAVE_FUNC_ATTRIBUTE_WARN_UNUSED_RESULT -DHAVE_FUNC_ATTRIBUTE_WEAK -DHAVE_FUNC_ATTRIBUTE_FORMAT -DHAVE_FUNC_ATTRIBUTE_PACKED -DHAVE_FUNC_ATTRIBUTE_RETURNS_NONNULL -DHAVE_FUNC_ATTRIBUTE_ALIAS -DHAVE_FUNC_ATTRIBUTE_NORETURN -DHAVE_FUNC_ATTRIBUTE_VISIBILITY -D_GNU_SOURCE -DUSE_SSE41 -DUSE_GCC_ATOMIC_BUILTINS -DUSE_X86_ASM -DUSE_MMX_ASM -DUSE_3DNOW_ASM -DUSE_SSE_ASM -DMAJOR_IN_SYSMACROS -DHAS_SCHED_H -DHAS_SCHED_GETAFFINITY -DHAVE_LINUX_FUTEX_H -DHAVE_ENDIAN_H -DHAVE_DLFCN_H -DHAVE_SYS_SHM_H -DHAVE_CET_H -DHAVE_STRTOF -DHAVE_MKOSTEMP -DHAVE_TIMESPEC_GET -DHAVE_MEMFD_CREATE -DHAVE_RANDOM_R -DHAVE_FLOCK -DHAVE_STRTOK_R -DHAVE_GETRANDOM -DHAVE_QSORT_R -DHAVE_PROGRAM_INVOCATION_NAME -DHAVE_POSIX_MEMALIGN -DHAVE_DIRENT_D_TYPE -DHAVE_STRTOD_L -DHAVE_DLADDR -DHAVE_DL_ITERATE_PHDR -DHAVE_ZLIB -DHAVE_ZSTD -DHAVE_COMPRESSION -DHAVE_PTHREAD -DHAVE_PTHREAD_SETAFFINITY -DHAVE_LIBDRM -DHAVE_LIBUDEV -DLLVM_AVAILABLE '-DMESA_LLVM_VERSION_STRING="14.0.1"' -DLLVM_IS_SHARED=1 -DDRAW_LLVM_AVAILABLE -DUSE_LIBGLVND=1 -DMESA_EXECMEM -DWL_HIDE_DEPRECATED -DHAVE_DRI3 -DHAVE_DRI3_MODIFIERS -DHAVE_LIBSENSORS=1 -DVK_USE_PLATFORM_DISPLAY_KHR -mtls-dialect=gnu2 -Werror=return-type -Werror=empty-body -Wno-non-virtual-dtor -Wno-missing-field-initializers -Wno-format-truncation -fno-math-errno -fno-trapping-math -flifetime-dse=1 -Werror=format -Wformat-security -ffunction-sections -fdata-sections -O3 -march=native -pipe -DCOM_NO_WINDOWS_H -DD3DX12_USE_ATL -fPIC -pthread -MD -MQ src/microsoft/vulkan/libvulkan_dzn.so.p/dzn_query.cpp.o -MF src/microsoft/vulkan/libvulkan_dzn.so.p/dzn_query.cpp.o.d -o src/microsoft/vulkan/libvulkan_dzn.so.p/dzn_query.cpp.o -c ../mesa-9999/src/microsoft/vulkan/dzn_query.cpp In file included from ../mesa-9999/src/microsoft/vulkan/dzn_query.cpp:24: ../mesa-9999/src/microsoft/vulkan/dzn_private.h:54:10: fatal error: dxgi1_4.h: No such file or directory 54 | #include <dxgi1_4.h> | ^~~~~~~~~~~ compilation terminated.
Edited by Mike Lothian - Georg Lehmann added dozen label
added dozen label
- GeorgeS2019 mentioned in issue #6331 (closed)
mentioned in issue #6331 (closed)
DxCore (libdxcore.so) is a simplified version of dxgi
Edited by GeorgeS2019Ubuntu solution to missing dxgi1_4.h
mingw-w64 6.0 backport for Ubuntu
WSL2 error: dxcore initialization failed
WSL GPU support is coming soon in release OSes, but for now it is only available for the Windows Insider Preview. For Windows 10 builds you can look at Microsoft post about Win10 21H2: https://blogs.windows.com/windows-insider/2021/08/18/announcing-windows-10-insider-preview-build-19044-1198-21h2/ And Windows 11 builds in the Insider Preview now all have WSL GPU support as well.
Edited by GeorgeS2019- Contributor
I unsuccessfully tried using both mingw and wine-staging for includes
- Author
another idea is "Make the tests compatible with WSL" shows: https://github.com/microsoft/DirectX-Headers/commit/a1272c62334ddd7f8cfd723d56c3532a33572f1c maybe not including windows.h needs:
including before d3d12.h:
#ifndef _WIN32 #include <wsl/winadapter.h> #endif
also possible:
#ifndef __RPC_FAR #define __RPC_FAR #endif
Edited by Oscar Barenys1 When building dozen ..
../src/microsoft/vulkan/dzn_private.h:54:10: fatal error: dxgi1_4.h: No such file or directory
============================================================================================= when
mesa/subprojects/DirectX-Headers-1.0
doingmeson -Dbuild-test=true -Dprefix=/usr ..
../test/meson.build:5:0: ERROR: C++ shared or static library 'd3d12' not found
are both related, not having d3d12 and missing dxgi1_4.h
Edited by GeorgeS2019