Skip to content

Commit 2a61179

Browse files
rocm: also set LIBVA_DRIVER_NAME for AMD's vendored gallium VA-API driver
libva auto-detects the DRM driver name as "radeonsi" from the kernel and looks for radeonsi_drv_video.so. AMD vendored it as librocm_sysdeps_gallium_drv_video.so, so LIBVA_DRIVER_NAME must be set to "librocm_sysdeps_gallium" to override that. Verified locally: vaInitialize returns 0 with both LIBVA_DRIVERS_PATH and LIBVA_DRIVER_NAME set. Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent 535957e commit 2a61179

1 file changed

Lines changed: 10 additions & 5 deletions

File tree

.github/workflows/linux_rocm.yaml

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -174,14 +174,19 @@ jobs:
174174
echo "LD_LIBRARY_PATH (rocm_sdk_core): ${rocm_core_lib}"
175175
fi
176176
# ROCm 7.14 ships mesa inside _rocm_sdk_core (no separate dnf install
177-
# needed). Point libva's driver search path at the DRI drivers bundled
178-
# there so vaInitialize() can find the amdgpu/radeonsi VA-API backend.
179-
# Search recursively for *_drv_video.so so we find it regardless of
180-
# the exact subdirectory AMD chose (typically lib/dri/).
177+
# needed). libva auto-detects the DRM driver name as "radeonsi" from the
178+
# kernel, then looks for "${driver}_drv_video.so" in LIBVA_DRIVERS_PATH.
179+
# AMD vendored the driver as "librocm_sysdeps_gallium_drv_video.so", so
180+
# we must also set LIBVA_DRIVER_NAME to that basename (minus _drv_video.so)
181+
# to override the DRM-reported name. We derive both values from the actual
182+
# file found via rglob so the code stays resilient to future AMD renames.
181183
rocm_core_dri=$(python -c "import importlib.util, pathlib; spec = importlib.util.find_spec('_rocm_sdk_core'); p = pathlib.Path(spec.submodule_search_locations[0]) if spec else None; hits = list((p/'lib').rglob('*_drv_video.so')) if p else []; print(str(hits[0].parent)) if hits else None" 2>/dev/null || true)
182-
if [ -n "${rocm_core_dri}" ]; then
184+
rocm_va_driver=$(python -c "import importlib.util, pathlib; spec = importlib.util.find_spec('_rocm_sdk_core'); p = pathlib.Path(spec.submodule_search_locations[0]) if spec else None; hits = list((p/'lib').rglob('*_drv_video.so')) if p else []; print(hits[0].name.replace('_drv_video.so','')) if hits else None" 2>/dev/null || true)
185+
if [ -n "${rocm_core_dri}" ] && [ -n "${rocm_va_driver}" ]; then
183186
export LIBVA_DRIVERS_PATH="${rocm_core_dri}"
187+
export LIBVA_DRIVER_NAME="${rocm_va_driver}"
184188
echo "LIBVA_DRIVERS_PATH: ${rocm_core_dri}"
189+
echo "LIBVA_DRIVER_NAME: ${rocm_va_driver}"
185190
else
186191
echo "WARNING: no *_drv_video.so found in _rocm_sdk_core/lib; VA-API driver missing?"
187192
echo "Contents of _rocm_sdk_core/lib (recursive *_drv_video.so search):"

0 commit comments

Comments
 (0)