Hardware decoding + Vulkan cause purple/blue screen when playing 4K
mpv Information
mpv 0.38.0 Copyright © 2000-2024 mpv/MPlayer/mplayer2 projects
built on Jan 1 1980 00:00:00
libplacebo version: v7.349.0
FFmpeg version: 6.1.2
FFmpeg library versions:
libavutil 58.29.100
libavcodec 60.31.102
libavformat 60.16.100
libswscale 7.5.100
libavfilter 9.12.100
libswresample 4.12.100
Other Information
- Linux version: NixOS 24.11 (Vicuna)
- Kernel Version: Linux nixos 6.11.0 #1-NixOS SMP PREEMPT_DYNAMIC Sun Sep 15 14:57:56 UTC 2024 x86_64 GNU/Linux
- GPU Model: 03:00.0 VGA compatible controller [0300]: Advanced Micro Devices, Inc. [AMD/ATI] Navi 22 [Radeon RX 6700/6700 XT/6750 XT / 6800M/6850M XT] [1002:73df] (rev c0)
- Mesa/GPU Driver Version: 4.6 (Compatibility Profile) Mesa 24.2.2
- Window Manager and Version:
- Source mpv: Nixpkgs
- Introduced in version:
Reproduction Steps
Playing videos larger than 2560x2560 will result in a purple screen:
I have found the option that causes the problem. The anomaly occurs when I enable both hwdec=auto-safe and gpu-api=vulkan. It does not occur if I disable hardware decoding, or use opengl as API.
The console will have a lot of repeated logs, as follows:
[vo/gpu-next/libplacebo] Requested image size 3840x2160x0 exceeds the maximum allowed dimensions 2560x2560x1 for vulkan image format 9
[vo/gpu-next/vaapi] mapping VAAPI EGL image failed
[vo/gpu-next] Mapping hardware decoded surface failed.
[vo/gpu-next/libplacebo] Could not render image for frame mixing.. disabling!
Expected Behavior
Play videos correctly and display OSC/OSD correctly
Actual Behavior
Purple screen, OSC/OSD cannot be displayed
Log File
Sample Files
No response
I carefully read all instruction and confirm that I did the following:
- [ ] I tested with the latest mpv version to validate that the issue is not already fixed.
- [X] I provided all required information including system and mpv version.
- [X] I produced the log file with the exact same set of files, parameters, and conditions used in "Reproduction Steps", with the addition of
--log-file=output.txt. - [X] I produced the log file while the behaviors described in "Actual Behavior" were actively observed.
- [X] I attached the full, untruncated log file.
- [ ] I attached the backtrace in the case of a crash.
I'm also experiencing this on NixOS 24.11 with 7900XTX amdgpu ...
cplayer: VO: [gpu-next] 3040x2160 vaapi[nv12]
vo/gpu-next/libplacebo: Requested image size 3040x2160x0 exceeds the maximum allowed dimensions 2560x2560x1 for vulkan image format 9
vo/gpu-next/vaapi: mapping VAAPI EGL image failed
vo/gpu-next: Mapping hardware decoded surface failed.
vo/gpu-next/libplacebo: Could not render image for frame mixing.. disabling!
Has anyone been able to replicate this in a non-Nix environment?
could you post the output of vulkaninfo in a txt file? Also the original issue is only with hwdwc=vulkan but you're using hwdec=vaapi. If it's related to gpu-api=vulkan then it should occur with no hwdec as well I'd imagine.
Using gpu-api=vulkan without hwdec works fine, if that's what you meant. When it selected vaapi I was using hwdec=auto-safe; explicitly setting to hwdec=vulkan errors with:
[ffmpeg/video] hevc: Device does not support the VK_KHR_video_decode_queue extension!
Which is... curious... Perhaps I've misconfigured something.
Perhaps I've misconfigured something.
You need export RADV_PERFTEST=video_decode in your env for it to work but unrelated to this issue
I am having same issue with hwdec=vaapi as alaestor. Playback of the same video will works with hwdec=vaapi-copy
I am on opensuse tumbleweed 20250225 and I am using AMD RX 6800 gpu. Adding export RADV_PERFTEST=video_decode doesn't fix it.
[ffmpeg/video] h264: Device does not support the VK_KHR_video_decode_queue extension!
Also is this driver bug? Because limit for h264 should be 4096x4096 since polaris and not 2560x2560 https://gitlab.freedesktop.org/agd5f/linux/-/commit/65c7cb58b8152136962a07a50a3967ae1f311642
NB: mpv 0.39 on archlinux with hwdec=vaapi (in mpv.conf) with an AMD RX6950XT was running fine; mpv 0.40 with the same config exhibited the ~same behavior as OP (blue instead of purple, but who's counting?).
@DanielGaaA 's workaround (hwdec=vaapi-copy) did work 👍
Reading a large media file (4k) returns lots of noise in the terminal:
% /usr/bin/mpv --hwdec=vaapi /tmp/large_file.webm
● Video --vid=1 --vlang=eng (vp9 3840x1920 29.97 fps) [default]
● Audio --aid=1 --alang=eng (opus 2ch 48000 Hz) [default]
Using hardware decoding (vaapi).
AO: [pipewire] 48000Hz stereo 2ch floatp
VO: [gpu] 3840x1920 vaapi[nv12]
[vo/gpu/libplacebo] Requested image size 3840x1920x0 exceeds the maximum allowed dimensions 2560x2560x1 for vulkan image format 9
[vo/gpu/vaapi] mapping VAAPI EGL image failed
[vo/gpu] Mapping hardware decoded surface failed.
[vo/gpu/libplacebo] Requested image size 3840x1920x0 exceeds the maximum allowed dimensions 2560x2560x1 for vulkan image format 9
[vo/gpu/vaapi] mapping VAAPI EGL image failed
[vo/gpu] Mapping hardware decoded surface failed.
# those 3 lines repeat ad infinitam
Same for HEVC, VP9 and AV1 on mpv 0.40 with an AMD Radeon RX 7800 XT on Arch Linux. The screen is blue (#000D80, if anyone cares).
$ › /bin/mpv --no-config --hwdec=vaapi test.mkv
● Video --vid=1 (hevc 3840x2160 60 fps)
● Audio --aid=1 'Track1' (aac 2ch 44100 Hz)
Using hardware decoding (vaapi).
AO: [pipewire] 44100Hz stereo 2ch floatp
VO: [gpu] 3840x2160 vaapi[nv12]
[vo/gpu/libplacebo] Requested image size 3840x2160x0 exceeds the maximum allowed dimensions 2560x2560x1 for vulkan image format 9
[vo/gpu/vaapi] mapping VAAPI EGL image failed
[vo/gpu] Mapping hardware decoded surface failed.
[vo/gpu/libplacebo] Requested image size 3840x2160x0 exceeds the maximum allowed dimensions 2560x2560x1 for vulkan image format 9
[vo/gpu/vaapi] mapping VAAPI EGL image failed
[vo/gpu] Mapping hardware decoded surface failed.
[vo/gpu/libplacebo] Requested image size 3840x2160x0 exceeds the maximum allowed dimensions 2560x2560x1 for vulkan image format 9
[vo/gpu/vaapi] mapping VAAPI EGL image failed
[vo/gpu] Mapping hardware decoded surface failed.
Setting hwdec to vaapi-copy seems to fix the issue, and downgrading the mpv package from the pacman cache also fixed the issue for me:
sudo pacman -U /var/cache/pacman/pkg/mpv-1:0.39.0-5-x86_64.pkg.tar.zst
You guys need to use RADV, instead of the AMDVLK vulkan driver. See #16183
Hello everyone, I am the issue author. I replaced the AMD Vulkan driver as @llyyr said, and the problem has disappeared.
If you are using NixOS, please modify as follows:
- hardware.amdgpu.amdvlk.enable = true;
hardware.graphics = {
- extraPackages = with pkgs; [ amdvlk ];
- extraPackages32 = with pkgs; [ driversi686Linux.amdvlk ];
+ enable = true;
+ enable32Bit = true;
};
The removed configuration contained the amdvlk driver, and the added configuration does not explicitly mention RADV, but it is the default.
Related documentation: https://wiki.nixos.org/wiki/AMD_GPU
If someone confirms that this modification is effective, I will close this issue.
This started happening on my machine recently.
Operating System: Arch Linux Kernel Version: 6.14.2-arch1-1 (64-bit) Graphics Platform: X11 Processors: 16 × AMD Ryzen 9 7940HS w/ Radeon 780M Graphics Memory: 60.6 GiB of RAM Graphics Processor 1: AMD Radeon RX 7700S Graphics Processor 2: AMD Radeon 780M Manufacturer: Framework Product Name: Laptop 16 (AMD Ryzen 7040 Series) System Version: AJ
mpv: 1:0.40.0-2
mpv.conf:
hwdec=auto
Without that hwdec line it works (albeit quite slow on 4K videos, barely doing it on my CPU).
Also, by default it draws a blue fill, and with vo=gpu-next it draws a purple fill.
Hello everyone, I am the issue author. I replaced the AMD Vulkan driver as @llyyr said, and the problem has disappeared.
If you are using NixOS, please modify as follows:
- hardware.amdgpu.amdvlk.enable = true; hardware.graphics = {
- extraPackages = with pkgs; [ amdvlk ];
- extraPackages32 = with pkgs; [ driversi686Linux.amdvlk ];
- enable = true;
- enable32Bit = true; };
The removed configuration contained the amdvlk driver, and the added configuration does not explicitly mention RADV, but it is the default.
Related documentation: https://wiki.nixos.org/wiki/AMD_GPU
If someone confirms that this modification is effective, I will close this issue.
I'm already using RADV, so it doesn't help This happened after recent update, downgrading mpv helps and I'm on NixOS
Same happened to my friend on NixOS after recent update too
ah this is because of this https://github.com/haasn/libplacebo/issues/333