dxvk
dxvk copied to clipboard
How to setup dxvk in docker with only a cpu?
I tried to setup a headless docker container that can run dxvk programs ideally 64bit and 32bit without any gpu. I don't think this is an issue with dxvk but I didn't know where else to ask for help.
Software information
I created a minimal reproducible example 627467028ba5be425d127248d46979cc3f1209c7
.
I could not get xorg
or xvfb
to work.
dxvk
always fails to create a texture.
My guess is that some library is missing but I don't know which.
Dockerfile
FROM debian:bookworm
RUN --mount=type=cache,target=/var/cache/apt --mount=type=cache,target=/var/lib/apt \
export DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true && \
sed -i -e's/ main/ main contrib non-free non-free-firmware/g' /etc/apt/sources.list.d/debian.sources && \
dpkg --add-architecture i386 && \
mkdir -pm755 /etc/apt/keyrings && \
apt-get update && \
apt-get install -y gnupg2 wget curl ca-certificates && \
wget -O /etc/apt/keyrings/winehq-archive.key https://dl.winehq.org/wine-builds/winehq.key && \
wget -NP /etc/apt/sources.list.d/ https://dl.winehq.org/wine-builds/debian/dists/bookworm/winehq-bookworm.sources && \
apt-get update && \
apt-get install -y file winehq-stable xorg xserver-xorg-video-dummy xvfb libvulkan1 libvulkan1:i386 vulkan-tools mesa-utils mesa-utils-extra mesa-vulkan-drivers mesa-vulkan-drivers:i386 mesa-vdpau-drivers mesa-vdpau-drivers:i386 mesa-va-drivers mesa-va-drivers:i386 && \
debug_packages="nano strace less" && \
apt-get install -y $debug_packages && \
apt-get clean
# Download and install dxvk
RUN \
mkdir -p /tmp/dxvk && \
cd /tmp/dxvk && \
curl -L 'https://github.com/doitsujin/dxvk/releases/download/v2.3/dxvk-2.3.tar.gz' -o dxvk-2.3.tar.gz && \
# unpack and install dxvk
tar -xzf dxvk-2.3.tar.gz && \
cd dxvk-2.3 && \
# copy the x32 and x64 folders to /usr/local/bin/dxvk
mkdir -p /usr/local/bin/dxvk && \
cp -r x32 x64 /usr/local/bin/dxvk && \
rm -rf /tmp/dxvk
ENV WINEPREFIX=/root/.wine64
ENV WINEARCH=win64
# Setup wine prefix and install dxvk
RUN \
wineboot -u && \
cp /usr/local/bin/dxvk/x64/*.dll $WINEPREFIX/drive_c/windows/system32 && \
cp /usr/local/bin/dxvk/x32/*.dll $WINEPREFIX/drive_c/windows/syswow64 && \
#do this for every dll in x64 and x32 wine reg add 'HKEY_CURRENT_USER\\Software\\Wine\\DllOverrides' /v path_to_dll /d native /f && \
before=$(stat -c '%Y' $WINEPREFIX/user.reg) \
dlls_paths=$(find /usr/local/bin/dxvk -name '*.dll') && \
for dll in $dlls_paths; do \
wine reg add "HKEY_CURRENT_USER\Software\Wine\DllOverrides" /v "$(basename "${dll%.*}")" /d native /f; \
# get the reg keys
# wine reg query "HKEY_CURRENT_USER\Software\Wine\DllOverrides" | grep -i $(basename "${dll%.*}"); \
done \
&& while [ $(stat -c '%Y' $WINEPREFIX/user.reg) = $before ]; do sleep 1; done
# Install d3d11-triangle.exe
RUN \
mkdir -p /tmp/d3d11-triangle && \
cd /tmp/d3d11-triangle && \
curl -L 'https://gitlab.melroy.org/melroy/winegui/uploads/c4db93700d13dfb71997f28c2965aeb7/dxvk-test.tar.gz' -o triangle.tar.gz && \
mkdir -p /tmp/d3d11-triangle/dxvk-test && \
tar -xzf triangle.tar.gz -C /tmp/d3d11-triangle/dxvk-test && \
#64bit
mv dxvk-test /usr/local/bin/d3d11-triangle && \
rm -rf /tmp/d3d11-triangle
COPY --chown=root:root --chmod=755 entrypoint.sh /entrypoint.sh
COPY xorg.conf /etc/X11/xorg.conf.d/20-virt.conf
ENTRYPOINT ["/entrypoint.sh"]
entrypoint.sh
#!/bin/bash
set -ex
x11_tech=$1
# Setup headless X11
# use xvfb
if [ "$x11_tech" = "xvfb" ]; then
Xvfb :0 -screen 0 1024x768x24 -ac +extension GLX +extension RANDR +extension RENDER +render -noreset &
export DISPLAY=:0
fi
# use xorg
if [ "$x11_tech" = "xorg" ]; then
Xorg -noreset +extension GLX +extension RANDR +extension RENDER -logfile ./10.log -config /etc/X11/xorg.conf :10 &
export DISPLAY=:10
fi
wine /usr/local/bin/d3d11-triangle/d3d11-triangle.exe
xorg.conf
# This xorg configuration file is meant to be used by xpra
# to start a dummy X11 server.
# For details, please see:
# https://github.com/Xpra-org/xpra/blob/master/docs/Usage/Xdummy.md
Section "ServerFlags"
Option "DontVTSwitch" "true"
Option "AllowMouseOpenFail" "true"
Option "PciForceNone" "true"
Option "AllowEmptyInput" "true"
Option "AutoEnableDevices" "false"
Option "AutoAddDevices" "false"
EndSection
Section "Device"
Identifier "dummy_videocard"
Driver "dummy"
DacSpeed 30000
Option "ConstantDPI" "true"
#VideoRam 2048000
#VideoRam 1024000
VideoRam 768000
#VideoRam 512000
#VideoRam 384000
#VideoRam 256000
#VideoRam 192000
EndSection
Section "Monitor"
Identifier "dummy_monitor"
HorizSync 1.0 - 300000.0
VertRefresh 1.0 - 300.0
EndSection
Section "Screen"
Identifier "dummy_screen"
Device "dummy_videocard"
Monitor "dummy_monitor"
DefaultDepth 24
SubSection "Display"
Viewport 0 0
Depth 8
#requires more ram:
#Modes "16000x15000" "15000x15000" "16384x8192" ..
Modes "8192x4096" "5120x3200" "3840x2880" "3840x2560" "3840x2048" "3840x2160" "2048x2048" "2560x1600" "1920x1440" "1920x1200" "1920x1080" "1600x1200" "1680x1050" "1600x900" "1400x1050" "1440x900" "1280x1024" "1366x768" "1280x800" "1024x768" "1024x600" "800x600" "320x200"
#Virtual 16384 16384
Virtual 11520 6318
EndSubSection
SubSection "Display"
Viewport 0 0
Depth 16
#requires more ram:
#Modes "16000x15000" "15000x15000" "16384x8192" ..
Modes "8192x4096" "5120x3200" "3840x2880" "3840x2560" "3840x2048" "3840x2160" "2048x2048" "2560x1600" "1920x1440" "1920x1200" "1920x1080" "1600x1200" "1680x1050" "1600x900" "1400x1050" "1440x900" "1280x1024" "1366x768" "1280x800" "1024x768" "1024x600" "800x600" "320x200"
#Virtual 16384 16384
Virtual 11520 6318
EndSubSection
SubSection "Display"
Viewport 0 0
Depth 24
#requires more ram:
#Modes "16000x15000" "15000x15000" "16384x8192" ..
Modes "8192x4096" "5120x3200" "3840x2880" "3840x2560" "3840x2048" "3840x2160" "2048x2048" "2560x1600" "1920x1440" "1920x1200" "1920x1080" "1600x1200" "1680x1050" "1600x900" "1400x1050" "1440x900" "1280x1024" "1366x768" "1280x800" "1024x768" "1024x600" "800x600" "320x200"
#Virtual 16384 16384
Virtual 11520 6318
EndSubSection
SubSection "Display"
Viewport 0 0
Depth 30
#requires more ram:
#Modes "16000x15000" "15000x15000" "16384x8192" ..
Modes "8192x4096" "5120x3200" "3840x2880" "3840x2560" "3840x2048" "3840x2160" "2048x2048" "2560x1600" "1920x1440" "1920x1200" "1920x1080" "1600x1200" "1680x1050" "1600x900" "1400x1050" "1440x900" "1280x1024" "1366x768" "1280x800" "1024x768" "1024x600" "800x600" "320x200"
#Virtual 16384 16384
Virtual 11520 6318
EndSubSection
EndSection
Section "ServerLayout"
Identifier "dummy_layout"
Screen "dummy_screen"
EndSection
System information
- GPU:
llvmpipe (LLVM 15.0.6, 256 bits)
- Driver:
llvmpipe 0.0.1
- Wine version:
wine-9.0
- DXVK version:
v2.3
Log files
Excerpt:
warn: DXVK: No state cache file found
info: DXVK: Graphics pipeline libraries supported
err: D3D11: Cannot create texture:
err: Format: 29
err: Extent: 1024x600x1
err: Samples: 8
err: Layers: 1
err: Levels: 1
err: Usage: 20
err: Flags: 0
err: DXGI: CreateSwapChainForHwnd: Failed to create swap chain, hr -2147467259
Failed to create DXGI swap chain
docker run --rm -it dxvk_test xvfb > xvfb.log 2>&1
xvfb.log
docker run --rm -it dxvk_test xorg > xorg.log 2>&1
xorg.log
Thank you for your time.
What mesa version are you running exactly? The texture error indicates that something goes wrong on the Lavapipe side of things rather than WSI, and DXVK does occationally hit some edge cases that are required by D3D11 but not supported on Lavapipe, but this is just a plain old multisampled RGBA8 texture with Render Target usage, which isn't all that special and works fine on my end with 24.0.1.
This should really just work unless this is running on a rather outdated mesa version.
Does the docker container work for you? Or did you just run the triangle program with your dxvk setup?
Mesa 22.3.6
is that too old?
I will try to build it from source...
Version Source
❯ docker run --rm -it --entrypoint /bin/bash dxvk_test
root@778e039a32da:/# Xvfb :0 -screen 0 1024x768x24 -ac +extension GLX +extension RANDR +extension RENDER +render -noreset &
export DISPLAY=:0
[1] 75
root@778e039a32da:/# vulkaninfo --summary
error: XDG_RUNTIME_DIR is invalid or not set in the environment.
error: XDG_RUNTIME_DIR is invalid or not set in the environment.
error: XDG_RUNTIME_DIR is invalid or not set in the environment.
error: XDG_RUNTIME_DIR is invalid or not set in the environment.
error: XDG_RUNTIME_DIR is invalid or not set in the environment.
error: XDG_RUNTIME_DIR is invalid or not set in the environment.
error: XDG_RUNTIME_DIR is invalid or not set in the environment.
==========
VULKANINFO
==========
Vulkan Instance Version: 1.3.239
Instance Extensions: count = 20
-------------------------------
VK_EXT_acquire_drm_display : extension revision 1
VK_EXT_acquire_xlib_display : extension revision 1
VK_EXT_debug_report : extension revision 10
VK_EXT_debug_utils : extension revision 2
VK_EXT_direct_mode_display : extension revision 1
VK_EXT_display_surface_counter : extension revision 1
VK_KHR_device_group_creation : extension revision 1
VK_KHR_display : extension revision 23
VK_KHR_external_fence_capabilities : extension revision 1
VK_KHR_external_memory_capabilities : extension revision 1
VK_KHR_external_semaphore_capabilities : extension revision 1
VK_KHR_get_display_properties2 : extension revision 1
VK_KHR_get_physical_device_properties2 : extension revision 2
VK_KHR_get_surface_capabilities2 : extension revision 1
VK_KHR_portability_enumeration : extension revision 1
VK_KHR_surface : extension revision 25
VK_KHR_surface_protected_capabilities : extension revision 1
VK_KHR_wayland_surface : extension revision 6
VK_KHR_xcb_surface : extension revision 6
VK_KHR_xlib_surface : extension revision 6
Instance Layers: count = 3
--------------------------
VK_LAYER_INTEL_nullhw INTEL NULL HW 1.1.73 version 1
VK_LAYER_MESA_device_select Linux device selection layer 1.3.211 version 1
VK_LAYER_MESA_overlay Mesa Overlay layer 1.3.211 version 1
Devices:
========
GPU0:
apiVersion = 1.3.230
driverVersion = 0.0.1
vendorID = 0x10005
deviceID = 0x0000
deviceType = PHYSICAL_DEVICE_TYPE_CPU
deviceName = llvmpipe (LLVM 15.0.6, 256 bits)
driverID = DRIVER_ID_MESA_LLVMPIPE
driverName = llvmpipe
driverInfo = Mesa 22.3.6 (LLVM 15.0.6)
conformanceVersion = 1.3.1.1
deviceUUID = 6d657361-3232-2e33-2e36-000000000000
driverUUID = 6c6c766d-7069-7065-5555-494400000000
root@778e039a32da:/# glxinfo -B
name of display: :0
display: :0 screen: 0
direct rendering: Yes
Extended renderer info (GLX_MESA_query_renderer):
Vendor: Mesa/X.org (0xffffffff)
Device: llvmpipe (LLVM 15.0.6, 256 bits) (0xffffffff)
Version: 22.3.6
Accelerated: no
Video memory: 193278MB
Unified memory: yes
Preferred profile: core (0x1)
Max core profile version: 4.5
Max compat profile version: 4.5
Max GLES1 profile version: 1.1
Max GLES[23] profile version: 3.2
OpenGL vendor string: Mesa/X.org
OpenGL renderer string: llvmpipe (LLVM 15.0.6, 256 bits)
OpenGL core profile version string: 4.5 (Core Profile) Mesa 22.3.6
OpenGL core profile shading language version string: 4.50
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile
OpenGL version string: 4.5 (Compatibility Profile) Mesa 22.3.6
OpenGL shading language version string: 4.50
OpenGL context flags: (none)
OpenGL profile mask: compatibility profile
OpenGL ES profile version string: OpenGL ES 3.2 Mesa 22.3.6
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.20
Or did you just run the triangle program with your dxvk setup?
Yeah I just ran it on my local desktop.
Mesa 22.3 is indeed quite old in the context of Lavapipe specifically, you'll definitely want to run something more up to date since it was missing quite a few features at the time.
That said, apps that don't use MSAA or esoteric combinations of texture format + usage flags might just work, it's just that d3d11-triangle uses 8xMSAA.
I switched the container to archlinux.
I now have mesa Mesa 24.0.2-arch1.1
.
Still the same error.
warn: DXVK: No state cache file found
info: DXVK: Graphics pipeline libraries supported
err: D3D11: Cannot create texture:
err: Format: 29
err: Extent: 1024x600x1
err: Samples: 8
err: Layers: 1
err: Levels: 1
err: Usage: 20
err: Flags: 0
err: DXGI: CreateSwapChainForHwnd: Failed to create swap chain, hr -2147467259
Failed to create DXGI swap chain
llvmpipe (LLVM 16.0.6, 256 bits)
What should I check next? Do you have an even simpler test program I can use?
Does vkcube even work?
@raldone01 I just looked at the code, current d3d11-triangle.exe
doesn't use MSAA actually which is why it works here. Sorry for the confusion, I forgot I changed that at some point.
You can find the current set of test apps here: https://github.com/doitsujin/dxvk-tests