microsoft / wslg

Enabling the Windows Subsystem for Linux to include support for Wayland and X server related scenarios
MIT License
10.12k stars 303 forks source link

d3d12 acceleration fails on hybrid intel/nvidia laptop #1001

Open ligonliu opened 1 year ago

ligonliu commented 1 year ago

Windows build number:

10.0.19044.0

Your Distribution version:

22.04

Your WSL versions:

WSL version: 1.1.3.0 Kernel version: 5.15.90.1 WSLg version: 1.0.49 MSRDC version: 1.2.3770 Direct3D version: 1.608.2-61064218 DXCore version: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp Windows version: 10.0.19044.2673

Steps to reproduce:

  1. My hardware is Intel 8th generation i7 with Intel UHD 620 and nvidia geforce MX250 of the Pascal architecture, driver versions: Intel 4/3/2022 30.0.101.1692 nvidia 12/5/2022 31.0.15.2756 The iGPU is not on the supported hardware list, but the nvidia is definitely supported because it's a "GeForce GTX 10 Series and newer"

  2. Install Ubuntu 22.04 on wsl2

  3. Follow microsoft devblog's steps, using the oibaf/graphics-drivers to update mesa-va-drivers package

  4. Enumerate libva capabilities for your current hardware by running

vainfo --display drm --device /dev/dri/card0

WSL logs:

pulseaudio.log weston.log stderr.log

WSL dumps:

No response

Expected behavior:

vainfo --display drm --device /dev/dri/card0 returns: vainfo: VA-API version: 1.15 (libva 2.12.0) vainfo: Driver version: Mesa Gallium driver 22.2.1 for D3D12 vainfo: Supported profile and entrypoints VAProfileH264ConstrainedBaseline: VAEntrypointVLD VAProfileH264ConstrainedBaseline: VAEntrypointEncSlice VAProfileH264Main : VAEntrypointVLD VAProfileH264Main : VAEntrypointEncSlice VAProfileH264High : VAEntrypointVLD VAProfileH264High : VAEntrypointEncSlice VAProfileNone : VAEntrypointVideoProc

Actual behavior:

libva info: VA-API version 1.14.0 libva info: User environment variable requested driver 'd3d12' libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/d3d12_drv_video.so libva info: Found init function __vaDriverInit_1_14 libva error: /usr/lib/x86_64-linux-gnu/dri/d3d12_drv_video.so init failed libva info: va_openDriver() returns 2 vaInitialize failed with error code 2 (resource allocation failed),exit

shoffmeister commented 1 year ago

I can confirm the defect on a hybrid notebook (NVIDIA Optimus - Dell Inspiron 7610), on the Ubuntu Preview "app" (== 23.04, Lunar Lobster) from the Microsoft Store.

apt list 'mesa-*':

mesa-common-dev/lunar 23.1~git2303080600.d5376c~oibaf~l amd64
mesa-opencl-icd/lunar 23.1~git2303080600.d5376c~oibaf~l amd64
mesa-utils-bin/lunar,now 8.5.0-1 amd64 [installed,automatic]
mesa-utils/lunar,now 8.5.0-1 amd64 [installed]
mesa-va-drivers/lunar,now 23.1~git2303080600.d5376c~oibaf~l amd64 [installed]
mesa-vdpau-drivers/lunar,now 23.1~git2303080600.d5376c~oibaf~l amd64 [installed,automatic]
mesa-vulkan-drivers/lunar,now 23.1~git2303080600.d5376c~oibaf~l amd64 [installed,automatic]

apt list 'vainfo'

vainfo/lunar,now 2.12.0+ds1-1 amd64 [installed]

MESA_D3D12_DEFAULT_ADAPTER_NAME=intel LIBVA_DRIVER_NAME=d3d12 vainfo:

libva info: VA-API version 1.17.0
libva info: User environment variable requested driver 'd3d12'
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/d3d12_drv_video.so
libva info: Found init function __vaDriverInit_1_17
libva error: /usr/lib/x86_64-linux-gnu/dri/d3d12_drv_video.so init failed
libva info: va_openDriver() returns 18
vaInitialize failed with error code 18 (invalid parameter),exit

MESA_D3D12_DEFAULT_ADAPTER_NAME=intel LIBVA_DRIVER_NAME=d3d12 glxinfo -B

name of display: :0
display: :0  screen: 0
direct rendering: Yes
Extended renderer info (GLX_MESA_query_renderer):
    Vendor: Microsoft Corporation (0xffffffff)
    Device: D3D12 (Intel(R) UHD Graphics) (0xffffffff)
    Version: 23.1.0
    Accelerated: yes
    Video memory: 32765MB
    Unified memory: yes
    Preferred profile: core (0x1)
    Max core profile version: 4.1
    Max compat profile version: 4.1
    Max GLES1 profile version: 1.1
    Max GLES[23] profile version: 3.0
OpenGL vendor string: Microsoft Corporation
OpenGL renderer string: D3D12 (Intel(R) UHD Graphics)
OpenGL core profile version string: 4.1 (Core Profile) Mesa 23.1.0-devel (git-d5376c3 2023-03-08 lunar-oibaf-ppa)
OpenGL core profile shading language version string: 4.10
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile

OpenGL version string: 4.1 (Compatibility Profile) Mesa 23.1.0-devel (git-d5376c3 2023-03-08 lunar-oibaf-ppa)
OpenGL shading language version string: 4.10
OpenGL context flags: (none)
OpenGL profile mask: compatibility profile

OpenGL ES profile version string: OpenGL ES 3.0 Mesa 23.1.0-devel (git-d5376c3 2023-03-08 lunar-oibaf-ppa)
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.00

The same unwanted behaviour occurs when I override for "nvidia" as the Mesa target

Note: my installation works for graphics acceleration for both the Intel GPU (Tiger Lake XE, latest drivers) and the NVIDIA GPU (RTX 3060, latest drivers).

BlazingRush commented 3 months ago

i got this problem too