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

D3D12: failed to create device on Alpine (Intel iGPU) #12653

Open
1 of 2 tasks
victorsebrito opened this issue Mar 4, 2025 · 4 comments
Open
1 of 2 tasks

D3D12: failed to create device on Alpine (Intel iGPU) #12653

victorsebrito opened this issue Mar 4, 2025 · 4 comments
Labels

Comments

@victorsebrito
Copy link

Windows Version

Microsoft Windows [Version 10.0.26100.3194]

WSL Version

2.4.11.0

Are you using WSL 1 or WSL 2?

  • WSL 2
  • WSL 1

Kernel Version

5.15.167.4

Distro Version

Alpine 3.21

Other Software

Image

Repro Steps

  1. Setup Alpine distro

    Invoke-WebRequest "https://dl-cdn.alpinelinux.org/alpine/v3.21/releases/x86_64/alpine-minirootfs-3.21.3-x86_64.tar.gz" -OutFile alpine-minirootfs-3.21.3-x86_64.tar.gz
    mkdir alpine-wsl-gpu
    wsl --import alpine-wsl-gpu alpine-wsl-gpu .\alpine-minirootfs-3.21.3-x86_64.tar.gz
    wsl -d alpine-wsl-gpu
  2. Install dependencies and build Mesa drivers from source (default ones don't include d3d12)

    export LLVM_VERSION=19
    export MESA_VERSION=24.2.8
    
    apk update && apk add \
        alpine-sdk \
        libdrm-dev \
        libxext-dev \
        libxdamage-dev \
        libxcb-dev \
        libxshmfence-dev \
        bison \
        eudev-dev \
        expat-dev \
        findutils \
        flex \
        gettext \
        elfutils-dev \
        glslang-dev \
        libtool \
        libxfixes-dev \
        libva-dev \
        libvdpau-dev \
        libx11-dev \
        libxml2-dev \
        libxrandr-dev \
        libxxf86vm-dev \
        llvm$LLVM_VERSION-dev \
        meson \
        py3-mako \
        py3-packaging \
        py3-yaml \
        python3 \
        vulkan-loader-dev \
        wayland-dev \
        wayland-protocols \
        xorgproto \
        zlib-dev \
        zstd-dev
    
    cd / && wget https://archive.mesa3d.org/mesa-$MESA_VERSION.tar.xz && \
        tar xf mesa-$MESA_VERSION.tar.xz
    	
    cd mesa-$MESA_VERSION &&
        meson setup build/ \
        -Dprefix=/usr \
        -Dgallium-drivers=d3d12 \
        -Dvulkan-drivers= \
        -Dgallium-va=enabled \
        -Dplatforms= \
        -Dglx=disabled \
        -Degl-native-platform=drm \
        -Dvideo-codecs=all \
        -Dbuildtype=debug
    
    ninja -C build/ && \
        ninja -C build/ install
    
    apk add libva-utils
    
  3. Run vainfo

    LD_LIBRARY_PATH=/usr/lib/wsl/lib vainfo --display drm

Expected Behavior

The driver should be initialized successfully, as it does on Ubuntu:

$ LD_LIBRARY_PATH=/usr/lib/wsl/lib vainfo --display drm
libva info: VA-API version 1.20.0
Xlib:  extension "DRI2" missing on display ":0".
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/d3d12_drv_video.so
libva info: Found init function __vaDriverInit_1_20
libva info: va_openDriver() returns 0
vainfo: VA-API version: 1.20 (libva 2.12.0)
vainfo: Driver version: Mesa Gallium driver 24.2.8-1ubuntu1~24.04.1 for D3D12 (Intel(R) Iris(R) Xe Graphics)
vainfo: Supported profile and entrypoints
      VAProfileH264ConstrainedBaseline: VAEntrypointVLD
      VAProfileH264ConstrainedBaseline: VAEntrypointEncSlice
      VAProfileH264Main               : VAEntrypointVLD
      VAProfileH264Main               : VAEntrypointEncSlice
      VAProfileH264High               : VAEntrypointVLD
      VAProfileH264High               : VAEntrypointEncSlice
      VAProfileHEVCMain               : VAEntrypointVLD
      VAProfileHEVCMain               : VAEntrypointEncSlice
      VAProfileHEVCMain10             : VAEntrypointVLD
      VAProfileHEVCMain10             : VAEntrypointEncSlice
      VAProfileVP9Profile0            : VAEntrypointVLD
      VAProfileVP9Profile2            : VAEntrypointVLD
      VAProfileAV1Profile0            : VAEntrypointVLD
      VAProfileNone                   : VAEntrypointVideoProc

Actual Behavior

The driver fails to initialize:

# LD_LIBRARY_PATH=/usr/lib/wsl/lib vainfo --display drm
Trying display: drm
libva info: VA-API version 1.22.0
libva info: Trying to open /usr/lib/dri/d3d12_drv_video.so
libva info: Found init function __vaDriverInit_1_22
D3D12GetDebugInterface: This method requires the D3D12 SDK Layers for Windows 10, but they are not present on the system.
D3D12: D3D12CreateDevice failed
D3D12: failed to create device
D3D12: failed to initialize DXCore screen
libva error: /usr/lib/dri/d3d12_drv_video.so init failed
libva info: va_openDriver() returns 2
vaInitialize failed with error code 2 (resource allocation failed),exit

Diagnostic Logs

WslLogs-2025-03-03_20-49-12.zip

strace_output.zip (includes Alpine (failing) and Ubuntu (working) for comparison)

I tried to debug the drivers and this line was the farthest I could go. That's exactly where Ubuntu succeeds and Alpine fails. The backtrace looks like this:

(gdb) bt
#0  create_device (d3d12_mod=0x56037b194f80, adapter=0x56037b196850, factory=0x56037b194358) at ../src/gallium/drivers/d3d12/d3d12_screen.cpp:1020
#1  0x00007fe17f9b5e72 in d3d12_init_screen (screen=0x56037b190b30, adapter=0x56037b196850) at ../src/gallium/drivers/d3d12/d3d12_screen.cpp:1557
#2  0x00007fe17f9b26c3 in d3d12_init_dxcore_screen (dscreen=0x56037b190b30) at ../src/gallium/drivers/d3d12/d3d12_dxcore_screen.cpp:220
#3  0x00007fe17f9b27a8 in d3d12_create_dxcore_screen (winsys=0x56037b194260, adapter_luid=0x0) at ../src/gallium/drivers/d3d12/d3d12_dxcore_screen.cpp:243
#4  0x00007fe17ed94087 in sw_screen_create_named (winsys=0x56037b194260, config=0x0, driver=0x7fe17fb7b250 "d3d12") at ../src/gallium/auxiliary/target-helpers/sw_helper.h:66
#5  0x00007fe17ed94145 in sw_screen_create_vk (winsys=0x56037b194260, config=0x0, sw_vk=false) at ../src/gallium/auxiliary/target-helpers/sw_helper.h:90
#6  0x00007fe17ed941bd in sw_screen_create (winsys=0x56037b194260) at ../src/gallium/auxiliary/target-helpers/sw_helper.h:113
#7  0x00007fe17f9b1bee in vl_vgem_drm_screen_create (fd=3) at ../src/gallium/auxiliary/vl/vl_winsys_dri_vgem.c:53
#8  0x00007fe17ed9746e in __vaDriverInit_1_20 (ctx=0x56037b1204d0) at ../src/gallium/frontends/va/context.c:166
#9  0x00007fe18068e873 in vaInitialize () from /lib/x86_64-linux-gnu/libva.so.2
#10 0x000056036d95b8e0 in ?? ()
#11 0x00007fe1804901ca in __libc_start_call_main (main=main@entry=0x56036d95b6a0, argc=argc@entry=3, argv=argv@entry=0x7ffd460c44e8) at ../sysdeps/nptl/libc_start_call_main.h:58
#12 0x00007fe18049028b in __libc_start_main_impl (main=0x56036d95b6a0, argc=3, argv=0x7ffd460c44e8, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7ffd460c44d8) at ../csu/libc-start.c:360
#13 0x000056036d95be75 in ?? ()

Note: the expected behavior output I included is from a default Ubuntu installation, but I also tried building Mesa from source with the same setup as Alpine (see here and here) and it still worked just fine. I also tried matching the VA-API versions but it didn't change the behavior: it works on Ubuntu but not on Alpine.

Copy link

github-actions bot commented Mar 4, 2025

Diagnostic information
Multiple log files found, using: https://github.com/user-attachments/files/19061913/WslLogs-2025-03-03_20-49-12.zip
.wslconfig found
Detected appx version: 2.4.11.0

@zcobol
Copy link

zcobol commented Mar 4, 2025

@victorsebrito this looks like GPU or driver specific, and there were several reports of Intel iGPU graphics not working properly in WSL.

On a Windows 10 with Nvidia driver this is the output:

TEXAS:~# ls -l /dev/dri
total 0
crw-------    1 root     root      226,   0 Mar  4 20:23 card0
crw-------    1 root     root      226, 128 Mar  4 20:23 renderD128

TEXAS:~# LD_LIBRARY_PATH=/usr/lib/wsl/lib vainfo --display drm
Trying display: drm
libva info: VA-API version 1.22.0
libva info: Trying to open /usr/lib/dri/d3d12_drv_video.so
libva info: Found init function __vaDriverInit_1_22
D3D12GetDebugInterface: This method requires the D3D12 SDK Layers for Windows 10, but they are not present on the system.
libva info: va_openDriver() returns 0
vainfo: VA-API version: 1.22 (libva 2.22.0)
vainfo: Driver version: Mesa Gallium driver 24.2.8 for D3D12 (NVIDIA RTX A4000)
vainfo: Supported profile and entrypoints
      VAProfileH264ConstrainedBaseline: VAEntrypointVLD
      VAProfileH264ConstrainedBaseline: VAEntrypointEncSlice
      VAProfileH264Main               : VAEntrypointVLD
      VAProfileH264Main               : VAEntrypointEncSlice
      VAProfileH264High               : VAEntrypointVLD
      VAProfileH264High               : VAEntrypointEncSlice
      VAProfileHEVCMain               : VAEntrypointVLD
      VAProfileHEVCMain               : VAEntrypointEncSlice
      VAProfileHEVCMain10             : VAEntrypointVLD
      VAProfileHEVCMain10             : VAEntrypointEncSlice
      VAProfileVP9Profile0            : VAEntrypointVLD
      VAProfileVP9Profile2            : VAEntrypointVLD
      VAProfileAV1Profile0            : VAEntrypointVLD
      VAProfileNone                   : VAEntrypointVideoProc

Not sure why D3D12 SDK Layers for Windows 10 message is show, since the host OS is Windows 10 and the optional Graphics Tools package is installed.

@OneBlue OneBlue added the GPU label Mar 4, 2025
@victorsebrito
Copy link
Author

@zcobol Thanks for taking the time and trying to reproduce the issue. I think you're right... I hadn't tried with NVIDIA before.

I have an older PC with an Intel + NVIDIA setup:

Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz   4.20 GHz
Intel HD Graphics 630 (Driver version 31.0.101.2134)
NVIDIA RTX 2070 SUPER (Driver version 572.60)

WSL version: 2.4.11.0
Kernel version: 5.15.167.4-1
WSLg version: 1.0.65
MSRDC version: 1.2.5716
Direct3D version: 1.611.1-81528511
DXCore version: 10.0.26100.1-240331-1435.ge-release
Windows version: 10.0.26100.2605

NVIDIA GPU works:

# export MESA_D3D12_DEFAULT_ADAPTER_NAME=NVIDIA
# LD_LIBRARY_PATH=/usr/lib/wsl/lib vainfo --display drm
Trying display: drm
libva info: VA-API version 1.22.0
libva info: Trying to open /usr/lib/dri/d3d12_drv_video.so
libva info: Found init function __vaDriverInit_1_22
D3D12GetDebugInterface: This method requires the D3D12 SDK Layers for Windows 10, but they are not present on the system.
libva info: va_openDriver() returns 0
vainfo: VA-API version: 1.22 (libva 2.22.0)
vainfo: Driver version: Mesa Gallium driver 24.2.8 for D3D12 (NVIDIA GeForce RTX 2070 SUPER)
vainfo: Supported profile and entrypoints
      VAProfileH264ConstrainedBaseline: VAEntrypointVLD
      VAProfileH264ConstrainedBaseline: VAEntrypointEncSlice
      VAProfileH264Main               : VAEntrypointVLD
      VAProfileH264Main               : VAEntrypointEncSlice
      VAProfileH264High               : VAEntrypointVLD
      VAProfileH264High               : VAEntrypointEncSlice
      VAProfileHEVCMain               : VAEntrypointVLD
      VAProfileHEVCMain               : VAEntrypointEncSlice
      VAProfileHEVCMain10             : VAEntrypointVLD
      VAProfileHEVCMain10             : VAEntrypointEncSlice
      VAProfileVP9Profile0            : VAEntrypointVLD
      VAProfileVP9Profile2            : VAEntrypointVLD
      VAProfileNone                   : VAEntrypointVideoProc

Intel iGPU doesn't:

# LD_LIBRARY_PATH=/usr/lib/wsl/lib vainfo --display drm
Trying display: drm
libva info: VA-API version 1.22.0
libva info: Trying to open /usr/lib/dri/d3d12_drv_video.so
libva info: Found init function __vaDriverInit_1_22
D3D12GetDebugInterface: This method requires the D3D12 SDK Layers for Windows 10, but they are not present on the system.
D3D12: D3D12CreateDevice failed
D3D12: failed to create device
D3D12: failed to initialize DXCore screen
libva error: /usr/lib/dri/d3d12_drv_video.so init failed
libva info: va_openDriver() returns 2
vaInitialize failed with error code 2 (resource allocation failed),exit

@victorsebrito
Copy link
Author

From the strace output I can see it loading /usr/lib/wsl/drivers/iigd_dch.inf_amd64_32f2737c4537eedc/libigd12umd64.so, but it doesn't even try to load other libs from that folder as it does on Ubuntu.

I suspect the issue has something to do with glibc/musl differences, although it seems like Alpine is able to load this lib in particular:

# ldd /usr/lib/wsl/drivers/iigd_dch.inf_amd64_32f2737c4537eedc/libigd12umd64.so
        /lib/ld-musl-x86_64.so.1 (0x7fe793c53000)
        libdl.so.2 => /lib/ld-musl-x86_64.so.1 (0x7fe793c53000)
        libpthread.so.0 => /lib/ld-musl-x86_64.so.1 (0x7fe793c53000)
        libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x7fe79399b000)
        libm.so.6 => /lib/ld-musl-x86_64.so.1 (0x7fe793c53000)
        libgcc_s.so.1 => /usr/lib/libgcc_s.so.1 (0x7fe79396f000)
        libc.so.6 => /lib/ld-musl-x86_64.so.1 (0x7fe793c53000)

That's not true for the other libs in the driver folder, though:

# ldd /usr/lib/wsl/drivers/iigd_dch.inf_amd64_32f2737c4537eedc/libigd12um64xel.so
        /lib/ld-musl-x86_64.so.1 (0x7f8e524bd000)
        libdl.so.2 => /lib/ld-musl-x86_64.so.1 (0x7f8e524bd000)
        libpthread.so.0 => /lib/ld-musl-x86_64.so.1 (0x7f8e524bd000)
        libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x7f8e519bc000)
        libm.so.6 => /lib/ld-musl-x86_64.so.1 (0x7f8e524bd000)
        libgcc_s.so.1 => /usr/lib/libgcc_s.so.1 (0x7f8e51990000)
        libc.so.6 => /lib/ld-musl-x86_64.so.1 (0x7f8e524bd000)
Error loading shared library ld-linux-x86-64.so.2: No such file or directory (needed by libigd12um64xel.so)
Error relocating libigd12um64xel.so: __vsnprintf_chk: symbol not found

... which kind of confirms my suspicion?

Are all of these files provided by Intel? I'll try to dig deeper, but honestly I still need to think about what my next steps should be.

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

No branches or pull requests

3 participants