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

VA-API not available for AMD Strix Point GFX1150/GFX1151 #523

Open
5 tasks done
rcbevans opened this issue Dec 20, 2024 · 10 comments · May be fixed by #532
Open
5 tasks done

VA-API not available for AMD Strix Point GFX1150/GFX1151 #523

rcbevans opened this issue Dec 20, 2024 · 10 comments · May be fixed by #532
Labels
bug Something isn't working

Comments

@rcbevans
Copy link

This issue respects the following points:

  • This is a bug, not a question or a configuration issue; Please visit our forum or chat rooms first to troubleshoot with volunteers, before creating a report. The links can be found here.
  • This issue is not already reported on GitHub (I've searched it).
  • I'm using an up to date version of Jellyfin Server stable, unstable or master; We generally do not support previous older versions. If possible, please update to the latest version before opening an issue.
  • I agree to follow Jellyfin's Code of Conduct.
  • This report addresses only a single issue; If you encounter multiple issues, kindly create separate reports for each one.

Description of the bug

I have a clean install of the latest jellyfin/jellyfin docker image.

I tried to enable VA-API hardware acceleration on my system with an AMD HX 370 (GFX1150).

All hardware accelerated streaming fails with an ffmpeg error

'gfx1150' is not a recognized processor for this target (ignoring processor)
'gfx1150' is not a recognized processor for this target (ignoring processor)
amd: LLVM doesn't support gfx1150, bailing out...
[AVHWDeviceContext @ 0x5fdca9b14580] libva: /usr/lib/jellyfin-ffmpeg/lib/dri/radeonsi_drv_video.so init failed
[AVHWDeviceContext @ 0x5fdca9b14580] Failed to initialise VAAPI connection: 2 (resource allocation failed).
[AVFilterGraph @ 0x5fdca9af0f00] Error initializing filters
[vost#0:0/h264_vaapi @ 0x5fdca9b5b500] Error initializing a simple filtergraph
Error opening output file /cache/transcodes/aad6d091b66a84ff6c205cb9f499f583.m3u8.
Error opening output files: Input/output error

Phoronix added GFX1150/1151 support last year and is available in LLVM 17.0.

I assume this issue here is the docker image being behind on the LLVM release?

Reproduction steps

Set up the docker image on a Strix Point AMD system.
Enable VA-API hardware acceleration.

What is the current bug behavior?

Hardware acceleration fails on HX 370 systems.

What is the expected correct behavior?

Hardware acceleration should be supported.

Jellyfin Server version

10.10.0+

Specify commit id

No response

Specify unstable release number

No response

Specify version number

No response

Specify the build version

10.10.3

Environment

- OS: Docker
- Linux Kernel:
- Virtualization:
- Clients:
- Browser:
- FFmpeg Version:
- Playback Method:
- Hardware Acceleration:
- GPU Model:
- Plugins:
- Reverse Proxy:
- Base URL:
- Networking:
- Storage:

Jellyfin logs

'gfx1150' is not a recognized processor for this target (ignoring processor)
'gfx1150' is not a recognized processor for this target (ignoring processor)
amd: LLVM doesn't support gfx1150, bailing out...
[AVHWDeviceContext @ 0x5fdca9b14580] libva: /usr/lib/jellyfin-ffmpeg/lib/dri/radeonsi_drv_video.so init failed
[AVHWDeviceContext @ 0x5fdca9b14580] Failed to initialise VAAPI connection: 2 (resource allocation failed).
[AVFilterGraph @ 0x5fdca9af0f00] Error initializing filters
[vost#0:0/h264_vaapi @ 0x5fdca9b5b500] Error initializing a simple filtergraph
Error opening output file /cache/transcodes/aad6d091b66a84ff6c205cb9f499f583.m3u8.
Error opening output files: Input/output error

FFmpeg logs

'gfx1150' is not a recognized processor for this target (ignoring processor)
'gfx1150' is not a recognized processor for this target (ignoring processor)
amd: LLVM doesn't support gfx1150, bailing out...
[AVHWDeviceContext @ 0x5fdca9b14580] libva: /usr/lib/jellyfin-ffmpeg/lib/dri/radeonsi_drv_video.so init failed
[AVHWDeviceContext @ 0x5fdca9b14580] Failed to initialise VAAPI connection: 2 (resource allocation failed).
[AVFilterGraph @ 0x5fdca9af0f00] Error initializing filters
[vost#0:0/h264_vaapi @ 0x5fdca9b5b500] Error initializing a simple filtergraph
Error opening output file /cache/transcodes/aad6d091b66a84ff6c205cb9f499f583.m3u8.
Error opening output files: Input/output error

Client / Browser logs

No response

Relevant screenshots or videos

No response

Additional information

No response

@rcbevans rcbevans added the bug Something isn't working label Dec 20, 2024
@rcbevans
Copy link
Author

I took a look into jellyfin-ffmpeg in the image and sure enough I see radeonsi_drv_video.so is linked against libLLVM-16.so.1

@rcbevans
Copy link
Author

rcbevans commented Dec 20, 2024

In jellyfin-ffmpeg I see that if the cli-release is noble, it does use LLVM 17.

llvm_version="16"

    'noble')
        release="ubuntu:noble"
        gcc_version="13"
        llvm_version="17"
    ;;

Is there a docker image with noble as a base, or is it possible to do an in-place upgrade of the jellyfin-ffmpeg dependency to add the necessary hardware support?

@nyanmisaka
Copy link
Member

I will prepare a Mesa/LLVM upgrade to support this new hardware. Our current linux package only supports AMD GPUs released before 2024, and we cannot upgrade it frequently to ensure stability.

@rcbevans
Copy link
Author

rcbevans commented Dec 20, 2024

Totally get that.

Is there any reason cloning jellyfin-ffmpeg, patching the bookworm gcc/llvm versions and producing a deb that I manually install into the container wouldn't work as a stopgap solution?

@nyanmisaka
Copy link
Member

Nope, you can also do it now if you think you can handle the version upgrade and maintain the corresponding Mesa build options.

@rcbevans
Copy link
Author

rcbevans commented Dec 21, 2024

For anyone interested, I was able to get jellyfin-ffmpeg updated within the container and verify VA-API hardware acceleration is working.

  • cloned jellyfin-ffmpeg,
  • patched build
    • so that the bookworm debian packages use gcc 13 and llvm 17
    • patched the docker build to use host networking as the debian repo wasn't resolving to update packages
  • Patched the Dockerfile to
    • Install lsb-release wget software-properties-common gnupg
    • Extend the initial "Prepare debian build environment" command to install llvm 17 per the following
&& wget https://apt.llvm.org/llvm.sh \
&& chmod +x llvm.sh \
&& ./llvm.sh 17 all \
  • Ran configure
  • Ran build bookworm amd64 to produce a custom deb
  • Opened a shell into the running jellyfin/jellyfin container
    • Install llvm 17 using same wget, chmod, llvm.sh as above
    • Install custom jellyfin-ffmpeg7.deb
  • Enable VA-API hw acceleration and verify that streams to client work as expected.

@nyanmisaka
Copy link
Member

Debian/bookworm has backported LLVM19, so the steps of manually building LLVM can be skipped.

And Mesa needs to be updated to 24.3+.

@nyanmisaka nyanmisaka transferred this issue from jellyfin/jellyfin Jan 1, 2025
@nyanmisaka nyanmisaka linked a pull request Feb 1, 2025 that will close this issue
@nyanmisaka
Copy link
Member

@rcbevans There are some builds out there that include the latest Mesa 25.0-rc1, which should work out of the box on the AMD GFX11.5 and GFX12. Do you want to try it out?

https://github.com/jellyfin/jellyfin-ffmpeg/pull/532/checks

@mertalev
Copy link

mertalev commented Mar 8, 2025

Testing a 9070 XT with the Debian build in that PR, it works with this command:

ffmpeg -hwaccel vaapi -hwaccel_output_format vaapi -noautorotate -hwaccel_device /dev/dri/renderD128 -threads 1 \
  -i input.mov -y -c:v h264_vaapi -c:a copy -movflags faststart -fps_mode passthrough -map 0:0 -map 0:1 -g 256 -v verbose \
  -vf scale_vaapi=720:-2:mode=hq:out_range=pc:format=nv12 -compression_level 7 -qp:v 23 -global_quality:v 23 -rc_mode 1 output.mp4

But including tonemap_opencl makes it throw an error:

ffmpeg -hwaccel vaapi -hwaccel_output_format vaapi -noautorotate -hwaccel_device /dev/dri/renderD128 -threads 1 \
  -i input.mov -y -c:v h264_vaapi -c:a copy -movflags faststart -fps_mode passthrough -map 0:0 -map 0:1 -g 256 -v verbose \
  -vf scale_vaapi=720:-2:mode=hq:out_range=pc,hwmap=derive_device=opencl,tonemap_opencl=desat=0:format=nv12:matrix=bt709:primaries=bt709:transfer=bt709:range=pc:tonemap=hable:tonemap_mode=lum:peak=100,hwmap=derive_device=vaapi:reverse=1,format=vaapi \
  -compression_level 7 -qp:v 23 -global_quality:v 23 -rc_mode 1 output.mp4

Logs:

Selecting decoder 'hevc' because of requested hwaccel method vaapi
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'upload/upload/f1bdd310-6cf2-44d3-96c3-ed4afa1fd492/78/1f/781f89d0-ba9c-47cb-9364-970a42d38069.MOV':
  Metadata:
    major_brand     : qt  
    minor_version   : 0
    compatible_brands: qt  
    creation_time   : 2025-02-20T23:50:05.000000Z
    com.apple.quicktime.full-frame-rate-playback-intent: 0
    com.apple.quicktime.make: Apple
    com.apple.quicktime.model: iPhone 15 Pro Max
    com.apple.quicktime.software: 18.1.1
    com.apple.quicktime.creationdate: 2025-02-21T02:50:05+0300
  Duration: 00:00:08.19, start: 0.000000, bitrate: 107170 kb/s
  Stream #0:0[0x1](und): Video: hevc (Main 10), 1 reference frame (hvc1 / 0x31637668), yuv420p10le(tv, bt2020nc/bt2020/arib-std-b67, left), 3840x2160, 106809 kb/s, 59.94 fps, 59.94 tbr, 600 tbn (default)
      Metadata:
        creation_time   : 2025-02-20T23:50:05.000000Z
        handler_name    : Core Media Video
        vendor_id       : [0][0][0][0]
        encoder         : HEVC
      Side data:
        DOVI configuration record: version: 1.0, profile: 8, level: 10, rpu flag: 1, el flag: 0, bl flag: 1, compatibility id: 4
        displaymatrix: rotation of -90.00 degrees
        Ambient Viewing Environment, ambient_illuminance=314.000000, ambient_light_x=0.312700, ambient_light_y=0.329000
  Stream #0:1[0x2](und): Audio: aac (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 188 kb/s (default)
      Metadata:
        creation_time   : 2025-02-20T23:50:05.000000Z
        handler_name    : Core Media Audio
        vendor_id       : [0][0][0][0]
  Stream #0:2[0x3](und): Data: none (mebx / 0x7862656D), 0 kb/s (default)
      Metadata:
        creation_time   : 2025-02-20T23:50:05.000000Z
        handler_name    : Core Media Metadata
  Stream #0:3[0x4](und): Data: none (mebx / 0x7862656D), 22 kb/s (default)
      Metadata:
        creation_time   : 2025-02-20T23:50:05.000000Z
        handler_name    : Core Media Metadata
  Stream #0:4[0x5](und): Data: none (mebx / 0x7862656D), 98 kb/s (default)
      Metadata:
        creation_time   : 2025-02-20T23:50:05.000000Z
        handler_name    : Core Media Metadata
  Stream #0:5[0x6](und): Data: none (mebx / 0x7862656D), 5 kb/s (default)
      Metadata:
        creation_time   : 2025-02-20T23:50:05.000000Z
        handler_name    : Core Media Metadata
  Stream #0:6[0x7](und): Data: none (mebx / 0x7862656D), 0 kb/s (default)
      Metadata:
        creation_time   : 2025-02-20T23:50:05.000000Z
        handler_name    : Core Media Metadata
[out#0/mp4 @ 0x39908140c80] Adding streams from explicit maps...
[vost#0:0/h264_vaapi @ 0x39908173480] Created video stream from input stream 0:0
[AVHWDeviceContext @ 0x399080d2580] libva: VA-API version 1.22.0
[AVHWDeviceContext @ 0x399080d2580] libva: Trying to open /usr/lib/jellyfin-ffmpeg/lib/dri/radeonsi_drv_video.so
[AVHWDeviceContext @ 0x399080d2580] libva: Found init function __vaDriverInit_1_22
amdgpu: os_same_file_description couldn't determine if two DRM fds reference the same file description.
If they do, bad things may happen!
[AVHWDeviceContext @ 0x399080d2580] libva: va_openDriver() returns 0
[AVHWDeviceContext @ 0x399080d2580] Initialised VAAPI connection: version 1.22
[AVHWDeviceContext @ 0x399080d2580] VAAPI driver: Mesa Gallium driver 25.0.0 for AMD Radeon Graphics (radeonsi, gfx1201, ACO, DRM 3.61, 6.13.5-arch1-1).
[AVHWDeviceContext @ 0x399080d2580] Driver not found in known nonstandard list, using standard behaviour.
[aost#0:1/copy @ 0x39908171380] Created audio stream from input stream 0:1
Stream mapping:
  Stream #0:0 -> #0:0 (hevc (native) -> h264 (h264_vaapi))
  Stream #0:1 -> #0:1 (copy)
[vost#0:0/h264_vaapi @ 0x39908173480] Starting thread...
[vf#0:0 @ 0x39908150280] Starting thread...
[vist#0:0/hevc @ 0x399085b0340] [dec:hevc @ 0x39908190400] Starting thread...
[in#0/mov,mp4,m4a,3gp,3g2,mj2 @ 0x39908140180] Starting thread...
Press [q] to stop, [?] for help
[graph 0 input from stream 0:0 @ 0x3990c060900] w:3840 h:2160 pixfmt:vaapi tb:1/600 fr:60000/1001 sar:0/1 csp:bt2020nc range:tv
[AVHWDeviceContext @ 0x3990c060c00] Failed to get number of OpenCL platforms: -1001.
[Parsed_hwmap_1 @ 0x3990c060600] Failed to created derived device context: -19.
[Parsed_hwmap_1 @ 0x3990c060600] Failed to configure output pad on Parsed_hwmap_1
[vf#0:0 @ 0x39908150280] Error reinitializing filters!
[vf#0:0 @ 0x39908150280] Task finished with error code: -19 (No such device)
[vf#0:0 @ 0x39908150280] Terminating thread with return code -19 (No such device)
[vist#0:0/hevc @ 0x399085b0340] [dec:hevc @ 0x39908190400] Decoder returned EOF, finishing
[vist#0:0/hevc @ 0x399085b0340] [dec:hevc @ 0x39908190400] Terminating thread with return code 0 (success)
[vist#0:0/hevc @ 0x399085b0340] All consumers of this stream are done
[vost#0:0/h264_vaapi @ 0x39908173480] Encoder thread received EOF
[vost#0:0/h264_vaapi @ 0x39908173480] Could not open encoder before EOF
[vost#0:0/h264_vaapi @ 0x39908173480] Task finished with error code: -22 (Invalid argument)
[vost#0:0/h264_vaapi @ 0x39908173480] Terminating thread with return code -22 (Invalid argument)
[in#0/mov,mp4,m4a,3gp,3g2,mj2 @ 0x39908140180] EOF while reading input
[in#0/mov,mp4,m4a,3gp,3g2,mj2 @ 0x39908140180] Terminating thread with return code 0 (success)
[out#0/mp4 @ 0x39908140c80] 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    
[AVIOContext @ 0x399081911c0] Statistics: 0 bytes written, 0 seeks, 0 writeouts
[in#0/mov,mp4,m4a,3gp,3g2,mj2 @ 0x39908140180] Input file #0 (upload/upload/f1bdd310-6cf2-44d3-96c3-ed4afa1fd492/78/1f/781f89d0-ba9c-47cb-9364-970a42d38069.MOV):
[in#0/mov,mp4,m4a,3gp,3g2,mj2 @ 0x39908140180]   Input stream #0:0 (video): 14 packets read (4437179 bytes); 3 frames decoded; 0 decode errors; 
[in#0/mov,mp4,m4a,3gp,3g2,mj2 @ 0x39908140180]   Input stream #0:1 (audio): 355 packets read (193835 bytes); 
[in#0/mov,mp4,m4a,3gp,3g2,mj2 @ 0x39908140180]   Total: 369 packets (4631014 bytes) demuxed
[AVIOContext @ 0x399081902c0] Statistics: 109772575 bytes read, 2 seeks
Conversion failed!

@nyanmisaka nyanmisaka marked this as a duplicate of #548 Mar 9, 2025
@nyanmisaka
Copy link
Member

That's expected. AMDGPU don't support zero-copy tone mapping via OpenCL on Linux.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants