CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
62 lines
3.5 KiB
Bash
62 lines
3.5 KiB
Bash
#!/usr/bin/bash
|
|
# Copyright Advanced Micro Devices, Inc.
|
|
# SPDX-License-Identifier: MIT
|
|
|
|
set -e
|
|
|
|
SOURCE_DIR="${1:?Source directory must be given}"
|
|
VA_MESON_BUILD="$SOURCE_DIR/src/gallium/targets/va/meson.build"
|
|
LIBVA_MESON_BUILD="$SOURCE_DIR/subprojects/libva-2.22.0/va/meson.build"
|
|
LIBVA_MAIN_MESON_BUILD="$SOURCE_DIR/subprojects/libva-2.22.0/meson.build"
|
|
LIBVA_PKGCONFIG_MESON_BUILD="$SOURCE_DIR/subprojects/libva-2.22.0/pkgconfig/meson.build"
|
|
LIBVA_SOURCE="$SOURCE_DIR/subprojects/libva-2.22.0/va/va.c"
|
|
echo "Patching sources..."
|
|
|
|
# Replace 'gallium_drv_video' in shared_library() calls with 'rocm_sysdeps_gallium_drv_video'
|
|
# This handles both the with_amd_decode_only branch and the standard branch
|
|
sed -i -E "/shared_library\(/,/\)/ s/'gallium_drv_video'/'rocm_sysdeps_gallium_drv_video'/" "$VA_MESON_BUILD"
|
|
|
|
# Replace 'va' library name with 'rocm_sysdeps_va' in libva meson.build
|
|
sed -i -E "/shared_library\(/,/\)/ s/'va',/'rocm_sysdeps_va',/" "$LIBVA_MESON_BUILD"
|
|
|
|
# Replace 'va-drm' library name with 'rocm_sysdeps_va-drm' in libva meson.build
|
|
sed -i -E "/shared_library\(/,/\)/ s/'va-drm',/'rocm_sysdeps_va-drm',/" "$LIBVA_MESON_BUILD"
|
|
|
|
# Remove libva from pkg.generate block and add explicit name/libraries to override automatic detection
|
|
sed -i "/pkg\.generate(libva,/,/version:/ s/pkg\.generate(libva,/pkg.generate(/" "$LIBVA_PKGCONFIG_MESON_BUILD"
|
|
sed -i "/description: 'Userspace Video Acceleration (VA) core interface'/a\ name : 'va'," "$LIBVA_PKGCONFIG_MESON_BUILD"
|
|
sed -i "/description: 'Userspace Video Acceleration (VA) core interface'/a\ libraries : ['-L\${libdir}', '-lva']," "$LIBVA_PKGCONFIG_MESON_BUILD"
|
|
|
|
# Remove libva_drm from pkg.generate block and add explicit name/libraries to override automatic detection
|
|
sed -i "/pkg\.generate(libva_drm,/,/version:/ s/pkg\.generate(libva_drm,/pkg.generate(/" "$LIBVA_PKGCONFIG_MESON_BUILD"
|
|
sed -i "/description: 'Userspace Video Acceleration (VA) DRM interface'/a\ name : 'va-drm'," "$LIBVA_PKGCONFIG_MESON_BUILD"
|
|
sed -i "/description: 'Userspace Video Acceleration (VA) DRM interface'/a\ libraries : ['-L\${libdir}', '-lva-drm']," "$LIBVA_PKGCONFIG_MESON_BUILD"
|
|
|
|
# Modify libva meson.build to set driverdir to libdir
|
|
sed -i "/driverdir = join_paths(get_option('prefix'), get_option('libdir'), 'dri')/c\ driverdir = join_paths(get_option('prefix'), get_option('libdir'))" "$LIBVA_MAIN_MESON_BUILD"
|
|
|
|
# This eliminates the need for LIBVA_DRIVERS_PATH environment variable
|
|
sed -i '/^[[:space:]]*char \*search_path = NULL;/a\ char *temp_path = NULL;' "$LIBVA_SOURCE"
|
|
sed -i "/^[[:space:]]*if[[:space:]]*(![[:space:]]*search_path)[[:space:]]*$/{
|
|
N
|
|
/^[[:space:]]*if[[:space:]]*(![[:space:]]*search_path)[[:space:]]*\n[[:space:]]*search_path[[:space:]]*=[[:space:]]*VA_DRIVERS_PATH;/{
|
|
c\
|
|
if (!search_path) {\
|
|
char *rocm_path = secure_getenv(\"ROCM_PATH\");\
|
|
if (rocm_path) {\
|
|
if (asprintf(&temp_path, \"%s/lib/rocm_sysdeps/lib\", rocm_path) == -1) {\
|
|
temp_path = NULL;\
|
|
} else {\
|
|
search_path = temp_path;\
|
|
}\
|
|
} else {\
|
|
search_path = VA_DRIVERS_PATH;\
|
|
}\
|
|
}
|
|
}
|
|
}" "$LIBVA_SOURCE"
|
|
sed -i '/^[[:space:]]*search_path = strdup((const char \*)*search_path);$/a\ if (temp_path) { free(temp_path); temp_path = NULL; }' "$LIBVA_SOURCE"
|
|
|
|
# Modify pkgconfig generation to make driverdir relative to ${libdir} for relocatable packages
|
|
sed -i "/va_vars = vars + \['driverdir=' + driverdir\]/c\va_vars = vars + ['driverdir=\${libdir}']" "$LIBVA_PKGCONFIG_MESON_BUILD"
|