mpv-player / mpv

🎥 Command line video player
https://mpv.io
Other
28.16k stars 2.89k forks source link

Broken HDR peak detection with vo=gpu-next and gpu-api=vulkan #11864

Closed ProxyVT closed 1 year ago

ProxyVT commented 1 year ago

Important Information

Provide following Information:

Reproduction steps

mpv --no-config --vo=gpu-next --gpu-api=vulkan

Expected behavior

Video with HDR plays without errors and visual distortions

Actual behavior

Video plays, but it may look darkened or grayish, as if due to a lack of contrast. Additionally, there are errors in terminal:

  [vo/gpu-next/libplacebo] Found no memory type matching property flags 0x3 and type bits 0x381!
  [vo/gpu-next/libplacebo]   for malloc: ../src/shaders/colorspace.c:1204
  [vo/gpu-next/libplacebo] No slab to serve request for   268 bytes (with alignment 0x30000) in pool 2!
  [vo/gpu-next/libplacebo] Failed creating peak detection SSBO!
  [vo/gpu-next/libplacebo] Failed creating HDR peak detection shader.. disabling
  [vo/gpu-next/libplacebo] Attempting to modify a failed shader!
  [vo/gpu-next/libplacebo] Attempting to modify a failed shader!
  [vo/gpu-next/libplacebo] Trying to dispatch a failed shader.
  [vo/gpu-next/libplacebo] Failed rendering image!
  [vo/gpu-next] Failed rendering frame!

Log file

output1.txt output2.txt output3.txt

Sample files

Video1 Video2 Video3

haasn commented 1 year ago

Seems we need a fallback path for this case. I'll add it.

haasn commented 1 year ago

Can you test if https://code.videolan.org/videolan/libplacebo/-/merge_requests/486 fixes it?

ProxyVT commented 1 year ago

Can you test if https://code.videolan.org/videolan/libplacebo/-/merge_requests/486 fixes it?

Hey there, apologize for the delay! I finally managed to compile mpv with the latest release of libplacebo 6.292.0, where you fixed this bug. Unfortunately, now none of the videos can being played correctly with vulkan API. If I run mpv --no-config --vo=gpu-next --gpu-api=vulkan, console gives the following error:

[vo/gpu-next/libplacebo] Missing device feature: dynamicRendering
[vo/gpu-next/libplacebo] Vulkan device does not support all required features!
[vo/gpu-next/libplacebo] Failed creating logical device!
[vo/gpu-next/libplacebo] Failed initializing vulkan device
[vo/gpu-next/libplacebo] Missing device feature: dynamicRendering
[vo/gpu-next/libplacebo] Vulkan device does not support all required features!
[vo/gpu-next/libplacebo] Failed creating logical device!
[vo/gpu-next/libplacebo] Failed initializing vulkan device
[vo/gpu-next] Failed initializing any suitable GPU context!
Error opening/initializing the selected video_out (--vo) device.

When I run command without --vo=gpu-next, behavior is the same, except player fallback to vdpau VO.

ProxyVT commented 1 year ago

Tested the master branch of libplacebo. Now, when playing HDR content, there are several errors indicating that fallback buffer will be used, but peak detection is working correctly, so the issue is indeed fixed.

Comparision libplacebo 5.264 ![mpv-shot0003](https://github.com/mpv-player/mpv/assets/86965169/0a72c70b-5f5d-4a3e-8378-a748371012d1) libplacebo master ![mpv-shot0002](https://github.com/mpv-player/mpv/assets/86965169/ed5bd5ec-62d2-44bf-8dfe-82176ad645f7)