jellyfin / jellyfin-ffmpeg

FFmpeg for Jellyfin
https://jellyfin.org
Other
479 stars 127 forks source link

Double free segfault when trying to use VAAPI or QSV with Intel Arc #437

Closed viggy96 closed 1 month ago

viggy96 commented 1 month ago

Describe The Bug I get a "double free or corruption (!prev)" error when running the test commands from the Jellyfin HW acceleration documentation page.

Steps To Reproduce

  1. Install Intel Arc GPU
  2. Install drivers
  3. Run commands

Expected Behavior

System (please complete the following information):

FFmpeg Logs

 dco --file media/docker-compose.yaml exec jellyfin /usr/lib/jellyfin-ffmpeg/ffmpeg -v verbose -init_hw_device vaapi=va:/dev/dri/renderD128 -init_hw_device opencl@va
ffmpeg version 6.0.1-Jellyfin Copyright (c) 2000-2023 the FFmpeg developers
  built with gcc 12 (Debian 12.2.0-14)
  configuration: --prefix=/usr/lib/jellyfin-ffmpeg --target-os=linux --extra-version=Jellyfin --disable-doc --disable-ffplay --disable-ptx-compression --disable-static --disable-libxcb --disable-sdl2 --disable-xlib --enable-lto --enable-gpl --enable-version3 --enable-shared --enable-gmp --enable-gnutls --enable-chromaprint --enable-opencl --enable-libdrm --enable-libxml2 --enable-libass --enable-libfreetype --enable-libfribidi --enable-libfontconfig --enable-libbluray --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libopenmpt --enable-libdav1d --enable-libsvtav1 --enable-libwebp --enable-libvpx --enable-libx264 --enable-libx265 --enable-libzvbi --enable-libzimg --enable-libfdk-aac --arch=amd64 --enable-libshaderc --enable-libplacebo --enable-vulkan --enable-vaapi --enable-amf --enable-libvpl --enable-ffnvcodec --enable-cuda --enable-cuda-llvm --enable-cuvid --enable-nvdec --enable-nvenc
  libavutil      58.  2.100 / 58.  2.100
  libavcodec     60.  3.100 / 60.  3.100
  libavformat    60.  3.100 / 60.  3.100
  libavdevice    60.  1.100 / 60.  1.100
  libavfilter     9.  3.100 /  9.  3.100
  libswscale      7.  1.100 /  7.  1.100
  libswresample   4. 10.100 /  4. 10.100
  libpostproc    57.  1.100 / 57.  1.100
[AVHWDeviceContext @ 0x5d6f8db57480] libva: VA-API version 1.22.0
[AVHWDeviceContext @ 0x5d6f8db57480] libva: Trying to open /usr/lib/jellyfin-ffmpeg/lib/dri/iHD_drv_video.so
[AVHWDeviceContext @ 0x5d6f8db57480] libva: Found init function __vaDriverInit_1_22
double free or corruption (!prev)
 dco --file media/docker-compose.yaml exec jellyfin /usr/lib/jellyfin-ffmpeg/ffmpeg -v verbose -init_hw_device qsv=hw -init_hw_device qsv@hw
ffmpeg version 6.0.1-Jellyfin Copyright (c) 2000-2023 the FFmpeg developers
  built with gcc 12 (Debian 12.2.0-14)
  configuration: --prefix=/usr/lib/jellyfin-ffmpeg --target-os=linux --extra-version=Jellyfin --disable-doc --disable-ffplay --disable-ptx-compression --disable-static --disable-libxcb --disable-sdl2 --disable-xlib --enable-lto --enable-gpl --enable-version3 --enable-shared --enable-gmp --enable-gnutls --enable-chromaprint --enable-opencl --enable-libdrm --enable-libxml2 --enable-libass --enable-libfreetype --enable-libfribidi --enable-libfontconfig --enable-libbluray --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libopenmpt --enable-libdav1d --enable-libsvtav1 --enable-libwebp --enable-libvpx --enable-libx264 --enable-libx265 --enable-libzvbi --enable-libzimg --enable-libfdk-aac --arch=amd64 --enable-libshaderc --enable-libplacebo --enable-vulkan --enable-vaapi --enable-amf --enable-libvpl --enable-ffnvcodec --enable-cuda --enable-cuda-llvm --enable-cuvid --enable-nvdec --enable-nvenc
  libavutil      58.  2.100 / 58.  2.100
  libavcodec     60.  3.100 / 60.  3.100
  libavformat    60.  3.100 / 60.  3.100
  libavdevice    60.  1.100 / 60.  1.100
  libavfilter     9.  3.100 /  9.  3.100
  libswscale      7.  1.100 /  7.  1.100
  libswresample   4. 10.100 /  4. 10.100
  libpostproc    57.  1.100 / 57.  1.100
[AVHWDeviceContext @ 0x610d243bc980] Trying to use DRM render node for device 0, with matching kernel driver (i915).
[AVHWDeviceContext @ 0x610d243bc980] libva: VA-API version 1.22.0
[AVHWDeviceContext @ 0x610d243bc980] libva: User requested driver 'iHD'
[AVHWDeviceContext @ 0x610d243bc980] libva: Trying to open /usr/lib/jellyfin-ffmpeg/lib/dri/iHD_drv_video.so
[AVHWDeviceContext @ 0x610d243bc980] libva: Found init function __vaDriverInit_1_22
double free or corruption (!prev)

Additional Context

nyanmisaka commented 1 month ago

@viggy96 i915 DKMS driver is not supported. Use linux 6.5-hwe kernel instead.

viggy96 commented 1 month ago

I am running the Ubuntu HWE kernel Linux box 6.5.0-45-generic #45~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Mon Jul 15 16:40:02 UTC 2 x86_64 x86_64 x86_64 GNU/Linux

nyanmisaka commented 1 month ago
  1. Install drivers

Then everything should work as expected. No need to manually install intel out-of-tree drivers.

viggy96 commented 1 month ago

I have tried with the upstream kernel as well, to no avail.

nyanmisaka commented 1 month ago

Please share the output of sudo dmesg | grep i915.

viggy96 commented 1 month ago
[    6.152193] i915_compat: loading out-of-tree module taints kernel.
[    6.152993] Loading modules backported from I915-24.3.23
[    6.152994] Backport generated by backports.git I915_24.3.23_PSB_240419.26
[    6.588207] [drm] I915 BACKPORTED INIT
[    6.590530] i915 0000:83:00.0: Using 128 cores (0-127) for kthreads
[    6.591265] i915 0000:83:00.0: BAR 0: releasing [mem 0xf4000000-0xf4ffffff 64bit]
[    6.592362] i915 0000:83:00.0: BAR 2: releasing [mem 0x20030000000-0x2003fffffff 64bit pref]
[    6.597187] i915 0000:83:00.0: BAR 2: no space for [mem size 0x200000000 64bit pref]
[    6.597641] i915 0000:83:00.0: BAR 2: failed to assign [mem size 0x200000000 64bit pref]
[    6.598101] i915 0000:83:00.0: BAR 0: assigned [mem 0xf4000000-0xf4ffffff 64bit]
[    6.604048] i915 0000:83:00.0: [drm] Failed to resize BAR2 to 8192M (-ENOSPC)
[    6.604502] i915 0000:83:00.0: BAR 2: assigned [mem 0x20030000000-0x2003fffffff 64bit pref]
[    6.604968] i915 0000:83:00.0: [drm] GT count: 1, enabled: 1
[    6.606163] i915 0000:83:00.0: [drm] VT-d active for gfx access
[    6.606648] i915 0000:83:00.0: [drm] Using Transparent Hugepages
[    6.607257] i915 0000:83:00.0: [drm] Cannot use the full memory 0x000000017c800000 on the device as LMEM BAR size was found to be smaller
[    6.609123] i915 0000:83:00.0: [drm] Continuing with reduced LMEM size: 0x0000000010000000
[    6.610870] caller region_lmem_init+0x34/0xe0 [i915] mapping multiple BARs
[    6.611505] i915 0000:83:00.0: [drm] Local memory IO size: 0x0000000180000000
[    6.611983] i915 0000:83:00.0: [drm] Local memory available: 0x0000000010000000
[    6.674637] i915 0000:83:00.0: [drm] Finished loading DMC firmware i915/dg2_dmc_ver2_07.bin (v2.7)
[    6.683433] i915 0000:83:00.0: [drm] GT0: GuC firmware i915/dg2_guc_70.25.0.bin version 70.25.0
[    6.684208] i915 0000:83:00.0: [drm] GT0: HuC firmware i915/dg2_huc_7.10.16_gsc.bin version 7.10.16
[    6.694470] i915 0000:83:00.0: [drm] GT0: GUC: submission enabled
[    6.695898] i915 0000:83:00.0: [drm] GT0: GUC: SLPC enabled
[    6.696831] i915 0000:83:00.0: [drm] GT0: GUC: RC enabled
[    6.732701] i915 0000:83:00.0: GT0: local0 bcs'0.0 clear bandwidth:118209 MB/s
[    6.754410] i915 0000:83:00.0: GT0: local0 bcs'0.0 swap bandwidth:1775 MB/s
[    6.757387] [drm] Initialized i915 1.6.0 20201103 for 0000:83:00.0 on minor 1
[    6.785670] i915 0000:83:00.0: SPI access overridden by jumper
[   32.763257] [drm] I915 SPI BACKPORTED INIT
[   32.784376] Creating 4 MTD partitions on "i915.spi.33536":
[   32.784383] 0x000000000000-0x000000001000 : "i915.spi.33536.DESCRIPTOR"
[   32.801587] 0x000000001000-0x0000005f0000 : "i915.spi.33536.GSC"
[   32.805100] 0x0000005f0000-0x0000007f0000 : "i915.spi.33536.OptionROM"
[   32.807473] 0x0000007f0000-0x000000800000 : "i915.spi.33536.DAM"
[   32.839094] snd_hda_intel 0000:84:00.0: bound 0000:83:00.0 (ops i915_audio_component_bind_ops [i915])
[   33.923719] i915 0000:83:00.0: [drm] GT0: HuC: authenticated!
[   33.923728] mei_pxp i915.mei-gsc.33536-fbf6fcf1-96cf-4e2e-a6a6-1bab8cbe36b1: bound 0000:83:00.0 (ops i915_pxp_tee_component_ops [i915])
nyanmisaka commented 1 month ago
[    6.152193] i915_compat: loading out-of-tree module taints kernel.
[    6.152993] Loading modules backported from I915-24.3.23
[    6.152994] Backport generated by backports.git I915_24.3.23_PSB_240419.26
[    6.588207] [drm] I915 BACKPORTED INIT

You are using the i915 DKMS/backport driver, please uninstall it completely.

gnattu commented 1 month ago

out-of-tree i915 dkms is not supported and will not be supported