Skip to content

Fix AMD VAAPI driver load on current mesa (full dep closure + musl qsort_r)#87

Open
Nehtor wants to merge 1 commit into
skjnldsv:mainfrom
Nehtor:fix/amd-vaapi-mesa-closure-musl
Open

Fix AMD VAAPI driver load on current mesa (full dep closure + musl qsort_r)#87
Nehtor wants to merge 1 commit into
skjnldsv:mainfrom
Nehtor:fix/amd-vaapi-mesa-closure-musl

Conversation

@Nehtor

@Nehtor Nehtor commented Jun 20, 2026

Copy link
Copy Markdown

Problem

On current Alpine mesa-va-gallium, the AMD image fails to load the VAAPI driver, so hardware transcoding breaks. Two root causes:

  1. Incomplete library list. The amd stage copies driver dependencies via a hand-maintained cp -a /usr/lib/libXXX* list. Recent mesa added new transitive deps (e.g. libSPIRV-Tools.so) that aren't in the list, so the driver fails to load:
    libva: dlopen of .../radeonsi_drv_video.so failed:
    Error relocating ...: libSPIRV-Tools.so: No such file or directory
    
  2. Stale musl + libdrm. The musl libc bundled inside plexmediaserver predates qsort_r, which current mesa requires:
    ... radeonsi_drv_video.so failed: ... qsort_r: symbol not found
    
    and Plex's bundled libdrm lacks amdgpu_va_manager_alloc, also required by current mesa.

Fix

  • Replace the hand-maintained copy list with the complete ldd dependency closure of the VA drivers, so new mesa deps are picked up automatically and this stops regressing on future mesa bumps.
  • Overwrite Plex's stale bundled libdrm and upgrade the musl loader + libc.so so qsort_r resolves.

The collection logic is unchanged in spirit — it still stages everything into $OUTPUT and copies it into plexmediaserver/lib — it's just driven by the actual dependency graph instead of an explicit list.

Verification

Built from this branch and tested on an AMD Radeon 780M (Phoenix, gfx1102):

  • radeonsi_drv_video.so loads with no dlopen / relocation errors
  • vainfo reports the full matrix — VAEntrypointVLD decode + VAEntrypointEncSlice encode + VAEntrypointVideoProc across H264 / HEVC / HEVC Main10 / VP9 / AV1
  • Plex Transcoder hardware encodes complete with EXIT=0:
    • H.264 1080p
    • HEVC Main10 (10-bit)

🤖 Generated with Claude Code

@skjnldsv

skjnldsv commented Jul 7, 2026

Copy link
Copy Markdown
Owner

@Nehtor thanks, have you tried it ?

@skjnldsv
skjnldsv force-pushed the fix/amd-vaapi-mesa-closure-musl branch from 72d6f02 to d07d634 Compare July 7, 2026 09:42
@skjnldsv skjnldsv added the ci: build image Build and push a sha-tagged image for this (fork) PR label Jul 7, 2026
@skjnldsv
skjnldsv force-pushed the fix/amd-vaapi-mesa-closure-musl branch from d07d634 to 935e89d Compare July 7, 2026 09:56
@skjnldsv
skjnldsv force-pushed the fix/amd-vaapi-mesa-closure-musl branch 2 times, most recently from ec7dfe4 to dad06d4 Compare July 7, 2026 14:56
@github-actions github-actions Bot removed the ci: build image Build and push a sha-tagged image for this (fork) PR label Jul 7, 2026
@github-actions

github-actions Bot commented Jul 7, 2026

Copy link
Copy Markdown

New commits pushed — removed the ci: build image label. A maintainer must re-review and re-apply it to build the updated code.

@skjnldsv skjnldsv added the ci: build image Build and push a sha-tagged image for this (fork) PR label Jul 8, 2026
@github-actions github-actions Bot removed the ci: build image Build and push a sha-tagged image for this (fork) PR label Jul 8, 2026
@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown

New commits pushed — removed the ci: build image label. A maintainer must re-review and re-apply it to build the updated code.

@skjnldsv skjnldsv added ci: build image Build and push a sha-tagged image for this (fork) PR and removed ci: build image Build and push a sha-tagged image for this (fork) PR labels Jul 8, 2026
@skjnldsv skjnldsv added the ci: build image Build and push a sha-tagged image for this (fork) PR label Jul 8, 2026
…ort_r)

The hand-maintained library copy list silently dropped newly-introduced
mesa dependencies (e.g. libSPIRV-Tools.so), so radeonsi_drv_video.so failed
to dlopen on current Alpine mesa. The musl libc bundled in plexmediaserver
also predates qsort_r, which current mesa requires, and Plex's bundled
libdrm lacks amdgpu_va_manager_alloc.

- Collect the complete ldd dependency closure of the VA drivers instead of
  an explicit per-library list, so new mesa deps are picked up automatically
  and this stops regressing on mesa bumps.
- Overwrite Plex's stale bundled libdrm and upgrade the musl loader + libc.so
  so qsort_r resolves.

Verified on AMD Radeon 780M (Phoenix, gfx1102): driver initializes with VLD
decode + EncSlice encode + VideoProc; h264 and HEVC Main10 hardware encodes
complete with EXIT=0.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@skjnldsv
skjnldsv force-pushed the fix/amd-vaapi-mesa-closure-musl branch from 5a9c262 to 4434812 Compare July 8, 2026 08:30
@github-actions github-actions Bot removed the ci: build image Build and push a sha-tagged image for this (fork) PR label Jul 8, 2026
@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown

New commits pushed — removed the ci: build image label. A maintainer must re-review and re-apply it to build the updated code.

@skjnldsv skjnldsv added the ci: build image Build and push a sha-tagged image for this (fork) PR label Jul 8, 2026
@skjnldsv
skjnldsv deployed to fork-build July 8, 2026 08:31 — with GitHub Actions Active
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci: build image Build and push a sha-tagged image for this (fork) PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants