Opened 9 months ago

Closed 8 months ago

#11659 closed defect (fixed)

Regression: cannot use frames with alpha channel on vulkan

Reported by: bermond Owned by:
Priority: normal Component: avutil
Version: git-master Keywords: vulkan alpha
Cc: bermond Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Vulkan cannot be used anymore with frames that have an alpha channel. It looks like there is a failure when allocating Vulkan frames, giving the message No memory type found for flags 0x1.

How to reproduce:

$ ffmpeg -init_hw_device vulkan=gpu:0 -filter_hw_device gpu -f lavfi -i 'color=color=white:size=1280x720' -vf 'format=bgra,hwupload,hwdownload,format=bgra' -t 20 -f null -
ffmpeg version N-120203-geb52251c0a Copyright (c) 2000-2025 the FFmpeg developers
  built with gcc 15.1.1 (GCC) 20250425
  configuration: --prefix=/usr --disable-debug --disable-static --disable-stripping --enable-amf --enable-avisynth --enable-cuda-llvm --enable-lto --enable-fontconfig --enable-frei0r --enable-gmp --enable-gnutls --enable-gpl --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libdav1d --enable-libdrm --enable-libdvdnav --enable-libdvdread --enable-libfreetype --enable-libfribidi --enable-libglslang --enable-libgsm --enable-libharfbuzz --enable-libiec61883 --enable-libjack --enable-libjxl --enable-libmodplug --enable-libmp3lame --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libplacebo --enable-libpulse --enable-librav1e --enable-librsvg --enable-librubberband --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libsvtav1 --enable-libtheora --enable-libv4l2 --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvpl --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxcb --enable-libxml2 --enable-libxvid --enable-libzimg --enable-libzmq --enable-nvdec --enable-nvenc --enable-opencl --enable-opengl --enable-shared --enable-vapoursynth --enable-version3 --enable-vulkan
  libavutil      60.  4.101 / 60.  4.101
  libavcodec     62.  5.100 / 62.  5.100
  libavformat    62.  1.101 / 62.  1.101
  libavdevice    62.  0.100 / 62.  0.100
  libavfilter    11.  1.100 / 11.  1.100
  libswscale      9.  0.100 /  9.  0.100
  libswresample   6.  0.100 /  6.  0.100
Input #0, lavfi, from 'color=color=white:size=1280x720':
  Duration: N/A, start: 0.000000, bitrate: N/A
  Stream #0:0: Video: wrapped_avframe, yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 25 fps, 25 tbr, 25 tbn
Stream mapping:
  Stream #0:0 -> #0:0 (wrapped_avframe (native) -> wrapped_avframe (native))
Press [q] to stop, [?] for help
[Vulkan @ 0x562c35258e00] No memory type found for flags 0x1
[hwupload @ 0x7f33380046c0] Failed to allocate frame to upload to.
[vf#0:0 @ 0x562c353fa5c0] Error while filtering: Cannot allocate memory
[vf#0:0 @ 0x562c353fa5c0] Task finished with error code: -12 (Cannot allocate memory)
[vf#0:0 @ 0x562c353fa5c0] Terminating thread with return code -12 (Cannot allocate memory)
[vost#0:0/wrapped_avframe @ 0x562c353f9c80] [enc:wrapped_avframe @ 0x562c353fa0c0] Could not open encoder before EOF
[vost#0:0/wrapped_avframe @ 0x562c353f9c80] Task finished with error code: -22 (Invalid argument)
[vost#0:0/wrapped_avframe @ 0x562c353f9c80] Terminating thread with return code -22 (Invalid argument)
[out#0/null @ 0x562c353f9900] Nothing was written into output file, because at least one of its streams received no packets.
frame=    0 fps=0.0 q=0.0 Lsize=       0KiB time=N/A bitrate=N/A speed=N/A elapsed=0:00:00.00    
Conversion failed!

This same command works nice with FFmpeg 7.1.1 and also with commit bddb9c232dbdfa2c1402c7c56f77e5e6c7fda60f (the last usable one before the soname version bumps), but fails in the current git master. So, it seems to be a regression.

A git bisect shows the offending commit as being: a9b2c10eee9cf28ecbce2f1972564f4aa826a855.

Notice that the offending commit does not compile, needing a fix from commit 3ac7d70291838d71a28cd31a5774bb69745d4216, which also fails to use frames with alpha channel on Vulkan.

System information:

  • OS: Arch Linux
  • Vulkan Headers: 1.4.313.0
  • Vulkan ICD Loader: 1.4.313.0
  • Vulkan GPU Hardware: NVIDIA RTX 3060
  • GPU driver: 575.64.03 (NVIDIA open source driver)

Change History (2)

comment:1 by bermond, 8 months ago

This was fixed by commit 53826f1815240c8ecddba408ed517f4f242ace80.

Thank you for fixing it.

comment:2 by bermond, 8 months ago

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.