Jellyfin Forum
SOLVED: Tonemapping on AMD in Docker - Printable Version

+- Jellyfin Forum (https://forum.jellyfin.org)
+-- Forum: Support (https://forum.jellyfin.org/f-support)
+--- Forum: Troubleshooting (https://forum.jellyfin.org/f-troubleshooting)
+--- Thread: SOLVED: Tonemapping on AMD in Docker (/t-solved-tonemapping-on-amd-in-docker)



Tonemapping on AMD in Docker - creylon - 2024-03-01

Hi,

I can't get tonemapping to work on my setup. I use an AMD GPU with VA-API for transcoding inside a docker container. All of it works fine. When I enable Tonemapping, however, I cannot play any media. I followed the setup guide in the docs for docker and AMD. Installation of OpenCL ROCm is successful, however, when running the command to confirm it I get the following error:

Code:
Splitting the commandline.
Reading option '-v' ... matched as option 'v' (set logging level) with argument 'debug'.
Reading option '-init_hw_device' ... matched as option 'init_hw_device' (initialise hardware device) with argument 'opencl'.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option v (set logging level) with argument debug.
Applying option init_hw_device (initialise hardware device) with argument opencl.
[AVHWDeviceContext @ 0x55af253a3d40] 1 OpenCL platforms found.
[AVHWDeviceContext @ 0x55af253a3d40] No devices found on platform "AMD Accelerated Parallel Processing".
[AVHWDeviceContext @ 0x55af253a3d40] No matching devices found.
Device creation failed: -19.
Failed to set value 'opencl' for option 'init_hw_device': No such device
Error parsing global options: No such device

My setup:

Docker Image: jellyfin/jellyfin:10.8.13-1
FFmpeg: jellyfin-ffmpeg6 (6.0.1-3-bullseye)

GPU:
Code:
      description: VGA compatible controller
      product: Navi 14 [Radeon RX 5500/5500M / Pro 5500M]
      vendor: Advanced Micro Devices, Inc. [AMD/ATI]
      physical id: 0
      bus info: pci@0000:03:00.0
      version: c5
      width: 64 bits
      clock: 33MHz
      capabilities: pm pciexpress msi vga_controller bus_master cap_list rom
      configuration: driver=amdgpu latency=0
      resources: irq:77 memory:d0000000-dfffffff memory:e0000000-e01fffff ioport:f000(size=256) memory:fcc00000-fcc7ffff memory:fcc80000-fcc9ffff

VA-API codecs:
Code:
Trying display: drm
libva info: VA-API version 1.20.0
libva info: Trying to open /usr/lib/jellyfin-ffmpeg/lib/dri/radeonsi_drv_video.so
libva info: Found init function __vaDriverInit_1_20
amdgpu: os_same_file_description couldn't determine if two DRM fds reference the same file description.
If they do, bad things may happen!
libva info: va_openDriver() returns 0
vainfo: VA-API version: 1.20 (libva 2.20.0)
vainfo: Driver version: Mesa Gallium driver 23.2.1 for AMD Radeon Graphics (renoir, LLVM 13.0.1, DRM 3.49, 6.1.63-1-lts)
vainfo: Supported profile and entrypoints
      VAProfileMPEG2Simple            : VAEntrypointVLD
      VAProfileMPEG2Main              : VAEntrypointVLD
      VAProfileVC1Simple              : VAEntrypointVLD
      VAProfileVC1Main                : VAEntrypointVLD
      VAProfileVC1Advanced            : VAEntrypointVLD
      VAProfileH264ConstrainedBaseline: VAEntrypointVLD
      VAProfileH264ConstrainedBaseline: VAEntrypointEncSlice
      VAProfileH264Main              : VAEntrypointVLD
      VAProfileH264Main              : VAEntrypointEncSlice
      VAProfileH264High              : VAEntrypointVLD
      VAProfileH264High              : VAEntrypointEncSlice
      VAProfileHEVCMain              : VAEntrypointVLD
      VAProfileHEVCMain              : VAEntrypointEncSlice
      VAProfileHEVCMain10            : VAEntrypointVLD
      VAProfileHEVCMain10            : VAEntrypointEncSlice
      VAProfileJPEGBaseline          : VAEntrypointVLD
      VAProfileVP9Profile0            : VAEntrypointVLD
      VAProfileVP9Profile2            : VAEntrypointVLD
      VAProfileNone                  : VAEntrypointVideoProc

Vulkan runtime status:
Code:
Splitting the commandline.
Reading option '-v' ... matched as option 'v' (set logging level) with argument 'debug'.
Reading option '-init_hw_device' ... matched as option 'init_hw_device' (initialise hardware device) with argument 'vulkan'.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option v (set logging level) with argument debug.
Applying option init_hw_device (initialise hardware device) with argument vulkan.
[AVHWDeviceContext @ 0x55d93e6e9dc0] Supported validation layers:
[AVHWDeviceContext @ 0x55d93e6e9dc0] VK_LAYER_MESA_device_select
[AVHWDeviceContext @ 0x55d93e6e9dc0] VK_LAYER_MESA_overlay
[AVHWDeviceContext @ 0x55d93e6e9dc0] GPU listing:
[AVHWDeviceContext @ 0x55d93e6e9dc0]    0: AMD Radeon Graphics (RADV RENOIR) (integrated) (0x1638)
[AVHWDeviceContext @ 0x55d93e6e9dc0] Device 0 selected: AMD Radeon Graphics (RADV RENOIR) (integrated) (0x1638)
[AVHWDeviceContext @ 0x55d93e6e9dc0] Queue families:
[AVHWDeviceContext @ 0x55d93e6e9dc0]    0: graphics compute transfer sparse (queues: 1)
[AVHWDeviceContext @ 0x55d93e6e9dc0]    1: compute transfer sparse (queues: 4)
[AVHWDeviceContext @ 0x55d93e6e9dc0] Using device extension VK_KHR_push_descriptor
[AVHWDeviceContext @ 0x55d93e6e9dc0] Using device extension VK_KHR_sampler_ycbcr_conversion
[AVHWDeviceContext @ 0x55d93e6e9dc0] Using device extension VK_KHR_synchronization2
[AVHWDeviceContext @ 0x55d93e6e9dc0] Using device extension VK_KHR_external_memory_fd
[AVHWDeviceContext @ 0x55d93e6e9dc0] Using device extension VK_EXT_external_memory_dma_buf
[AVHWDeviceContext @ 0x55d93e6e9dc0] Using device extension VK_EXT_image_drm_format_modifier
[AVHWDeviceContext @ 0x55d93e6e9dc0] Using device extension VK_KHR_external_semaphore_fd
[AVHWDeviceContext @ 0x55d93e6e9dc0] Using device extension VK_EXT_external_memory_host
[AVHWDeviceContext @ 0x55d93e6e9dc0] Using device: AMD Radeon Graphics (RADV RENOIR)
[AVHWDeviceContext @ 0x55d93e6e9dc0] Alignments:
[AVHWDeviceContext @ 0x55d93e6e9dc0]    optimalBufferCopyRowPitchAlignment: 1
[AVHWDeviceContext @ 0x55d93e6e9dc0]    minMemoryMapAlignment:              4096
[AVHWDeviceContext @ 0x55d93e6e9dc0]    minImportedHostPointerAlignment:    4096
[AVHWDeviceContext @ 0x55d93e6e9dc0] Using queue family 0 (queues: 1) for graphics
[AVHWDeviceContext @ 0x55d93e6e9dc0] Using queue family 1 (queues: 4) for compute transfers
Successfully parsed a group of options.
Hyper fast Audio and Video encoder

Thanks


RE: Tonemapping on AMD in Docker - TheDreadPirate - 2024-03-01

Can you share your docker compose file with us?


RE: Tonemapping on AMD in Docker - creylon - 2024-03-02

I use the dedicated GPU instead of the onboard, so I map renderD129 and card1 into the container. Setting user to 1000:1000 doesn't work, server won't start due to permission errors.

Code:
version: '3'

services:
  jellyfin:
    container_name: jellyfin
    image: jellyfin/jellyfin:10.8.13-1
    group_add:
      - "989" # render group
      - "986" # video group
      - "993" # input group
    dns:
      - 1.1.1.1
    volumes:
      - "./config:/config"
      - "./cache:/cache"
      - "./config.json:/jellyfin/jellyfin-web/config.json"
      - "/home/media:/media:ro"
    devices:
      # VAAPI Devices
      - /dev/dri/renderD129:/dev/dri/renderD128
      - /dev/dri/card1:/dev/dri/card0
      - /dev/kfd:/dev/kfd
    environment:
      - ROC_ENABLE_PRE_VEGA=1
    ports:
      - 8096:8096
    restart: always

networks:
  default:
    name: main
    external: true



RE: Tonemapping on AMD in Docker - nyanmisaka - 2024-03-03

Installing AMD OpenCL on Linux is a real hassle. I can't find a problem in the config. I also encountered the same error reported by another user not long ago. I suspect this is an AMD OpenCL issue in ROCm 6.0.

As an alternative, you can try the Jellyfin 10.9 (unstable branch), which enables Vulkan tone-mapping and eliminates the need for these tedious steps, allowing it to be used out of the box. If there's no rush, the beta/release version should be available within the next month or two.


RE: Tonemapping on AMD in Docker - jelly.fan - 2024-03-03

(2024-03-03, 03:02 PM)nyanmisaka Wrote: the beta/release version should be available within the next month or two.

That's nice! I haven't seen a timeframe before, and I'm one of the people affected by the AMD tonemapping issue.

Are you a Jellyfin contributor / team member? If yes, thank you so much for your work!


RE: Tonemapping on AMD in Docker - nyanmisaka - 2024-03-04

(2024-03-03, 08:21 PM)jelly.fan Wrote:
(2024-03-03, 03:02 PM)nyanmisaka Wrote: the beta/release version should be available within the next month or two.

That's nice! I haven't seen a timeframe before, and I'm one of the people affected by the AMD tonemapping issue.

Are you a Jellyfin contributor / team member? If yes, thank you so much for your work!

Yes. See release schedule: https://github.com/jellyfin/jellyfin/discussions/11051#discussioncomment-8562171


RE: Tonemapping on AMD in Docker - creylon - 2024-03-04

(2024-03-03, 03:02 PM)nyanmisaka Wrote: Installing AMD OpenCL on Linux is a real hassle. I can't find a problem in the config. I also encountered the same error reported by another user not long ago. I suspect this is an AMD OpenCL issue in ROCm 6.0.

As an alternative, you can try the Jellyfin 10.9 (unstable branch), which enables Vulkan tone-mapping and eliminates the need for these tedious steps, allowing it to be used out of the box. If there's no rush, the beta/release version should be available within the next month or two.

Thank you for taking the time. So I switched to unstable branch, now HDR content looks good on my FireTV, however, any other player I tried I only get a black screen (browser, jellyfin media player and jellyfin on iOS). Do I have to configure anything else?


RE: Tonemapping on AMD in Docker - berger0 - 2024-03-07

Hey FYI, if you are using the Linux Server docker distributions of Jellyfin, AMD Hardware accelerated tone mapping is broken in the nightly branch. This break seems to have started with the LS55 release.

First release I found that breaks AMD HWA tone mapping: https://github.com/linuxserver/docker-jellyfin/pkgs/container/jellyfin/178265489?tag=nightly-20231115.15-unstable-ls55
Seems like releases before that one still have AMD HWA tone mapping in a working state.
I went back to this release until it gets fixed again: https://github.com/linuxserver/docker-jellyfin/pkgs/container/jellyfin/175445792?tag=nightly-20231115.15-unstable-ls54