microsoft / wslg

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

Hardware encoding using h264_vaapi #1276

Open antonpetrovmain opened 1 month ago

antonpetrovmain commented 1 month ago

Windows build number:

10.0.19045.0

Your Distribution version:

2024.2

Your WSL versions:

PS C:\Users\anton.petrov> wsl --version WSL version: 2.2.4.0 Kernel version: 5.15.153.1-2 WSLg version: 1.0.61 MSRDC version: 1.2.5326 Direct3D version: 1.611.1-81528511 DXCore version: 10.0.26091.1-240325-1447.ge-release Windows version: 10.0.19045.4529

Steps to reproduce:

  1. sudo sunshine
  2. Observe an error using hardware encoding:
    [2024:07:26:07:01:20]: Error: [h264_vaapi @ 0x5653259a0400] No usable encoding entrypoint found for profile VAProfileH264High (7).

WSL logs:

No response

WSL dumps:

No response

Expected behavior:

Hardware encoding should work for sunshine server.

Actual behavior:

Sunshine falls back to software encoding: [2024:07:26:07:01:21]: Info: Found H.264 encoder: libx264 [software]

antonpetrovmain commented 1 month ago
 └─$ sudo LIBVA_DRIVER_NAME=d3d12 vainfo --display drm
    libva info: VA-API version 1.21.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_21
    libva info: va_openDriver() returns 0
    vainfo: VA-API version: 1.21 (libva 2.12.0)
    vainfo: Driver version: Mesa Gallium driver 24.0.7-1 for D3D12 (Intel(R) UHD Graphics 620)
    vainfo: Supported profile and entrypoints
    VAProfileH264ConstrainedBaseline:   VAEntrypointVLD
    VAProfileH264Main               :   VAEntrypointVLD
    VAProfileH264High               :   VAEntrypointVLD
    VAProfileHEVCMain               :   VAEntrypointVLD
    VAProfileHEVCMain10             :   VAEntrypointVLD
    VAProfileVP9Profile0            :   VAEntrypointVLD
    VAProfileVP9Profile2            :   VAEntrypointVLD
    VAProfileNone                   :   VAEntrypointVideoProc
antonpetrovmain commented 1 month ago

Does that mean the current d3d12 drivers do not support hardware encoding using H264? I see only decoding capabilities: VAEntrypointVLD and I do not see the ones for encoding: VAEntrypointEncSlice

antonpetrovmain commented 1 month ago

Or does the hardware not support H264 encoding? Maybe this is the case, if I read this article correctly: https://www.intel.com/content/www/us/en/developer/articles/technical/linuxmedia-vaapi.html

Can somebody more knowledgeable please confirm? :)