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

[D3D11VA] HEVC YUV444 hardware decoding not working #12029

Closed
thesword53 opened this issue Jul 26, 2023 · 7 comments
Closed

[D3D11VA] HEVC YUV444 hardware decoding not working #12029

thesword53 opened this issue Jul 26, 2023 · 7 comments
Labels
down-upstream features and bugs that need to be implemented and fixed upstream os:win

Comments

@thesword53
Copy link

Important Information

  • mpv 0.36.0
  • Windows 10 (10.0.19045)
  • Source of the mpv binary: MSYS2 (mingw-w64-x86_64-mpv)
  • GPU: NVIDIA Geforce RTX 2080 SUPER
  • GPU driver version: 536.67

Reproduction steps

Load any YUV444 HEVC video:
mpv -v --no-config --hwdec=d3d11va --gpu-api=d3d11 hevc_yuv444_video.mp4

Expected behavior

MPV is using hardware decoding.

Actual behavior

MPV is using software decoding.

[vd] Pixel formats supported by decoder: cuda yuv444p
[vd] Codec profile: Rext (0x4)
[vd] Requesting pixfmt 'yuv444p' from decoder.
[vd] Attempting next decoding method after failure of hevc-d3d11va.
[vd] Using software decoding.

Log file

[cplayer] Command line options: '-v' '--no-config' '--hwdec=d3d11va' '--gpu-api=d3d11' 'gt70.mp4'
[cplayer] mpv 0.36.0 Copyright © 2000-2023 mpv/MPlayer/mplayer2 projects
[cplayer]  built on Sun Jul 23 07:38:10 2023
[cplayer] libplacebo version: v5.264.1
[cplayer] FFmpeg version: 6.0
[cplayer] FFmpeg library versions:
[cplayer]    libavutil       58.2.100
[cplayer]    libavcodec      60.3.100
[cplayer]    libavformat     60.3.100
[cplayer]    libswscale      7.1.100
[cplayer]    libavfilter     9.3.100
[cplayer]    libswresample   4.10.100
[cplayer]
[cplayer] Configuration: -Dlibmpv=true -Dprefix=/mingw64 -Dbuildtype=plain -Dwrap_mode=nodownload
[cplayer] List of enabled features: av-channel-layout avif_muxer build-date caca d3d-hwaccel d3d11 d3d9-hwaccel direct3d dos-paths ffmpeg gl gl-dxinterop gl-dxinterop-d3d9 gl-win32 glob glob-win32 gpl iconv jpeg jpegxl lcms2 libarchive libass libavdevice libbluray libm libplacebo libplacebo-next lua5.1 manpage-buil
d noexecstack rubberband rubberband-3 shaderc spirv-cross stdatomic threads uchardet vapoursynth vector vk_khr_display vulkan wasapi win32 win32-desktop win32-executable win32-internal-pthreads zimg zimg-st428 zlib
[cplayer] Setting option 'v' = '' (flags = 8)
[cplayer] Setting option 'config' = 'no' (flags = 8)
[cplayer] Setting option 'hwdec' = 'd3d11va' (flags = 8)
[cplayer] Setting option 'gpu-api' = 'd3d11' (flags = 8)
[cplayer] Waiting for scripts...
[osd/libass] libass API version: 0x1701000
[osd/libass] libass source: tarball: 0.17.1
[osd/libass] Shaper: FriBidi 1.0.12 (SIMPLE) HarfBuzz-ng 8.0.1 (COMPLEX)
[osd/libass] Setting up fonts...
[osd/libass] Using font provider directwrite (with GDI)
[osd/libass] Done.
[cplayer] Set property: shared-script-properties -> 1
[cplayer] Set property: user-data/osc/visibility="auto" -> 1
[cplayer] Set property: shared-script-properties -> 1
[cplayer] Set property: user-data/osc/margins={"t":0,"r":0,"b":0,"l":0} -> 1
[cplayer] Done loading scripts.
[cplayer] Running hook: ytdl_hook/on_load
[ytdl_hook] ytdl:// hook
[cplayer] Set property: shared-script-properties -> 1
[ytdl_hook] not a ytdl:// url
[cplayer] Set property: user-data/osc/margins={"t":0,"r":0,"b":0,"l":0} -> 1
[bdmv/bluray] Opening gt70.mp4
[cplayer] Set property: shared-script-properties -> 1
[file] Opening gt70.mp4
[cplayer] Set property: user-data/osc/margins={"t":0,"r":0,"b":0,"l":0} -> 1
[demux] Trying demuxers for level=normal.
[osd/libass] libass API version: 0x1701000
[osd/libass] libass source: tarball: 0.17.1
[osd/libass] Shaper: FriBidi 1.0.12 (SIMPLE) HarfBuzz-ng 8.0.1 (COMPLEX)
[osd/libass] Setting up fonts...
[osd/libass] Using font provider directwrite (with GDI)
[osd/libass] Done.
[lavf] Found 'mov,mp4,m4a,3gp,3g2,mj2' at score=100 size=2048.
[file] stream level seek from 131072 to 8180870
[demux] Detected file format: mov,mp4,m4a,3gp,3g2,mj2 (libavformat)
[cplayer] Opening done: gt70.mp4
[find_files] Loading external files in .
[cplayer] Running hook: ytdl_hook/on_preloaded
[lavf] select track 0
[cplayer]  (+) Video --vid=1 (*) (hevc 1920x1080 60.000fps)
[vo/gpu] Probing for best GPU context.
[vo/gpu/d3d11] Initializing GPU context 'd3d11'
[vo/gpu/d3d11] Using Direct3D 11 feature level 12_1
[vo/gpu/d3d11] Device Name: NVIDIA GeForce RTX 2080 SUPER
[vo/gpu/d3d11] Device ID: 10de:1e81 (rev a1)
[vo/gpu/d3d11] Subsystem ID: 1462:c724
[vo/gpu/d3d11] LUID: 0000000000013294
[vo/gpu/d3d11] Initializing SPIR-V compiler 'shaderc'
[vo/gpu/d3d11] Using Direct3D 11.1 runtime
[vo/gpu/d3d11] Maximum Texture2D size: 16384x16384
[vo/gpu/d3d11] D3DCompiler version: 10.0.19041.868
[vo/gpu/d3d11] Using DXGI 1.2+
[vo/gpu/d3d11] Queried output: \\.\DISPLAY1, 2560x1440 @ 8 bits, colorspace: RGB_FULL_G22_NONE_P709 (0)
[vo/gpu/d3d11] Selected swapchain format R8G8B8A8_UNORM (28), attempting to utilize it.
[vo/gpu/d3d11] Selected swapchain color space RGB_FULL_G22_NONE_P709 (0), attempting to utilize it.
[vo/gpu/d3d11] Swapchain capabilities for color space RGB_FULL_G22_NONE_P709 (0): normal: yes, overlay: yes
[vo/gpu/d3d11] Swapchain successfully configured to color space RGB_FULL_G22_NONE_P709 (0)!
[vo/gpu/d3d11] Using flip-model presentation
[vo/gpu] Testing FBO format rgba16hf
[vo/gpu] Using FBO format rgba16hf.
[vo/gpu] No advanced processing required. Enabling dumb mode.
[vo/gpu/win32] DPI detected from the new API: 96
[vo/gpu/win32] display-fps: 143.999000
[vo/gpu/win32] color-profile: C:\WINDOWS\system32\spool\drivers\color\MAG271CQR.icm
[vo/gpu] Assuming 143.999000 FPS for display sync.
[vd] Container reported FPS: 60.000000
[vd] Codec list:
[vd]     hevc - HEVC (High Efficiency Video Coding)
[vd]     hevc_qsv (hevc) - HEVC video (Intel Quick Sync Video acceleration)
[vd]     hevc_cuvid (hevc) - Nvidia CUVID HEVC decoder
[vd] Opening decoder hevc
[vd] Looking at hwdec hevc-d3d11va...
[vo/gpu] Loading hwdec drivers for format: 'd3d11'
[vo/gpu] Loading hwdec driver 'd3d11va'
[vd] Trying hardware decoding via hevc-d3d11va.
[vd] Selected codec: hevc (HEVC (High Efficiency Video Coding))
[vf] User filter list:
[vf]   (empty)
[cplayer] Starting playback...
[file] stream level seek from 8199479 to 44
[vd] Pixel formats supported by decoder: cuda yuv444p
[vd] Codec profile: Rext (0x4)
[vd] Requesting pixfmt 'yuv444p' from decoder.
[vd] Attempting next decoding method after failure of hevc-d3d11va.
[vd] Using software decoding.
[vd] Detected 16 logical cores.
[vd] Requesting 16 threads for decoding.
[vd] DR failed - disabling.
[vd] Using software decoding.
[vd] Decoder format: 1920x1080 yuv444p auto/auto/auto/limited/auto CL=unknown
[vd] Using container aspect ratio.
[vf] [in] 1920x1080 yuv444p bt.709/bt.709/bt.1886/limited/display SP=1.000000 CL=mpeg2/4/h264
[vf] [userdeint] 1920x1080 yuv444p bt.709/bt.709/bt.1886/limited/display SP=1.000000 CL=mpeg2/4/h264
[vf] [userdeint] (disabled)
[vf] [autorotate] 1920x1080 yuv444p bt.709/bt.709/bt.1886/limited/display SP=1.000000 CL=mpeg2/4/h264
[vf] [autorotate] (disabled)
[vf] [convert] 1920x1080 yuv444p bt.709/bt.709/bt.1886/limited/display SP=1.000000 CL=mpeg2/4/h264
[vf] [convert] (disabled)
[vf] [out] 1920x1080 yuv444p bt.709/bt.709/bt.1886/limited/display SP=1.000000 CL=mpeg2/4/h264
[cplayer] VO: [gpu] 1920x1080 yuv444p
[cplayer] VO: Description: Shader-based GPU Renderer
[vo/gpu] reconfig to 1920x1080 yuv444p bt.709/bt.709/bt.1886/limited/display SP=1.000000 CL=mpeg2/4/h264
[vo/gpu/win32] reset window bounds: 320:171:1920:1080
[vo/gpu/win32] resize window: 1920:1080
[vo/gpu/win32] resize window: 1920:1080
[vo/gpu] Resize: 1920x1080
[vo/gpu] Window size: 1920x1080 (Borders: l=0 t=0 r=0 b=0)
[vo/gpu] Video source: 1920x1080 (1:1)
[vo/gpu] Video display: (0, 0) 1920x1080 -> (0, 0) 1920x1080
[vo/gpu] Video scale: 1.000000/1.000000
[vo/gpu] OSD borders: l=0 t=0 r=0 b=0
[vo/gpu] Video borders: l=0 t=0 r=0 b=0
[vo/gpu] Reported display depth: 8
[vo/gpu] Texture for plane 0: 1920x1080
[vo/gpu] Texture for plane 1: 1920x1080
[vo/gpu] Texture for plane 2: 1920x1080
[vo/gpu] Testing FBO format rgba16hf
[vo/gpu] Using FBO format rgba16hf.
[vo/gpu] No advanced processing required. Enabling dumb mode.
[vo/gpu] Resize: 1920x1080
[vo/gpu] Window size: 1920x1080 (Borders: l=0 t=0 r=0 b=0)
[vo/gpu] Video source: 1920x1080 (1:1)
[vo/gpu] Video display: (0, 0) 1920x1080 -> (0, 0) 1920x1080
[vo/gpu] Video scale: 1.000000/1.000000
[vo/gpu] OSD borders: l=0 t=0 r=0 b=0
[vo/gpu] Video borders: l=0 t=0 r=0 b=0
[vo/gpu] Reported display depth: 8
[vo/gpu/d3d11] shaderc compile status 'success' (0 errors, 0 warnings)
[vo/gpu/d3d11] Compiled a vertex shader in 69837us
[vo/gpu/d3d11] shaderc: 67699us, SPIRV-Cross: 452us, D3DCompile: 1686us
[vo/gpu/d3d11] shaderc compile status 'success' (0 errors, 0 warnings)
[vo/gpu/d3d11] Compiled a fragment shader in 6679us
[vo/gpu/d3d11] shaderc: 3552us, SPIRV-Cross: 308us, D3DCompile: 2819us
[cplayer] first video frame after restart shown
[cplayer] playback restart complete @ 0.983000, audio=eof, video=playing
[statusline] V: 00:00:01 / 00:01:12 (1%)
[cplayer] Set property: shared-script-properties -> 1
[cplayer] Set property: user-data/osc/margins={"t":0,"r":0,"b":0,"l":0} -> 1
[cplayer] Set property: shared-script-properties -> 1
[cplayer] Set property: user-data/osc/margins={"t":0,"r":0,"b":0,"l":0} -> 1
[statusline] V: 00:00:01 / 00:01:12 (2%)
[cplayer] Set property: shared-script-properties -> 1
[cplayer] Set property: user-data/osc/margins={"t":0,"r":0,"b":0,"l":0} -> 1
[statusline] V: 00:00:01 / 00:01:12 (2%)
[osd/libass] fontselect: (sans-serif, 400, 0) -> ArialMT, 0, ArialMT
[osd/libass] fontselect: (mpv-osd-symbols, 400, 0) -> mpv-osd-symbols-Regular, 0, mpv-osd-symbols-Regular
[vo/gpu] Reallocating OSD texture to 2048x256.
[vo/gpu/d3d11] shaderc compile status 'success' (0 errors, 0 warnings)
[vo/gpu/d3d11] Compiled a vertex shader in 3696us
[vo/gpu/d3d11] shaderc: 1950us, SPIRV-Cross: 134us, D3DCompile: 1612us
[vo/gpu/d3d11] shaderc compile status 'success' (0 errors, 0 warnings)
[vo/gpu/d3d11] Compiled a fragment shader in 3969us
[vo/gpu/d3d11] shaderc: 2381us, SPIRV-Cross: 137us, D3DCompile: 1451us
[statusline] V: 00:00:01 / 00:01:12 (2%)
[cplayer] Set property: shared-script-properties -> 1
[cplayer] Set property: user-data/osc/margins={"t":0,"r":0,"b":0,"l":0} -> 1
[statusline] V: 00:00:01 / 00:01:12 (3%)
[cplayer] EOF code: 5
[cplayer] finished playback, success (reason 3)
[cplayer]
[cplayer] Exiting... (Quit)
[cplayer] Set property: shared-script-properties -> 1
[vo/gpu/win32] uninit

Sample files

Any HEVC video with YUV444 pixel format.

@mitzsch
Copy link
Contributor

mitzsch commented Jul 26, 2023

D3D11VA does not support HEVC 422 or 444 yet. Microsoft is supposed to support it soon. Have a look here => Nevcairiel/LAVFilters#547 / https://chromium-review.googlesource.com/c/chromium/src/+/4627393

@Traneptora Traneptora added the down-upstream features and bugs that need to be implemented and fixed upstream label Aug 3, 2023
@Andarwinux
Copy link
Contributor

coming soon
https://chromium-review.googlesource.com/c/chromium/src/+/4410406

Actually there are differences. The private GUIDs like ones with _Intel suffix are not supported in D3D12 now. The HEVC range extension will be supported as different official GUIDs in the upcoming SDK updates. I need to write a D3D12 version of this method next week.

@Andarwinux
Copy link
Contributor

DEFINE_GUID(D3D12_VIDEO_DECODE_PROFILE_HEVC_MONOCHROME, 0x0685b993, 0x3d8c, 0x43a0, 0x8b, 0x28, 0xd7, 0x4c, 0x2d, 0x68, 0x99, 0xa4);
DEFINE_GUID(D3D12_VIDEO_DECODE_PROFILE_HEVC_MONOCHROME10, 0x142a1d0f, 0x69dd, 0x4ec9, 0x85, 0x91, 0xb1, 0x2f, 0xfc, 0xb9, 0x1a, 0x29);
DEFINE_GUID(D3D12_VIDEO_DECODE_PROFILE_HEVC_MAIN12, 0x1a72925f, 0x0c2c, 0x4f15, 0x96, 0xfb, 0xb1, 0x7d, 0x14, 0x73, 0x60, 0x3f);
DEFINE_GUID(D3D12_VIDEO_DECODE_PROFILE_HEVC_MAIN10_422, 0x0bac4fe5, 0x1532, 0x4429, 0xa8, 0x54, 0xf8, 0x4d, 0xe0, 0x49, 0x53, 0xdb);
DEFINE_GUID(D3D12_VIDEO_DECODE_PROFILE_HEVC_MAIN12_422, 0x55bcac81, 0xf311, 0x4093, 0xa7, 0xd0, 0x1c, 0xbc, 0x0b, 0x84, 0x9b, 0xee);
DEFINE_GUID(D3D12_VIDEO_DECODE_PROFILE_HEVC_MAIN_444, 0x4008018f, 0xf537, 0x4b36, 0x98, 0xcf, 0x61, 0xaf, 0x8a, 0x2c, 0x1a, 0x33);
DEFINE_GUID(D3D12_VIDEO_DECODE_PROFILE_HEVC_MAIN10_EXT, 0x9cc55490, 0xe37c, 0x4932, 0x86, 0x84, 0x49, 0x20, 0xf9, 0xf6, 0x40, 0x9c);
DEFINE_GUID(D3D12_VIDEO_DECODE_PROFILE_HEVC_MAIN10_444, 0x0dabeffa, 0x4458, 0x4602, 0xbc, 0x03, 0x07, 0x95, 0x65, 0x9d, 0x61, 0x7c);
DEFINE_GUID(D3D12_VIDEO_DECODE_PROFILE_HEVC_MAIN12_444, 0x9798634d, 0xfe9d, 0x48e5, 0xb4, 0xda, 0xdb, 0xec, 0x45, 0xb3, 0xdf, 0x01);
DEFINE_GUID(D3D12_VIDEO_DECODE_PROFILE_HEVC_MAIN16, 0xa4fbdbb0, 0xa113, 0x482b, 0xa2, 0x32, 0x63, 0x5c, 0xc0, 0x69, 0x7f, 0x6d);
DEFINE_GUID(D3D11_DECODER_PROFILE_HEVC_VLD_MONOCHROME,   0x0685b993, 0x3d8c, 0x43a0, 0x8b, 0x28, 0xd7, 0x4c, 0x2d, 0x68, 0x99, 0xa4);
DEFINE_GUID(D3D11_DECODER_PROFILE_HEVC_VLD_MONOCHROME10, 0x142a1d0f, 0x69dd, 0x4ec9, 0x85, 0x91, 0xb1, 0x2f, 0xfc, 0xb9, 0x1a, 0x29);
DEFINE_GUID(D3D11_DECODER_PROFILE_HEVC_VLD_MAIN12,     0x1a72925f, 0x0c2c, 0x4f15, 0x96, 0xfb, 0xb1, 0x7d, 0x14, 0x73, 0x60, 0x3f);
DEFINE_GUID(D3D11_DECODER_PROFILE_HEVC_VLD_MAIN10_422, 0x0bac4fe5, 0x1532, 0x4429, 0xa8, 0x54, 0xf8, 0x4d, 0xe0, 0x49, 0x53, 0xdb);
DEFINE_GUID(D3D11_DECODER_PROFILE_HEVC_VLD_MAIN12_422, 0x55bcac81, 0xf311, 0x4093, 0xa7, 0xd0, 0x1c, 0xbc, 0x0b, 0x84, 0x9b, 0xee);
DEFINE_GUID(D3D11_DECODER_PROFILE_HEVC_VLD_MAIN_444,   0x4008018f, 0xf537, 0x4b36, 0x98, 0xcf, 0x61, 0xaf, 0x8a, 0x2c, 0x1a, 0x33);
DEFINE_GUID(D3D11_DECODER_PROFILE_HEVC_VLD_MAIN10_EXT, 0x9cc55490, 0xe37c, 0x4932, 0x86, 0x84, 0x49, 0x20, 0xf9, 0xf6, 0x40, 0x9c);
DEFINE_GUID(D3D11_DECODER_PROFILE_HEVC_VLD_MAIN10_444, 0x0dabeffa, 0x4458, 0x4602, 0xbc, 0x03, 0x07, 0x95, 0x65, 0x9d, 0x61, 0x7c);
DEFINE_GUID(D3D11_DECODER_PROFILE_HEVC_VLD_MAIN12_444, 0x9798634d, 0xfe9d, 0x48e5, 0xb4, 0xda, 0xdb, 0xec, 0x45, 0xb3, 0xdf, 0x01);
DEFINE_GUID(D3D11_DECODER_PROFILE_HEVC_VLD_MAIN16,     0xa4fbdbb0, 0xa113, 0x482b, 0xa2, 0x32, 0x63, 0x5c, 0xc0, 0x69, 0x7f, 0x6d);

@mitzsch
Copy link
Contributor

mitzsch commented Dec 16, 2023

Does this mean, support is really coming soon?

@Andarwinux
Copy link
Contributor

Yes, mesa vaon12 will support rext soon, and when Microsoft releases the 23H2 SDK, d3d11va should also support rext soon.

@mitzsch
Copy link
Contributor

mitzsch commented Dec 17, 2023

Awesome, so then there is also no need for mpv to add support? All is handled via the windows sdk d3d11.h?

Dumb question, do we need new GPU drivers for support?

@Andarwinux
Copy link
Contributor

Andarwinux commented Dec 17, 2023

Still need to wait for Intel to update ffmpeg d3d11va. as for mpv, I'm not sure, at least d3d11va-copy should work as expected, d3d11va probably won't, not sure mpv will be able to handle the compression format of DXVA Rext.

ref: https://gitlab.freedesktop.org/mesa/mesa/-/issues/10294

As for drivers, Intel should already support it. They recently implemented d3d12va for Chrome with Rext support.

ref: https://chromium-review.googlesource.com/c/chromium/src/+/4410406

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
down-upstream features and bugs that need to be implemented and fixed upstream os:win
Projects
None yet
Development

No branches or pull requests

4 participants